aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Geometry/EulerAngles.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2013-06-10 12:03:55 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2013-06-10 12:03:55 +0200
commit26c35b95c782fa1359812acc8e4de507c223e36f (patch)
tree4a39019e92168436d39f671adb91b508b50417b0 /Eigen/src/Geometry/EulerAngles.h
parent0525874a0378a62faf4db5316636d3a62ef62a31 (diff)
Fix bug #598: add explicit cast to Scalar type
Diffstat (limited to 'Eigen/src/Geometry/EulerAngles.h')
-rw-r--r--Eigen/src/Geometry/EulerAngles.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/Eigen/src/Geometry/EulerAngles.h b/Eigen/src/Geometry/EulerAngles.h
index 3f6ecc6d9..28135a954 100644
--- a/Eigen/src/Geometry/EulerAngles.h
+++ b/Eigen/src/Geometry/EulerAngles.h
@@ -54,9 +54,9 @@ MatrixBase<Derived>::eulerAngles(Index a0, Index a1, Index a2) const
if (a0==a2)
{
res[0] = atan2(coeff(j,i), coeff(k,i));
- if((odd && res[0]<0) || ((!odd) && res[0]>0))
+ if((odd && res[0]<Scalar(0)) || ((!odd) && res[0]>Scalar(0)))
{
- res[0] = (res[0] > 0) ? res[0] - M_PI : res[0] + M_PI;
+ res[0] = (res[0] > Scalar(0)) ? res[0] - Scalar(M_PI) : res[0] + Scalar(M_PI);
Scalar s2 = Vector2(coeff(j,i), coeff(k,i)).norm();
res[1] = -atan2(s2, coeff(i,i));
}
@@ -84,8 +84,8 @@ MatrixBase<Derived>::eulerAngles(Index a0, Index a1, Index a2) const
{
res[0] = atan2(coeff(j,k), coeff(k,k));
Scalar c2 = Vector2(coeff(i,i), coeff(i,j)).norm();
- if((odd && res[0]<0) || ((!odd) && res[0]>0)) {
- res[0] = (res[0] > 0) ? res[0] - M_PI : res[0] + M_PI;
+ if((odd && res[0]<Scalar(0)) || ((!odd) && res[0]>Scalar(0))) {
+ res[0] = (res[0] > Scalar(0)) ? res[0] - Scalar(M_PI) : res[0] + Scalar(M_PI);
res[1] = atan2(-coeff(i,k), -c2);
}
else