當前位置: 首頁>>代碼示例>>C#>>正文


C# Axes類代碼示例

本文整理匯總了C#中Axes的典型用法代碼示例。如果您正苦於以下問題:C# Axes類的具體用法?C# Axes怎麽用?C# Axes使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Axes類屬於命名空間,在下文中一共展示了Axes類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的Axes類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。