本文整理汇总了C#中System.Vector3.Magnitude方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3.Magnitude方法的具体用法?C# Vector3.Magnitude怎么用?C# Vector3.Magnitude使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Vector3
的用法示例。
在下文中一共展示了Vector3.Magnitude方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestMagnitude
private void TestMagnitude(Vector3 v1, Vector3 v2, DXVec3 dx1, DXVec3 dx2)
{
Magnitudes = new float[4];
Magnitudes[0] = v1.Magnitude();
Magnitudes[1] = v2.Magnitude();
Magnitudes[2] = dx1.Length();
Magnitudes[3] = dx2.Length();
MagnitudesSq = new float[4];
MagnitudesSq[0] = v1.MagnitudeS();
MagnitudesSq[1] = v2.MagnitudeS();
MagnitudesSq[2] = dx1.LengthSq();
MagnitudesSq[3] = dx2.LengthSq();
}
示例2: Distance
/// <summary>
/// <para>Returns the distance between a and b.</para>
/// </summary>
/// <param name="a"></param>
/// <param name="b"></param>
public static double Distance(Vector3<double> a, Vector3<double> b)
{
Vector3<double> vec3 = new Vector3<double>(a.x - b.x, a.y - b.y, a.z - b.z);
return vec3.Magnitude();
}
示例3: Test_Vector3_Generic_Magnitude_Against_Unity3D
public static void Test_Vector3_Generic_Magnitude_Against_Unity3D(float a, float b, float c)
{
//arrange
Vector3<float> genericVec3One = new Vector3<float>(a, b, c);
UnityEngine.Vector3 unityVec3One = new UnityEngine.Vector3(a, b, c);
//assert
Assert.AreEqual(genericVec3One.Magnitude(), unityVec3One.magnitude);
}