Fix bug #598: add explicit cast to Scalar type

This commit is contained in:
Gael Guennebaud 2013-06-10 12:03:55 +02:00
parent 0525874a03
commit 26c35b95c7

View File

@ -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