7 #include <pinocchio/math/rotation.hpp> 8 #include <pinocchio/math/sincos.hpp> 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)
21 const int max_tests = 1e5;
22 for(
int k = 0; k < max_tests; ++k)
25 double cos_value, sin_value;
28 Eigen::Vector3d
axis(Eigen::Vector3d::Random().normalized());
31 Eigen::Matrix3d rot_ref = Eigen::AngleAxisd(theta,axis).toRotationMatrix();
33 BOOST_CHECK(rot.isApprox(rot_ref));
40 const int max_tests = 1e5;
42 typedef Eigen::Vector4d Vector4;
43 typedef Eigen::Quaterniond Quaternion;
44 typedef Eigen::Matrix3d Matrix3;
46 for(
int k = 0; k < max_tests; ++k)
48 const Vector4 vec4 = Vector4::Random();
49 const Quaternion
quat(vec4.normalized());
51 const Matrix3 rot =
quat.toRotationMatrix();
53 Matrix3 rot_proj = orthogonalProjection(rot);
54 BOOST_CHECK(rot.isApprox(rot_proj));
57 for(
int k = 0; k < max_tests; ++k)
59 const Matrix3
mat = Matrix3::Random();
61 Matrix3 rot_proj = orthogonalProjection(mat);
62 BOOST_CHECK((rot_proj.transpose()*rot_proj).isIdentity());
63 BOOST_CHECK(fabs(rot_proj.determinant() - 1.) <= Eigen::NumTraits<double>::dummy_precision());
67 BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(test_toRotationMatrix)
void SINCOS(const S1 &a, S2 *sa, S3 *ca)
Computes sin/cos values of a given input scalar.
Main pinocchio namespace.
void toRotationMatrix(const Eigen::MatrixBase< Vector3 > &axis, const Scalar &cos_value, const Scalar &sin_value, const Eigen::MatrixBase< Matrix3 > &res)
Computes a rotation matrix from a vector and values of sin and cos orientations values.