47 Index a0, Index a1, Index a2)
const {
49 EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Derived, 3, 3)
53 const Index odd = ((a0 + 1) % 3 == a1) ? 0 : 1;
55 const Index j = (a0 + 1 + odd) % 3;
56 const Index k = (a0 + 2 - odd) % 3;
67 Scalar s2 = numext::hypot(coeff(j, i), coeff(k, i));
69 res[0] = numext::atan2(coeff(j, i), coeff(k, i));
71 res[1] = numext::atan2(s2, coeff(i, i));
81 res[0] = numext::atan2(-coeff(j, i), -coeff(k, i));
82 res[1] = -numext::atan2(s2, coeff(i, i));
99 if (s2 > NumTraits<Scalar>::epsilon()) {
103 s1 = coeff(j, i) * inv_s2;
104 c1 = coeff(k, i) * inv_s2;
107 s1 = -coeff(j, i) * inv_s2;
108 c1 = -coeff(k, i) * inv_s2;
112 s1 = numext::sin(res[0]);
113 c1 = numext::cos(res[0]);
115 res[2] = numext::atan2(c1 * coeff(j, k) - s1 * coeff(k, k), c1 * coeff(j, j) - s1 * coeff(k, j));
128 Scalar n1 = numext::hypot(coeff(j, k), coeff(k, k));
129 res[0] = numext::atan2(coeff(j, k), coeff(k, k));
131 Scalar c2 = numext::hypot(coeff(i, i), coeff(i, j));
134 res[1] = numext::atan2(-coeff(i, k), c2);
137 if (n1 > NumTraits<Scalar>::epsilon()) {
139 s1 = coeff(j, k) * inv_n1;
140 c1 = coeff(k, k) * inv_n1;
144 s1 = numext::sin(res[0]);
145 c1 = numext::cos(res[0]);
147 res[2] = numext::atan2(s1 * coeff(k, i) - c1 * coeff(j, i), c1 * coeff(j, j) - s1 * coeff(k, j));
170 Index a0, Index a1, Index a2)
const {
172 EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Derived, 3, 3)
176 const Index odd = ((a0 + 1) % 3 == a1) ? 0 : 1;
178 const Index j = (a0 + 1 + odd) % 3;
179 const Index k = (a0 + 2 - odd) % 3;
182 res[0] = numext::atan2(coeff(j, i), coeff(k, i));
183 if ((odd && res[0] <
Scalar(0)) || ((!odd) && res[0] >
Scalar(0))) {
185 res[0] -=
Scalar(EIGEN_PI);
187 res[0] +=
Scalar(EIGEN_PI);
190 Scalar s2 = numext::hypot(coeff(j, i), coeff(k, i));
191 res[1] = -numext::atan2(s2, coeff(i, i));
193 Scalar s2 = numext::hypot(coeff(j, i), coeff(k, i));
194 res[1] = numext::atan2(s2, coeff(i, i));
207 Scalar s1 = numext::sin(res[0]);
208 Scalar c1 = numext::cos(res[0]);
209 res[2] = numext::atan2(c1 * coeff(j, k) - s1 * coeff(k, k), c1 * coeff(j, j) - s1 * coeff(k, j));
211 res[0] = numext::atan2(coeff(j, k), coeff(k, k));
212 Scalar c2 = numext::hypot(coeff(i, i), coeff(i, j));
213 if ((odd && res[0] <
Scalar(0)) || ((!odd) && res[0] >
Scalar(0))) {
215 res[0] -=
Scalar(EIGEN_PI);
217 res[0] +=
Scalar(EIGEN_PI);
219 res[1] = numext::atan2(-coeff(i, k), -c2);
221 res[1] = numext::atan2(-coeff(i, k), c2);
223 Scalar s1 = numext::sin(res[0]);
224 Scalar c1 = numext::cos(res[0]);
225 res[2] = numext::atan2(s1 * coeff(k, i) - c1 * coeff(j, i), c1 * coeff(j, j) - s1 * coeff(k, j));