public static TSQuaternion Slerp(TSQuaternion from, TSQuaternion to, FP t) { t = FPMath.Clamp(t, 0, 1); FP dot = Dot(from, to); if (dot < 0.0f) { to = Multiply(to, -1); dot = -dot; } FP halfTheta = FP.Acos(dot); return(Multiply(Multiply(from, FP.Sin((1 - t) * halfTheta)) + Multiply(to, FP.Sin(t * halfTheta)), 1 / FP.Sin(halfTheta))); }
public static TSQuaternion Lerp(TSQuaternion a, TSQuaternion b, FP t) { t = FPMath.Clamp(t, FP.Zero, FP.One); return(LerpUnclamped(a, b, t)); }