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

C# Axes类代码示例

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

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



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

示例1: Lerp

        public static Vector2 Lerp(this Vector2 vector, Vector2 target, float time, Axes axis)
        {
            vector.x = axis.Contains(Axes.X) && Mathf.Abs(target.x - vector.x) > epsilon ? Mathf.Lerp(vector.x, target.x, time) : vector.x;
            vector.y = axis.Contains(Axes.Y) && Mathf.Abs(target.y - vector.y) > epsilon ? Mathf.Lerp(vector.y, target.y, time) : vector.y;

            return vector;
        }
开发者ID:Dracir,项目名称:Final-bablititi,代码行数:7,代码来源:Vector2Extensions.cs


示例2: Distance

        public static float Distance(this Vector3 vector, Vector3 target, Axes axes)
        {
            float distance = 0f;

            switch (axes)
            {
                case Axes.X:
                    distance = Mathf.Abs(vector.x - target.x);
                    break;
                case Axes.Y:
                    distance = Mathf.Abs(vector.y - target.y);
                    break;
                case Axes.Z:
                    distance = Mathf.Abs(vector.z - target.z);
                    break;
                case Axes.XY:
                    distance = Vector2.Distance(vector, target);
                    break;
                case Axes.XZ:
                    distance = Vector2.Distance(new Vector2(vector.x, vector.z), new Vector2(target.x, target.z));
                    break;
                case Axes.YZ:
                    distance = Vector2.Distance(new Vector2(vector.y, vector.z), new Vector2(target.y, target.z));
                    break;
                case Axes.XYZ:
                    distance = Vector3.Distance(vector, target);
                    break;
            }

            return distance;
        }
开发者ID:Magicolo,项目名称:PseudoFramework,代码行数:31,代码来源:Vector3Extensions.cs


示例3: GetAcceleration

 /// <summary>
 /// Get the acceleration of one axis in Gs.
 /// </summary>
 /// <param name="axis">The axis to read from.</param>
 /// <returns>Acceleration of the ADXL345 in Gs.</returns>
 public override double GetAcceleration(Axes axis)
 {
     byte[] transferBuffer = new byte[3];
     transferBuffer[0] = (byte)((AddressRead | AddressMultiByte | DataRegister) + (byte)axis);
     m_spi.Transaction(transferBuffer, transferBuffer, 3);
     return BitConverter.ToInt16(transferBuffer, 1) * GsPerLSB;
 }
开发者ID:ThadHouse,项目名称:robotdotnet-wpilib,代码行数:12,代码来源:ADXL345_SPI.cs


示例4: Average

        public static float Average(this Vector4 vector, Axes axis)
        {
            float average = 0;
            int axisCount = 0;

            if (axis.Contains(Axes.X)) {
                average += vector.x;
                axisCount += 1;
            }

            if (axis.Contains(Axes.Y)) {
                average += vector.y;
                axisCount += 1;
            }

            if (axis.Contains(Axes.Z)) {
                average += vector.z;
                axisCount += 1;
            }

            if (axis.Contains(Axes.W)) {
                average += vector.w;
                axisCount += 1;
            }

            return average / axisCount;
        }
开发者ID:Dracir,项目名称:Final-bablititi,代码行数:27,代码来源:Vector4Extensions.cs


示例5: Average

        public static float Average(this Vector3 vector, Axes axes)
        {
            float average = 0f;
            int axisCount = 0;

            if ((axes & Axes.X) != 0)
            {
                average += vector.x;
                axisCount += 1;
            }

            if ((axes & Axes.Y) != 0)
            {
                average += vector.y;
                axisCount += 1;
            }

            if ((axes & Axes.Z) != 0)
            {
                average += vector.z;
                axisCount += 1;
            }

            return average / axisCount;
        }
开发者ID:Magicolo,项目名称:PseudoFramework,代码行数:25,代码来源:Vector3Extensions.cs


示例6: Div

        public static Vector2 Div(this Vector2 vector, Vector2 otherVector, Axes axis)
        {
            vector.x = axis.Contains(Axes.X) ? vector.x / otherVector.x : vector.x;
            vector.y = axis.Contains(Axes.Y) ? vector.y / otherVector.y : vector.y;

            return vector;
        }
开发者ID:Dracir,项目名称:Final-bablititi,代码行数:7,代码来源:Vector2Extensions.cs


示例7: Div

        public static Vector3 Div(this Vector3 vector, Vector3 otherVector, Axes axis)
        {
            vector.x = axis.Contains(Axes.X) ? vector.x / otherVector.x : vector.x;
            vector.y = axis.Contains(Axes.Y) ? vector.y / otherVector.y : vector.y;
            vector.z = axis.Contains(Axes.Z) ? vector.z / otherVector.z : vector.z;

            return vector;
        }
开发者ID:Dracir,项目名称:Final-bablititi,代码行数:8,代码来源:Vector3Extensions.cs


示例8: SetY

		/// <summary>
		/// Sets the value of the Y axe.
		/// </summary>

		public Vector3 SetY (float y)
		{
			if (y != value.y)
			{
				value.y = y;
				axes |= Axes.Y;
			}
			return value;
		}
开发者ID:wsjuang,项目名称:transportjam,代码行数:13,代码来源:NGUITransformInspector.cs


示例9: Div

        public static Vector4 Div(this Vector4 vector, Vector4 otherVector, Axes axis)
        {
            vector.x = axis.Contains(Axes.X) ? vector.x / otherVector.x : vector.x;
            vector.y = axis.Contains(Axes.Y) ? vector.y / otherVector.y : vector.y;
            vector.z = axis.Contains(Axes.Z) ? vector.z / otherVector.z : vector.z;
            vector.w = axis.Contains(Axes.W) ? vector.w / otherVector.w : vector.w;

            return vector;
        }
开发者ID:Dracir,项目名称:Final-bablititi,代码行数:9,代码来源:Vector4Extensions.cs


示例10: SetX

		/// <summary>
		/// Sets the value of the X axe.
		/// </summary>

		public Vector3 SetX (float x)
		{
			if (x != value.x)
			{
				value.x = x;
				axes |= Axes.X;
			}
			return value;
		}
开发者ID:wsjuang,项目名称:transportjam,代码行数:13,代码来源:NGUITransformInspector.cs


示例11: CreateNodeTest

#pragma warning restore 649

		private NodeSet CreateNodeTest (Axes axis, object nodeTest, ArrayList plist)
		{
			NodeSet test = CreateNodeTest (axis, nodeTest);
			if (plist != null) {
				for (int i = 0; i < plist.Count; i++)
					test = new ExprFilter (test,
						(Expression) plist [i]);
			}
			return test;
		}
开发者ID:RainsSoft,项目名称:SharpLang,代码行数:12,代码来源:PatternParser.cs


示例12: Ceil

        public static Vector2 Ceil(this Vector2 vector, Axes axes)
        {
            if ((axes & Axes.X) != 0)
                vector.x = Mathf.Ceil(vector.x);

            if ((axes & Axes.Y) != 0)
                vector.y = Mathf.Ceil(vector.y);

            return vector;
        }
开发者ID:Magicolo,项目名称:PseudoFramework,代码行数:10,代码来源:Vector2Extensions.cs


示例13: Lerp

        public static Vector2 Lerp(this Vector2 vector, Vector2 target, float time, Axes axes)
        {
            if ((axes & Axes.X) != 0 && Mathf.Abs(target.x - vector.x) > _epsilon)
                vector.x = Mathf.Lerp(vector.x, target.x, time);

            if ((axes & Axes.Y) != 0 && Mathf.Abs(target.y - vector.y) > _epsilon)
                vector.y = Mathf.Lerp(vector.y, target.y, time);

            return vector;
        }
开发者ID:Magicolo,项目名称:No-Love-No-Gain,代码行数:10,代码来源:Vector2Extensions.cs


示例14: AccelerateTowards

 public static void AccelerateTowards(this Rigidbody2D rigidbody, Vector2 targetAcceleration, float speed, InterpolationModes interpolation, Axes axis = Axes.XY)
 {
     switch (interpolation) {
         case InterpolationModes.Quadratic:
             rigidbody.SetVelocity(rigidbody.velocity.Lerp(targetAcceleration, Time.fixedDeltaTime * speed, axis), axis);
             break;
         case InterpolationModes.Linear:
             rigidbody.SetVelocity(rigidbody.velocity.LerpLinear(targetAcceleration, Time.fixedDeltaTime * speed, axis), axis);
             break;
     }
 }
开发者ID:Dracir,项目名称:Final-bablititi,代码行数:11,代码来源:Rigidbody2DExtension.cs


示例15: Resolve

        public static Axes Resolve(Axes axis1, Axes axis2)
        {
            if (axis1 == axis2)
                throw new ArgumentException("Cannot resolve duplicate axes.");

            if ((axis1 == Axes.X || axis1 == Axes.Y) && (axis2 == Axes.X || axis2 == Axes.Y))
                return Axes.Z;
            else if ((axis1 == Axes.X || axis1 == Axes.Z) && (axis2 == Axes.X || axis2 == Axes.Z))
                return Axes.Y;
            else
                return Axes.X;
        }
开发者ID:SlyvanGames,项目名称:ps2ls,代码行数:12,代码来源:ModelExporter.cs


示例16: AccelerateTowards

 public static void AccelerateTowards(this Rigidbody2D rigidbody, Vector2 targetSpeed, float acceleration, float deltaTime, InterpolationModes interpolation = InterpolationModes.Quadratic, Axes axes = Axes.XY)
 {
     switch (interpolation)
     {
         case InterpolationModes.Quadratic:
             rigidbody.SetVelocity(rigidbody.velocity.Lerp(targetSpeed, deltaTime * acceleration, axes), axes);
             break;
         case InterpolationModes.Linear:
             rigidbody.SetVelocity(rigidbody.velocity.LerpLinear(targetSpeed, deltaTime * acceleration, axes), axes);
             break;
     }
 }
开发者ID:Magicolo,项目名称:No-Love-No-Gain,代码行数:12,代码来源:Rigidbody2DExtension.cs


示例17: ShowAxis

 // ShowAxis
 private static void ShowAxis( ref Axes axis, string label )
 {
     GUILayout.BeginHorizontal();
     axis.enabled = EditorGUILayout.Toggle( axis.enabled, GUILayout.Width( 15f ) );
     GUILayout.Label( "Axis " + label, GUILayout.Width( 50f ) );
     GUI.enabled = axis.enabled;
     axis.Name = EditorGUILayout.TextField( axis.Name, GUILayout.Width( 100f ) );
     GUILayout.Space( 10f );
     axis.inverse = EditorGUILayout.Toggle( axis.inverse, GUILayout.Width( 15f ) );
     GUILayout.Label( "Inverse", GUILayout.Width( 55f ) );
     GUI.enabled = true;
     GUILayout.EndHorizontal();
 }
开发者ID:cemkoker,项目名称:Tile,代码行数:14,代码来源:AxesHelper.cs


示例18: PhysicalHeliState

        public PhysicalHeliState(Quaternion orientation, Vector3 pos, Vector3 velocity, Vector3 acceleration)
        {
            Orientation = orientation;
            Position = pos;
            Velocity = velocity;
            Acceleration = acceleration;

            Matrix orientationMatrix = Matrix.CreateFromQuaternion(orientation);
            Axes = VectorHelper.GetAxes(orientation);
            PitchAngle = VectorHelper.GetPitchAngle(orientationMatrix);
            RollAngle = VectorHelper.GetRollAngle(orientationMatrix);
            HeadingAngle = VectorHelper.GetHeadingAngle(orientationMatrix);
        }
开发者ID:idaohang,项目名称:Helicopter-Autopilot-Simulator,代码行数:13,代码来源:PhysicalHeliState.cs


示例19: GenericConstraint

		/// <summary>
		/// Construct a new generic constraint.
		/// </summary>
		/// <param name="bodyA">The first constrained body.</param>
		/// <param name="bodyB">The second constrained body.</param>
		/// <param name="basis">The world-space frame of the second body against which the first body will be constrained. This value
		/// must contain the initial position and orientation of the second body at the time the constraint was created.</param>
		/// <param name="limitedPosAxes">Specifies which axes around which to constrain position.</param>
		/// <param name="minPos">The minimum distances between the two bodies along each axis.</param>
		/// <param name="maxPos">The maximum distances between the two bodies along each axis.</param>
		/// <param name="limitedRotAxes">Specifies which axes around which to constrain rotation.</param>
		/// <param name="minAngles">The minimum relative angles, in radians, around each axis.</param>
		/// <param name="maxAngles">The maximum relative angles, in radians, around each axis.</param>
		public GenericConstraint(RigidBody bodyA, RigidBody bodyB, Frame basis, Axes limitedPosAxes,
			Vector3 minPos, Vector3 maxPos, Axes limitedRotAxes, Vector3 minAngles, Vector3 maxAngles)
			: base(bodyA, bodyB)
		{
			Frame.Transform(ref basis, ref bodyA.WorldInverse, out _bodyBasisA);
			Frame.Transform(ref basis, ref bodyB.WorldInverse, out _bodyBasisB);
			_limitedPosAxes = limitedPosAxes;
			_limitedRotAxes = limitedRotAxes;
			_minPos = minPos;
			_maxPos = maxPos;
			_minAngles = minAngles;
			_maxAngles = maxAngles;
		}
开发者ID:jdddog,项目名称:jengasimulatorp4p,代码行数:26,代码来源:GenericConstraint.cs


示例20: Reflect

 public void Reflect(Axes axis)
 {
     switch (axis)
     {
         case Axes.X:
             ReflectX();
             break;
         case Axes.Y:
             ReflectY();
             break;
         case Axes.Z:
             ReflectZ();
             break;
     }
 }
开发者ID:ch-egor,项目名称:Donut-diagram-WinForms,代码行数:15,代码来源:Point3D.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Axis类代码示例发布时间:2022-05-24
下一篇:
C# AxWMPLib类代码示例发布时间: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