mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-12 19:59:05 +08:00
Fix bug #598: add explicit cast to Scalar type
This commit is contained in:
parent
0525874a03
commit
26c35b95c7
@ -54,9 +54,9 @@ MatrixBase<Derived>::eulerAngles(Index a0, Index a1, Index a2) const
|
|||||||
if (a0==a2)
|
if (a0==a2)
|
||||||
{
|
{
|
||||||
res[0] = atan2(coeff(j,i), coeff(k,i));
|
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();
|
Scalar s2 = Vector2(coeff(j,i), coeff(k,i)).norm();
|
||||||
res[1] = -atan2(s2, coeff(i,i));
|
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));
|
res[0] = atan2(coeff(j,k), coeff(k,k));
|
||||||
Scalar c2 = Vector2(coeff(i,i), coeff(i,j)).norm();
|
Scalar c2 = Vector2(coeff(i,i), coeff(i,j)).norm();
|
||||||
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);
|
||||||
res[1] = atan2(-coeff(i,k), -c2);
|
res[1] = atan2(-coeff(i,k), -c2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user