Optimize slerp() as proposed by Gopinath Vasalamarri.

This commit is contained in:
Rasmus Munk Larsen 2025-04-21 14:11:42 -07:00
parent 66d8111ac1
commit d2dce37767

View File

@ -793,7 +793,7 @@ EIGEN_DEVICE_FUNC Quaternion<typename internal::traits<Derived>::Scalar> Quatern
} else {
// theta is the angle between the 2 quaternions
Scalar theta = acos(absD);
Scalar sinTheta = sin(theta);
Scalar sinTheta = numext::sqrt(Scalar(1) - absD * absD);
scale0 = sin((Scalar(1) - t) * theta) / sinTheta;
scale1 = sin((t * theta)) / sinTheta;