public static XMVector NormalizeEst(XMVector v) { //// XMVector3NormalizeEst uses a reciprocal estimate and //// returns QNaN on zero and infinite vectors. XMVector result; result = XMVector3.ReciprocalLength(v); result = XMVector.Multiply(v, result); return(result); }
public static XMVector AngleBetweenVectors(XMVector v1, XMVector v2) { XMVector l1 = XMVector3.ReciprocalLength(v1); XMVector l2 = XMVector3.ReciprocalLength(v2); XMVector dot = XMVector3.Dot(v1, v2); l1 = XMVector.Multiply(l1, l2); return(XMVector .Multiply(dot, l1) .Clamp(XMGlobalConstants.NegativeOne, XMGlobalConstants.One) .ACos()); }