From d2dce377670f1742f3f701b3585682d02f10bb92 Mon Sep 17 00:00:00 2001 From: Rasmus Munk Larsen Date: Mon, 21 Apr 2025 14:11:42 -0700 Subject: [PATCH] Optimize slerp() as proposed by Gopinath Vasalamarri. --- Eigen/src/Geometry/Quaternion.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Eigen/src/Geometry/Quaternion.h b/Eigen/src/Geometry/Quaternion.h index 822ab2786..6a7cab2b5 100644 --- a/Eigen/src/Geometry/Quaternion.h +++ b/Eigen/src/Geometry/Quaternion.h @@ -793,7 +793,7 @@ EIGEN_DEVICE_FUNC Quaternion::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;