public static XMVector BaryCentricV(XMVector q0, XMVector q1, XMVector q2, XMVector f, XMVector g) { Debug.Assert(f.Y == f.X && f.Z == f.X && f.W == f.X, "Reviewed"); Debug.Assert(g.Y == g.X && g.Z == g.X && g.W == g.X, "Reviewed"); XMVector epsilon = XMVector.FromSplatConstant(1, 16); XMVector s = XMVector.Add(f, g); XMVector result; if (XMVector4.InBounds(s, epsilon)) { result = q0; } else { XMVector q01 = XMQuaternion.SlerpV(q0, q1, s); XMVector q02 = XMQuaternion.SlerpV(q0, q2, s); XMVector gs = s.Reciprocal(); gs = XMVector.Multiply(g, gs); result = XMQuaternion.SlerpV(q01, q02, gs); } return(result); }
public static XMVector SquadV(XMVector q0, XMVector q1, XMVector q2, XMVector q3, XMVector t) { Debug.Assert(t.Y == t.X && t.Z == t.X && t.W == t.X, "Reviewed"); XMVector tp = t; XMVector two = XMVector.FromSplatConstant(2, 0); XMVector q03 = XMQuaternion.SlerpV(q0, q3, t); XMVector q12 = XMQuaternion.SlerpV(q1, q2, t); tp = XMVector.NegativeMultiplySubtract(tp, tp, tp); tp = XMVector.Multiply(tp, two); return(XMQuaternion.SlerpV(q03, q12, tp)); }
public static XMVector Slerp(XMVector q0, XMVector q1, float t) { XMVector tV = XMVector.Replicate(t); return(XMQuaternion.SlerpV(q0, q1, tV)); }