本文整理汇总了C#中Vector4.Length方法的典型用法代码示例。如果您正苦于以下问题:C# Vector4.Length方法的具体用法?C# Vector4.Length怎么用?C# Vector4.Length使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vector4
的用法示例。
在下文中一共展示了Vector4.Length方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Vector4LengthTest1
public void Vector4LengthTest1()
{
Vector4 target = new Vector4();
float expected = 0.0f;
float actual = target.Length();
Assert.True(MathHelper.Equal(expected, actual), "Vector4f.Length did not return the expected value.");
}
示例2: Vector4LengthTest
public void Vector4LengthTest()
{
Vector3 a = new Vector3(1.0f, 2.0f, 3.0f);
float w = 4.0f;
Vector4 target = new Vector4(a, w);
float expected = (float)System.Math.Sqrt(30.0f);
float actual;
actual = target.Length();
Assert.True(MathHelper.Equal(expected, actual), "Vector4f.Length did not return the expected value.");
}
示例3: Length
public static void Length (int times)
{
var value = new Vector4 (0.1f, -2f, -0.2f, 0.56f);
float result;
for (int i = 0; i < times; i++) {
result = value.Length ();
}
}
示例4: Length
public void Length()
{
var vector1 = new Vector4(1, 2, 3, 4);
Assert.AreEqual(5.477226f,vector1.Length());
}
示例5: Unit
/// <summary>
/// calc unit vector from a certain Vector
/// </summary>
/// <param name="a">vector to calc unit vector from</param>
/// <returns>normalized vector</returns>
public static Vector4 Unit(Vector4 a)
{
return a / a.Length();
}