Warning, file /include/eigen3/Eigen/src/Geometry/EulerAngles.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef EIGEN_EULERANGLES_H
0011 #define EIGEN_EULERANGLES_H
0012
0013 namespace Eigen {
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 template<typename Derived>
0036 EIGEN_DEVICE_FUNC inline Matrix<typename MatrixBase<Derived>::Scalar,3,1>
0037 MatrixBase<Derived>::eulerAngles(Index a0, Index a1, Index a2) const
0038 {
0039 EIGEN_USING_STD(atan2)
0040 EIGEN_USING_STD(sin)
0041 EIGEN_USING_STD(cos)
0042
0043 EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Derived,3,3)
0044
0045 Matrix<Scalar,3,1> res;
0046 typedef Matrix<typename Derived::Scalar,2,1> Vector2;
0047
0048 const Index odd = ((a0+1)%3 == a1) ? 0 : 1;
0049 const Index i = a0;
0050 const Index j = (a0 + 1 + odd)%3;
0051 const Index k = (a0 + 2 - odd)%3;
0052
0053 if (a0==a2)
0054 {
0055 res[0] = atan2(coeff(j,i), coeff(k,i));
0056 if((odd && res[0]<Scalar(0)) || ((!odd) && res[0]>Scalar(0)))
0057 {
0058 if(res[0] > Scalar(0)) {
0059 res[0] -= Scalar(EIGEN_PI);
0060 }
0061 else {
0062 res[0] += Scalar(EIGEN_PI);
0063 }
0064 Scalar s2 = Vector2(coeff(j,i), coeff(k,i)).norm();
0065 res[1] = -atan2(s2, coeff(i,i));
0066 }
0067 else
0068 {
0069 Scalar s2 = Vector2(coeff(j,i), coeff(k,i)).norm();
0070 res[1] = atan2(s2, coeff(i,i));
0071 }
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083 Scalar s1 = sin(res[0]);
0084 Scalar c1 = cos(res[0]);
0085 res[2] = atan2(c1*coeff(j,k)-s1*coeff(k,k), c1*coeff(j,j) - s1 * coeff(k,j));
0086 }
0087 else
0088 {
0089 res[0] = atan2(coeff(j,k), coeff(k,k));
0090 Scalar c2 = Vector2(coeff(i,i), coeff(i,j)).norm();
0091 if((odd && res[0]<Scalar(0)) || ((!odd) && res[0]>Scalar(0))) {
0092 if(res[0] > Scalar(0)) {
0093 res[0] -= Scalar(EIGEN_PI);
0094 }
0095 else {
0096 res[0] += Scalar(EIGEN_PI);
0097 }
0098 res[1] = atan2(-coeff(i,k), -c2);
0099 }
0100 else
0101 res[1] = atan2(-coeff(i,k), c2);
0102 Scalar s1 = sin(res[0]);
0103 Scalar c1 = cos(res[0]);
0104 res[2] = atan2(s1*coeff(k,i)-c1*coeff(j,i), c1*coeff(j,j) - s1 * coeff(k,j));
0105 }
0106 if (!odd)
0107 res = -res;
0108
0109 return res;
0110 }
0111
0112 }
0113
0114 #endif