|
12 | 12 | #include <Eigen/Geometry>
|
13 | 13 | #include <Eigen/LU>
|
14 | 14 | #include <Eigen/SVD>
|
| 15 | +#include "AnnoyingScalar.h" |
15 | 16 |
|
16 | 17 | template<typename T> T bounded_acos(T v)
|
17 | 18 | {
|
@@ -85,7 +86,7 @@ template<typename Scalar, int Options> void quaternion(void)
|
85 | 86 | if (refangle>Scalar(EIGEN_PI))
|
86 | 87 | refangle = Scalar(2)*Scalar(EIGEN_PI) - refangle;
|
87 | 88 |
|
88 |
| - if((q1.coeffs()-q2.coeffs()).norm() > 10*largeEps) |
| 89 | + if((q1.coeffs()-q2.coeffs()).norm() > Scalar(10)*largeEps) |
89 | 90 | {
|
90 | 91 | VERIFY_IS_MUCH_SMALLER_THAN(abs(q1.angularDistance(q2) - refangle), Scalar(1));
|
91 | 92 | }
|
@@ -113,7 +114,7 @@ template<typename Scalar, int Options> void quaternion(void)
|
113 | 114 |
|
114 | 115 | // Do not execute the test if the rotation angle is almost zero, or
|
115 | 116 | // the rotation axis and v1 are almost parallel.
|
116 |
| - if (abs(aa.angle()) > 5*test_precision<Scalar>() |
| 117 | + if (abs(aa.angle()) > Scalar(5)*test_precision<Scalar>() |
117 | 118 | && (aa.axis() - v1.normalized()).norm() < Scalar(1.99)
|
118 | 119 | && (aa.axis() + v1.normalized()).norm() < Scalar(1.99))
|
119 | 120 | {
|
@@ -285,18 +286,36 @@ template<typename PlainObjectType> void check_const_correctness(const PlainObjec
|
285 | 286 | VERIFY( !(Map<ConstPlainObjectType, Aligned>::Flags & LvalueBit) );
|
286 | 287 | }
|
287 | 288 |
|
| 289 | +#if EIGEN_HAS_RVALUE_REFERENCES |
| 290 | + |
| 291 | +// Regression for bug 1573 |
| 292 | +struct MovableClass { |
| 293 | + MovableClass() = default; |
| 294 | + MovableClass(const MovableClass&) = default; |
| 295 | + MovableClass(MovableClass&&) noexcept = default; |
| 296 | + MovableClass& operator=(const MovableClass&) = default; |
| 297 | + MovableClass& operator=(MovableClass&&) = default; |
| 298 | + Quaternionf m_quat; |
| 299 | +}; |
| 300 | + |
| 301 | +#endif |
| 302 | + |
288 | 303 | EIGEN_DECLARE_TEST(geo_quaternion)
|
289 | 304 | {
|
290 | 305 | for(int i = 0; i < g_repeat; i++) {
|
291 | 306 | CALL_SUBTEST_1(( quaternion<float,AutoAlign>() ));
|
292 | 307 | CALL_SUBTEST_1( check_const_correctness(Quaternionf()) );
|
| 308 | + CALL_SUBTEST_1(( quaternion<float,DontAlign>() )); |
| 309 | + CALL_SUBTEST_1(( quaternionAlignment<float>() )); |
| 310 | + CALL_SUBTEST_1( mapQuaternion<float>() ); |
| 311 | + |
293 | 312 | CALL_SUBTEST_2(( quaternion<double,AutoAlign>() ));
|
294 | 313 | CALL_SUBTEST_2( check_const_correctness(Quaterniond()) );
|
295 |
| - CALL_SUBTEST_3(( quaternion<float,DontAlign>() )); |
296 |
| - CALL_SUBTEST_4(( quaternion<double,DontAlign>() )); |
297 |
| - CALL_SUBTEST_5(( quaternionAlignment<float>() )); |
298 |
| - CALL_SUBTEST_6(( quaternionAlignment<double>() )); |
299 |
| - CALL_SUBTEST_1( mapQuaternion<float>() ); |
| 314 | + CALL_SUBTEST_2(( quaternion<double,DontAlign>() )); |
| 315 | + CALL_SUBTEST_2(( quaternionAlignment<double>() )); |
300 | 316 | CALL_SUBTEST_2( mapQuaternion<double>() );
|
| 317 | + |
| 318 | + AnnoyingScalar::dont_throw = true; |
| 319 | + CALL_SUBTEST_3(( quaternion<AnnoyingScalar,AutoAlign>() )); |
301 | 320 | }
|
302 | 321 | }
|
0 commit comments