9 #include <Eigen/Geometry>
11 #include <boost/variant.hpp>
13 #include <boost/test/unit_test.hpp>
14 #include <boost/utility/binary.hpp>
16 BOOST_AUTO_TEST_SUITE(BOOST_TEST_MODULE)
22 const int max_tests = 1e5;
24 const int max_tests = 1e2;
26 for (
int k = 0; k < max_tests; ++k)
29 double cos_value, sin_value;
32 const Eigen::Vector3d
axis(Eigen::Vector3d::Random().normalized());
39 const Eigen::Matrix3d rot_ref = Eigen::AngleAxisd(theta,
axis).toRotationMatrix();
41 BOOST_CHECK(rot.isApprox(rot_ref));
42 BOOST_CHECK(rot2.isApprox(rot_ref));
50 const int max_tests = 1e5;
52 const int max_tests = 1e2;
55 typedef Eigen::Vector4d Vector4;
57 typedef Eigen::Matrix3d Matrix3;
59 for (
int k = 0; k < max_tests; ++k)
61 const Vector4 vec4 = Vector4::Random();
64 const Matrix3 rot =
quat.toRotationMatrix();
66 Matrix3 rot_proj = orthogonalProjection(rot);
67 BOOST_CHECK(rot.isApprox(rot_proj));
70 for (
int k = 0; k < max_tests; ++k)
72 const Matrix3
mat = Matrix3::Random();
74 Matrix3 rot_proj = orthogonalProjection(
mat);
75 BOOST_CHECK((rot_proj.transpose() * rot_proj).isIdentity());
76 BOOST_CHECK(fabs(rot_proj.determinant() - 1.) <= Eigen::NumTraits<double>::dummy_precision());
80 BOOST_AUTO_TEST_SUITE_END()