Пример #1
0
        public static XMVector NormalizeEst(XMVector v)
        {
            //// XMVector4NormalizeEst uses a reciprocal estimate and
            //// returns QNaN on zero and infinite vectors.

            XMVector result;

            result = XMVector4.ReciprocalLength(v);
            result = XMVector.Multiply(v, result);

            return(result);
        }
Пример #2
0
        public static XMVector AngleBetweenVectors(XMVector v1, XMVector v2)
        {
            XMVector l1  = XMVector4.ReciprocalLength(v1);
            XMVector l2  = XMVector4.ReciprocalLength(v2);
            XMVector dot = XMVector4.Dot(v1, v2);

            l1 = XMVector.Multiply(l1, l2);

            return(XMVector
                   .Multiply(dot, l1)
                   .Clamp(XMGlobalConstants.NegativeOne, XMGlobalConstants.One)
                   .ACos());
        }
Пример #3
0
 public static XMVector ReciprocalLength(XMVector q)
 {
     return(XMVector4.ReciprocalLength(q));
 }