diff options
author | Hongkai Dai <daihongkai@gmail.com> | 2016-09-19 10:30:30 -0700 |
---|---|---|
committer | Hongkai Dai <daihongkai@gmail.com> | 2016-09-19 10:30:30 -0700 |
commit | 5dcc6d301a822db0fb95d5b9e010c0eb39d85bbc (patch) | |
tree | ecad6f56eea354241ec4d1d514fb88fa8e63b096 /unsupported/Eigen/src/EulerAngles | |
parent | bf03820339f45f9483ddbe5bb927ca3078fda19b (diff) |
remove ternary operator in euler angles
Diffstat (limited to 'unsupported/Eigen/src/EulerAngles')
-rw-r--r-- | unsupported/Eigen/src/EulerAngles/EulerSystem.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/unsupported/Eigen/src/EulerAngles/EulerSystem.h b/unsupported/Eigen/src/EulerAngles/EulerSystem.h index 82243e643..98f9f647d 100644 --- a/unsupported/Eigen/src/EulerAngles/EulerSystem.h +++ b/unsupported/Eigen/src/EulerAngles/EulerSystem.h @@ -189,7 +189,12 @@ namespace Eigen res[0] = atan2(mat(J,K), mat(K,K)); Scalar c2 = Vector2(mat(I,I), mat(I,J)).norm(); if((IsOdd && res[0]<Scalar(0)) || ((!IsOdd) && res[0]>Scalar(0))) { - res[0] = (res[0] > Scalar(0)) ? res[0] - Scalar(EIGEN_PI) : res[0] + Scalar(EIGEN_PI); + if(res[0] > Scalar(0)) { + res[0] -= Scalar(EIGEN_PI); + } + else { + res[0] += Scalar(EIGEN_PI); + } res[1] = atan2(-mat(I,K), -c2); } else @@ -212,7 +217,12 @@ namespace Eigen res[0] = atan2(mat(J,I), mat(K,I)); if((IsOdd && res[0]<Scalar(0)) || ((!IsOdd) && res[0]>Scalar(0))) { - res[0] = (res[0] > Scalar(0)) ? res[0] - Scalar(EIGEN_PI) : res[0] + Scalar(EIGEN_PI); + if(res[0] > Scalar(0)) { + res[0] -= Scalar(EIGEN_PI); + } + else { + res[0] += Scalar(EIGEN_PI); + } Scalar s2 = Vector2(mat(J,I), mat(K,I)).norm(); res[1] = -atan2(s2, mat(I,I)); } |