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