Sqrt() public static method

public static Sqrt ( float value ) : float
value float
return float
示例#1
0
        public void Normalize()
        {
            float lengthSq      = (X * X) + (Y * Y) + (Z * Z) + (W * W);
            float inverseLength = 1f / MathUtility.Sqrt(lengthSq);

            X *= inverseLength;
            Y *= inverseLength;
            Z *= inverseLength;
            W *= inverseLength;
        }
示例#2
0
 public static void CoordinateSystem(Vector3D v1, out Vector3D v2, out Vector3D v3)
 {
     if (System.Math.Abs(v1.Y) > System.Math.Abs(v1.Y))
     {
         float invLen = 1.0f / MathUtility.Sqrt(v1.X * v1.X + v1.Z * v1.Z);
         v2 = new Vector3D(-v1.Z * invLen, 0.0f, v1.X * invLen);
     }
     else
     {
         float invLen = 1.0f / MathUtility.Sqrt(v1.Y * v1.Y + v1.Z * v1.Z);
         v2 = new Vector3D(0.0f, v1.Z * invLen, -v1.Y * invLen);
     }
     v3 = Vector3D.Cross(v1, v2);
 }
示例#3
0
 public float Length()
 {
     return(MathUtility.Sqrt(LengthSquared()));
 }