10 #ifndef EIGEN_EULERANGLES_H 11 #define EIGEN_EULERANGLES_H 35 template<
typename Derived>
48 const Index odd = ((a0+1)%3 == a1) ? 0 : 1;
50 const Index j = (a0 + 1 + odd)%3;
51 const Index k = (a0 + 2 - odd)%3;
55 res[0] = atan2(coeff(j,i), coeff(k,i));
56 if((odd && res[0]<
Scalar(0)) || ((!odd) && res[0]>
Scalar(0)))
59 Scalar s2 = Vector2(coeff(j,i), coeff(k,i)).norm();
60 res[1] = -atan2(s2, coeff(i,i));
64 Scalar s2 = Vector2(coeff(j,i), coeff(k,i)).norm();
65 res[1] = atan2(s2, coeff(i,i));
80 res[2] = atan2(c1*coeff(j,k)-s1*coeff(k,k), c1*coeff(j,j) - s1 * coeff(k,j));
84 res[0] = atan2(coeff(j,k), coeff(k,k));
85 Scalar c2 = Vector2(coeff(i,i), coeff(i,j)).norm();
86 if((odd && res[0]<
Scalar(0)) || ((!odd) && res[0]>
Scalar(0))) {
88 res[1] = atan2(-coeff(i,k), -c2);
91 res[1] = atan2(-coeff(i,k), c2);
94 res[2] = atan2(s1*coeff(k,i)-c1*coeff(j,i), c1*coeff(j,j) - s1 * coeff(k,j));
104 #endif // EIGEN_EULERANGLES_H internal::traits< Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > >::Scalar Scalar
internal::traits< Derived >::Index Index
The type of indices.
internal::traits< Derived >::Scalar Scalar
Matrix< Scalar, 3, 1 > eulerAngles(Index a0, Index a1, Index a2) const
#define EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(TYPE, ROWS, COLS)
const CwiseUnaryOp< internal::scalar_sin_op< Scalar >, const Derived > sin() const
const CwiseUnaryOp< internal::scalar_cos_op< Scalar >, const Derived > cos() const