• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Quat类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Quat的典型用法代码示例。如果您正苦于以下问题:C# Quat类的具体用法?C# Quat怎么用?C# Quat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Quat类属于命名空间,在下文中一共展示了Quat类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ToODE

		public static void ToODE( Quat value, out Ode.dQuaternion result )
		{
			result.X = value.X;
			result.Y = value.Y;
			result.Z = value.Z;
			result.W = value.W;
		}
开发者ID:whztt07,项目名称:SDK,代码行数:7,代码来源:Convert.cs


示例2: Eval

		public float Eval( float x, float y, float z )
		{
			var q = new Quat();
			var tmp = new Quat();

			var i = 0;

			q.R = x;
			q.I = y;
			q.J = z;
			q.K = 0;

			for ( i = 30; i > 0; i-- )
			{
				QSqr( ref tmp, q );
				QMult( ref q, this.emio, tmp );
				QAdd( ref q, this.c );

				if ( q.R*q.R + q.I*q.I + q.J*q.J + q.K*q.K > 8.0 )
				{
					break;
				}
			}

			return (float)i;
		}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:26,代码来源:Julia.cs


示例3: Quat

	public Quat(Quat q)
	{
		this.x = q.x;
	    this.y = q.y;
		this.z = q.z;
		this.w = q.w;
	}
开发者ID:kharbechteinn,项目名称:Scatterer,代码行数:7,代码来源:Quat.cs


示例4: QSqr

		public void QSqr( ref Quat b, Quat a )
		{
			b.R = a.R*a.R - a.I*a.I - a.J*a.J - a.K*a.K;
			b.I = 2.0f*a.R*a.I;
			b.J = 2.0f*a.R*a.J;
			b.K = 2.0f*a.R*a.K;
		}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:7,代码来源:Julia.cs


示例5: QMult

		public void QMult( ref Quat c, Quat a, Quat b )
		{
			c.R = a.R*b.R - a.I*b.I - a.J*b.J - a.K*b.K;
			c.I = a.R*b.I + a.I*b.R + a.J*b.K - a.K*b.J;
			c.J = a.R*b.J + a.J*b.R + a.K*b.I - a.I*b.K;
			c.K = a.R*b.K + a.K*b.R + a.I*b.J - a.J*b.I;
		}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:7,代码来源:Julia.cs


示例6: QAdd

		public void QAdd( ref Quat a, Quat b )
		{
			a.R += b.R;
			a.I += b.I;
			a.J += b.J;
			a.K += b.K;
		}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:7,代码来源:Julia.cs


示例7: SkyBox

 public SkyBox(int id, MessageBus bus)
 {
     Id = id;
     Bus = bus;
     Position = new Vect3(0, 0, 0);
     Rotation = new Quat(Math.Sqrt(0.5), 0, 0, Math.Sqrt(0.5));
 }
开发者ID:veggielane,项目名称:ORTS,代码行数:7,代码来源:SkyBox.cs


示例8: SetForceFireRotationLookTo

        public void SetForceFireRotationLookTo( Vec3 lookTo )
        {
            setForceFireRotation = true;

            Vec3 diff = lookTo - Position;
            //Vec3 diff = lookTo - GetFirePosition( false );

            forceFireRotation = Quat.FromDirectionZAxisUp( diff );
        }
开发者ID:whztt07,项目名称:SDK,代码行数:9,代码来源:Weapon.cs


示例9: PhysX_GetDrivePosition

 public override void PhysX_GetDrivePosition( out Vec3 position, out Quat rotation )
 {
     if( nativeJoint == IntPtr.Zero )
     {
         position = Vec3.Zero;
         rotation = Quat.Identity;
         return;
     }
     PhysXNativeWrapper.PhysXNativeD6Joint.GetDrivePosition( nativeJoint, out position, out rotation );
 }
开发者ID:whztt07,项目名称:SDK,代码行数:10,代码来源:PhysXUniversalJoint.cs


示例10: SetLookDirection

        public void SetLookDirection(Vec3 pos)
        {
            Vec2 diff = pos.ToVec2() - Position.ToVec2();

            if (diff == Vec2.Zero)
                return;

            Radian dir = MathFunctions.ATan16(diff.Y, diff.X);

            float halfAngle = dir * 0.5f;
            Quat rot = new Quat(new Vec3(0, 0, MathFunctions.Sin16(halfAngle)), MathFunctions.Cos16(halfAngle));
            Rotation = rot;
        }
开发者ID:DarrenHassan,项目名称:GDM4242-GroupD,代码行数:13,代码来源:GenericAntCharacter.cs


示例11: SpringWheel

        public SpringWheel(Bone bone, Unit unit, float size, float stiffness, float damping)
        {
            this.bone = bone;
            this.size = size;
            this.stiffness = stiffness;
            this.damping = damping;
            this.unit = unit;
            originalBonePosition = bone.Position;
            originalBoneRotation = bone.Rotation;

            mesh = new MapObjectAttachedMesh();
            mesh.MeshName = "Types/Units/AwesomeAircraft/AwesomeAircraftWheel.mesh";
            mesh.ScaleOffset = new Vec3(1, 1, 1);
            mesh.RotationOffset = Quat.Identity;
            mesh.PositionOffset = bone.GetDerivedPosition();
            unit.Attach(mesh);
        }
开发者ID:CITS4242B2010,项目名称:project2010,代码行数:17,代码来源:SpringWheel.cs


示例12: Julia

		/// <summary>
		/// 
		/// </summary>
		/// <param name="globalReal"></param>
		/// <param name="globalImag"></param>
		/// <param name="globalTheta"></param>
		public Julia( float globalReal, float globalImag, float globalTheta )
		{
			oc = new Quat();
			oc.R = globalReal;
			oc.I = globalImag;
			oc.J = oc.K = 0.0f;

			eio = new Quat();
			eio.R = Utility.Cos( globalTheta );
			eio.I = Utility.Sin( globalTheta );
			eio.J = eio.K = 0;

            emio = new Quat();
            emio.R = Utility.Cos( -globalTheta );
            emio.I = Utility.Sin( -globalTheta );
            emio.J = eio.K = 0;

			QMult( ref c, eio, oc );
		}
开发者ID:WolfgangSt,项目名称:axiom,代码行数:25,代码来源:Julia.cs


示例13: Julia

		public Julia( float globalReal, float globalImag, float globalTheta )
		{
			this.globalReal = globalReal;
			this.globalImag = globalImag;
			this.globalTheta = globalTheta;

			this.oc = new Quat();
			this.oc.R = globalReal;
			this.oc.I = globalImag;
			this.oc.J = this.oc.K = 0.0f;

			this.eio = new Quat();
			this.eio.R = Utility.Cos( globalTheta );
			this.eio.I = Utility.Sin( globalTheta );
			this.eio.J = this.eio.K = 0;

			this.emio = new Quat();
			this.emio.R = Utility.Cos( -globalTheta );
			this.emio.I = Utility.Sin( -globalTheta );
			this.emio.J = this.emio.K = 0;

			QMult( ref this.c, this.eio, this.oc );
		}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:23,代码来源:Julia.cs


示例14: OnSetTransform

        protected override void OnSetTransform( ref Vec3 pos, ref Quat rot, ref Vec3 scl )
        {
            base.OnSetTransform( ref pos, ref rot, ref scl );

            //server side
            if( EntitySystemWorld.Instance.IsServer() )
            {
                //send new position to clients
                Server_SendPositionToClients( EntitySystemWorld.Instance.RemoteEntityWorlds );
            }
        }
开发者ID:whztt07,项目名称:SDK,代码行数:11,代码来源:JigsawPuzzlePiece.cs


示例15: Rotate

	static public Matrix3x3 Rotate(Vector3 rotation)
	{
		Quat x = new Quat(new Vector3d2(1,0,0), rotation.x * MathUtility.Deg2Rad );
		Quat y = new Quat(new Vector3d2(0,1,0), rotation.y * MathUtility.Deg2Rad );
		Quat z = new Quat(new Vector3d2(0,0,1), rotation.z * MathUtility.Deg2Rad );
		
		return (z*y*x).ToMatrix3x3();
	}
开发者ID:kharbechteinn,项目名称:Scatterer,代码行数:8,代码来源:Matrix3x3.cs


示例16: IsUnused

 public static bool IsUnused(Quat var)
 {
     return IsUnused(var.W);
 }
开发者ID:RogierWV,项目名称:315GR,代码行数:4,代码来源:UnusedMarker.cs


示例17: UpdateRotation

		public void UpdateRotation( bool allowUpdateOldRotation )
		{
			float halfAngle = horizontalDirectionForUpdateRotation * .5f;
			Quat rot = new Quat( new Vec3( 0, 0, MathFunctions.Sin( halfAngle ) ),
				MathFunctions.Cos( halfAngle ) );

			const float epsilon = .001f;

			//update Rotation
			if( !Rotation.Equals( rot, epsilon ) )
				Rotation = rot;

			//update OldRotation
			if( allowUpdateOldRotation )
			{
				//disable updating OldRotation property for TPSArcade demo and for PlatformerDemo
				bool updateOldRotation = true;
				if( Intellect != null && PlayerIntellect.Instance == Intellect )
				{
					if( GameMap.Instance != null && (
						GameMap.Instance.GameType == GameMap.GameTypes.TPSArcade ||
						GameMap.Instance.GameType == GameMap.GameTypes.PlatformerDemo ) )
					{
						updateOldRotation = false;
					}
				}
				if( updateOldRotation )
					OldRotation = rot;
			}
		}
开发者ID:whztt07,项目名称:NeoAxisCommunity,代码行数:30,代码来源:Character.cs


示例18: GetFireParameters

        void GetFireParameters( out Vec3 pos, out Quat rot, out float speed )
        {
            Camera camera = RendererWorld.Instance.DefaultCamera;

            pos = catapult.Position + new Vec3( 0, 0, .7f );

            Radian verticalAngle = new Degree( 30 ).InRadians();

            rot = Quat.Identity;
            speed = 0;

            if( catapultFiring )
            {
                Ray startRay = camera.GetCameraToViewportRay( catapultFiringMouseStartPosition );
                Ray ray = camera.GetCameraToViewportRay( MousePosition );

                Plane plane = Plane.FromPointAndNormal( pos, Vec3.ZAxis );

                Vec3 startRayPos;
                if( !plane.RayIntersection( startRay, out startRayPos ) )
                {
                    //must never happen
                }

                Vec3 rayPos;
                if( !plane.RayIntersection( ray, out rayPos ) )
                {
                    //must never happen
                }

                Vec2 diff = rayPos.ToVec2() - startRayPos.ToVec2();

                Radian horizonalAngle = MathFunctions.ATan( diff.Y, diff.X ) + MathFunctions.PI;

                SphereDir dir = new SphereDir( horizonalAngle, verticalAngle );
                rot = Quat.FromDirectionZAxisUp( dir.GetVector() );

                float distance = diff.Length();

                //3 meters clamp
                MathFunctions.Clamp( ref distance, .001f, 3 );

                speed = distance * 10;
            }
        }
开发者ID:whztt07,项目名称:SDK,代码行数:45,代码来源:CatapultDemoGameWindow.cs


示例19: OnSetTransform

        /// <summary>Overridden from <see cref="Engine.MapSystem.MapObject.OnSetTransform(ref Vec3,ref Quat,ref Vec3)"/>.</summary>
        protected override void OnSetTransform( ref Vec3 pos, ref Quat rot, ref Vec3 scl )
        {
            base.OnSetTransform( ref pos, ref rot, ref scl );

            if( region != null )
                region.SetTransform( Position, Rotation, InfluenceRegionScale );
        }
开发者ID:DarrenHassan,项目名称:GDM4242-GroupD,代码行数:8,代码来源:Fan.cs


示例20: OnSetTransform

        protected override void OnSetTransform( ref Vec3 pos, ref Quat rot, ref Vec3 scl )
        {
            base.OnSetTransform( ref pos, ref rot, ref scl );

            if( IsPostCreated )
            {
                if( EntitySystemWorld.Instance.IsServer() )
                {
                    if( Type.NetworkType == EntityNetworkTypes.Synchronized )
                        Server_SendPositionToAllClients();
                }
            }
        }
开发者ID:CITS4242B2010,项目名称:project2010,代码行数:13,代码来源:Item.cs



注:本文中的Quat类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Quaternion类代码示例发布时间:2022-05-24
下一篇:
C# Quality类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap