From ac9d805c2fc65ae62b7e78ff175ed81978f9277f Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Wed, 7 Jan 2009 09:47:16 +0000 Subject: [PATCH] two scalar conversion fixes --- Eigen/src/Geometry/Quaternion.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Eigen/src/Geometry/Quaternion.h b/Eigen/src/Geometry/Quaternion.h index 058eff7f1..f595adcb9 100644 --- a/Eigen/src/Geometry/Quaternion.h +++ b/Eigen/src/Geometry/Quaternion.h @@ -354,7 +354,7 @@ inline Quaternion& Quaternion::setFromTwoVectors(const MatrixBas // set to identity this->w() = 1; this->vec().setZero(); } - Scalar s = ei_sqrt((1+c)*2); + Scalar s = ei_sqrt((Scalar(1)+c)*Scalar(2)); Scalar invs = Scalar(1)/s; this->vec() = axis * invs; this->w() = s * Scalar(0.5); @@ -459,7 +459,7 @@ struct ei_quaternion_assign_impl int j = (i+1)%3; int k = (j+1)%3; - t = Scalar(ei_sqrt(mat.coeff(i,i)-mat.coeff(j,j)-mat.coeff(k,k) + 1.0)); + t = ei_sqrt(mat.coeff(i,i)-mat.coeff(j,j)-mat.coeff(k,k) + Scalar(1.0)); q.coeffs().coeffRef(i) = Scalar(0.5) * t; t = Scalar(0.5)/t; q.w() = (mat.coeff(k,j)-mat.coeff(j,k))*t;