17 #include <boost/test/unit_test.hpp>
18 #include <boost/utility/binary.hpp>
20 BOOST_AUTO_TEST_SUITE(BOOST_TEST_MODULE)
25 typedef SE3::HomogeneousMatrixType HomogeneousMatrixType;
26 typedef SE3::ActionMatrixType ActionMatrixType;
28 typedef Eigen::Matrix<double, 4, 1> Vector4;
36 SE3 m_from_quat(
quat, Vector3::Random());
42 HomogeneousMatrixType aMb = amb;
43 HomogeneousMatrixType bMc = bmc;
46 HomogeneousMatrixType aMc = amc;
47 BOOST_CHECK(aMc.isApprox(aMb * bMc));
49 HomogeneousMatrixType bMa = amb.
inverse();
50 BOOST_CHECK(bMa.isApprox(aMb.inverse()));
59 BOOST_CHECK(amb.act(
p).isApprox(
Mp));
61 Vector3 Mip = (aMb.inverse() * p4).head(3);
62 BOOST_CHECK(amb.actInv(
p).isApprox(Mip));
65 ActionMatrixType aXb = amb;
66 ActionMatrixType bXc = bmc;
67 ActionMatrixType aXc = amc;
68 BOOST_CHECK(aXc.isApprox(aXb * bXc));
70 ActionMatrixType bXa = amb.
inverse();
71 BOOST_CHECK(bXa.isApprox(aXb.inverse()));
73 ActionMatrixType X_identity = identity.toActionMatrix();
74 BOOST_CHECK(X_identity.isIdentity());
76 ActionMatrixType X_identity_inverse = identity.toActionMatrixInverse();
77 BOOST_CHECK(X_identity_inverse.isIdentity());
80 BOOST_CHECK(aXb.inverse().transpose().isApprox(amb.toDualActionMatrix()));
86 BOOST_CHECK(identity.isApprox(identity));
90 SE3f::Matrix3 rot_float(amb.
rotation().cast<
float>());
91 SE3f amb_float = amb.
cast<
float>();
92 BOOST_CHECK(amb_float.isApprox(amb.
cast<
float>()));
95 BOOST_CHECK(amb_float.isApprox(amb_float2));
99 const SE3 Minv =
M.inverse();
102 BOOST_CHECK(
M.actInv(identity).isApprox(Minv));
106 const double prec = Eigen::NumTraits<double>::dummy_precision();
108 M.rotation() += prec * SE3::Matrix3::Random();
109 BOOST_CHECK(!
M.isNormalized());
111 SE3 M_normalized =
M.normalized();
115 BOOST_CHECK(
M.isNormalized());
122 typedef SE3::ActionMatrixType ActionMatrixType;
123 typedef Motion::Vector6 Vector6;
135 Vector6 bv2_vec = bv2;
138 std::stringstream ss;
139 ss <<
bv << std::endl;
140 BOOST_CHECK(!ss.str().empty());
143 Vector6 bvPbv2_vec =
bv + bv2;
144 BOOST_CHECK(bvPbv2_vec.isApprox(bv_vec + bv2_vec));
149 Motion v_not_zero(Vector6::Ones());
150 BOOST_CHECK(!v_not_zero.isZero());
152 Motion v_zero(Vector6::Zero());
153 BOOST_CHECK(v_zero.isZero());
156 BOOST_CHECK(
bv ==
bv);
157 BOOST_CHECK(!(
bv !=
bv));
160 Vector6 Mbv_vec = -
bv;
161 BOOST_CHECK(Mbv_vec.isApprox(-bv_vec));
166 BOOST_CHECK(bv3.toVector().isApprox(bv_vec + bv2_vec));
170 BOOST_CHECK(bv3.toVector().isApprox(bv2_vec));
174 BOOST_CHECK(twicebv.isApprox(
Motion(2. *
bv.toVector())));
178 BOOST_CHECK(bvtwice.isApprox(twicebv));
181 Motion bvdividedbytwo(bvtwice / 2.);
182 BOOST_CHECK(bvdividedbytwo.isApprox(
bv));
186 BOOST_CHECK(bv4.toVector().isApprox(bv2_vec));
189 ActionMatrixType aXb = amb;
190 BOOST_CHECK(amb.act(
bv).toVector().isApprox(aXb * bv_vec));
193 ActionMatrixType bXc = bmc;
194 BOOST_CHECK(bmc.actInv(
bv).toVector().isApprox(bXc.inverse() * bv_vec));
199 BOOST_CHECK(amb.act(
bv).toVector().isApprox(amc.act(cv).toVector()));
204 vxv.toVector().tail(3).norm(),
209 Motion::ActionMatrixType actv2 = bv2.toActionMatrix();
211 BOOST_CHECK(v2xv.toVector().isApprox(actv2 *
bv.toVector()));
215 Force v2xf = bv2.cross(
f);
216 Motion::ActionMatrixType dualactv2 = bv2.toDualActionMatrix();
218 BOOST_CHECK(v2xf.toVector().isApprox(dualactv2 *
f.toVector()));
219 BOOST_CHECK(dualactv2.isApprox(-actv2.transpose()));
223 BOOST_CHECK(vxf.linear().isApprox(
bv.angular().cross(
f.linear())));
225 vxf.angular().norm(),
233 Force avxf = av.cross(af);
235 BOOST_CHECK(avxf.toVector().isApprox(amb.act(bvxf).toVector()));
241 Motion bw = amb.actInv(aw);
242 Motion avxw = av.cross(aw);
244 BOOST_CHECK(avxw.toVector().isApprox(amb.act(bvxw).toVector()));
247 bv.toVector().setOnes();
248 const double eps = 1e-6;
249 BOOST_CHECK(
bv ==
bv);
250 BOOST_CHECK(
bv.isApprox(
bv));
252 bv_approx.linear()[0] +=
eps;
253 BOOST_CHECK(bv_approx.isApprox(
bv,
eps));
258 BOOST_CHECK(
a.ref().isApprox(
a));
261 BOOST_CHECK(
b.isApprox(
a.ref()));
268 Motionf a_float =
a.cast<
float>();
269 BOOST_CHECK(a_float.isApprox(
a.cast<
float>()));
272 BOOST_CHECK(a_float.isApprox(a_float2));
279 typedef Motion::Vector6 Vector6;
284 MotionV6
v(
v_ref.toVector());
286 BOOST_CHECK(
v_ref.isApprox(
v));
288 MotionV6::MotionPlain v2(
v * 2.);
291 BOOST_CHECK(v2_ref.isApprox(v2));
294 BOOST_CHECK(v2_ref.isApprox(v2));
297 BOOST_CHECK(v2.isApprox(
v));
304 BOOST_CHECK(v2.isApprox(
v));
307 BOOST_CHECK(v2.isApprox(
v));
313 v2_ref =
v_ref.cross(v3);
315 BOOST_CHECK(v2.isApprox(v2_ref));
323 Vector6 v6(Vector6::Random());
325 BOOST_CHECK(
a.ref().isApprox(
a));
328 BOOST_CHECK(
b.isApprox(
a.ref()));
337 BOOST_CHECK(
v.toVector().isZero());
353 typedef SE3::ActionMatrixType ActionMatrixType;
354 typedef Force::Vector6 Vector6;
364 Vector6 bf2_vec = bf2;
367 std::stringstream ss;
368 ss <<
bf << std::endl;
369 BOOST_CHECK(!ss.str().empty());
372 Vector6 bfPbf2_vec =
bf + bf2;
373 BOOST_CHECK(bfPbf2_vec.isApprox(bf_vec + bf2_vec));
376 Vector6 Mbf_vec = -
bf;
377 BOOST_CHECK(Mbf_vec.isApprox(-bf_vec));
382 BOOST_CHECK(bf3.toVector().isApprox(bf_vec + bf2_vec));
386 BOOST_CHECK(bf3.toVector().isApprox(bf2_vec));
390 BOOST_CHECK(bf4.toVector().isApprox(bf2_vec));
393 ActionMatrixType aXb = amb;
394 BOOST_CHECK(amb.act(
bf).toVector().isApprox(aXb.inverse().transpose() * bf_vec));
397 ActionMatrixType bXc = bmc;
398 BOOST_CHECK(bmc.actInv(
bf).toVector().isApprox(bXc.transpose() * bf_vec));
403 BOOST_CHECK(amb.act(
bf).toVector().isApprox(amc.act(
cf).toVector()));
409 Force f_not_zero(Vector6::Ones());
410 BOOST_CHECK(!f_not_zero.isZero());
412 Force f_zero(Vector6::Zero());
413 BOOST_CHECK(f_zero.isZero());
417 BOOST_CHECK(
bf ==
bf);
420 BOOST_CHECK(
bf ==
bf);
421 BOOST_CHECK(
bf != bf2);
422 BOOST_CHECK(
bf.isApprox(
bf));
423 BOOST_CHECK(!
bf.isApprox(bf2));
425 const double eps = 1e-6;
427 bf_approx.linear()[0] += 2. *
eps;
428 BOOST_CHECK(!bf_approx.isApprox(
bf,
eps));
433 BOOST_CHECK(
a.ref().isApprox(
a));
436 BOOST_CHECK(
b.isApprox(
a.ref()));
443 Forcef a_float =
a.cast<
float>();
444 BOOST_CHECK(a_float.isApprox(
a.cast<
float>()));
447 BOOST_CHECK(a_float.isApprox(a_float2));
451 const double alpha = 1.5;
456 BOOST_CHECK(alpha_f == f_alpha);
462 typedef Force::Vector6 Vector6;
467 ForceV6
f(f_ref.toVector());
469 BOOST_CHECK(f_ref.isApprox(
f));
471 ForceV6::ForcePlain f2(
f * 2.);
472 Force f2_ref(f_ref * 2.);
474 BOOST_CHECK(f2_ref.isApprox(f2));
477 BOOST_CHECK(f2_ref.isApprox(f2));
480 BOOST_CHECK(f2.isApprox(
f));
487 BOOST_CHECK(f2.isApprox(
f));
490 BOOST_CHECK(f2.isApprox(
f));
496 f2_ref =
v.cross(f_ref);
498 BOOST_CHECK(f2.isApprox(f2_ref));
506 Vector6 v6(Vector6::Random());
508 BOOST_CHECK(
a.ref().isApprox(
a));
511 BOOST_CHECK(
b.isApprox(
a.ref()));
518 typedef Inertia::Matrix6 Matrix6;
522 BOOST_CHECK_EQUAL(matI(0, 0), aI.
mass());
523 BOOST_CHECK_EQUAL(matI(1, 1), aI.
mass());
524 BOOST_CHECK_EQUAL(matI(2, 2), aI.
mass());
527 (matI - matI.transpose()).norm(),
530 (matI.topRightCorner<3, 3>() * aI.
lever()).norm(),
535 BOOST_CHECK(I1.matrix().isApprox(Matrix6::Identity()));
540 BOOST_CHECK(
f.toVector().isApprox(
v.toVector()));
548 BOOST_CHECK((bXa.transpose().inverse() * aI.matrix() * bXa.inverse()).isApprox(bI.matrix()));
551 BOOST_CHECK((bXa.transpose() * bI.matrix() * bXa).isApprox(bma.actInv(bI).matrix()));
558 BOOST_CHECK(vxf.toVector().isApprox(vxIv.toVector()));
563 BOOST_CHECK((I1.matrix() + I2.matrix()).isApprox((I1 + I2).matrix()));
571 BOOST_CHECK(I1_other.matrix().isApprox(I1.matrix()));
577 BOOST_CHECK((I1.matrix() + I2.matrix()).isApprox(I12.matrix()));
586 BOOST_CHECK((I1_other.matrix()).isApprox(I1.matrix()));
590 double kinetic_ref =
v.toVector().transpose() * aI.matrix() *
v.toVector();
591 double kinetic = aI.vtiv(
v);
592 BOOST_CHECK_SMALL(kinetic_ref - kinetic, 1e-12);
596 BOOST_CHECK(I1.matrix().isApprox(I1_bis.matrix()));
599 const double sphere_mass = 5.;
600 const double sphere_radius = 2.;
602 const double L_sphere = 2. / 5. * sphere_mass * sphere_radius * sphere_radius;
603 BOOST_CHECK_SMALL(I1.
mass() - sphere_mass, 1e-12);
604 BOOST_CHECK(I1.
lever().isZero());
610 BOOST_CHECK_SMALL(I1.
mass() - 2, 1e-12);
611 BOOST_CHECK_SMALL(I1.
lever().norm(), 1e-12);
616 BOOST_CHECK_SMALL(I1.
mass() - 2, 1e-12);
617 BOOST_CHECK_SMALL(I1.
lever().norm(), 1e-12);
622 BOOST_CHECK_SMALL(I1.
mass() - 2, 1e-12);
623 BOOST_CHECK_SMALL(I1.
lever().norm(), 1e-12);
628 BOOST_CHECK_SMALL(I1.
mass() - 1, 1e-12);
629 BOOST_CHECK_SMALL(I1.
lever().norm(), 1e-12);
631 Symmetric3(3.79705882, 0., 3.79705882, 0., 0., 1.81176471).matrix(),
636 BOOST_CHECK(aI_copy == aI);
640 BOOST_CHECK(!I_not_zero.isZero());
643 BOOST_CHECK(I_zero.isZero());
646 const double eps = 1e-6;
647 BOOST_CHECK(aI == aI);
648 BOOST_CHECK(aI.isApprox(aI));
651 BOOST_CHECK(aI_approx.isApprox(aI,
eps));
654 Inertia::Matrix6 aIvariation = aI.
variation(
v);
656 Motion::ActionMatrixType vAction =
v.toActionMatrix();
657 Motion::ActionMatrixType vDualAction =
v.toDualActionMatrix();
659 Inertia::Matrix6 aImatrix = aI.matrix();
660 Inertia::Matrix6 aIvariation_ref = vDualAction * aImatrix - aImatrix * vAction;
662 BOOST_CHECK(aIvariation.isApprox(aIvariation_ref));
663 BOOST_CHECK(vxIv.isApprox(
Force(aIvariation *
v.toVector())));
667 typedef Inertia::Matrix6 Matrix6;
671 const Matrix6 M_ref(
v.toDualActionMatrix() * I.matrix());
673 Inertia::vxi(
v, I,
M);
675 BOOST_CHECK(
M.isApprox(M_ref));
676 BOOST_CHECK(I.vxi(
v).isApprox(M_ref));
681 typedef Inertia::Matrix6 Matrix6;
685 const Matrix6 M_ref(I.matrix() *
v.toActionMatrix());
687 Inertia::ivx(
v, I,
M);
689 BOOST_CHECK(
M.isApprox(M_ref));
690 BOOST_CHECK(I.ivx(
v).isApprox(M_ref));
695 typedef Inertia::Matrix6 Matrix6;
702 Inertia::vxi(
v, I, M1);
704 Inertia::ivx(
v, I, M2);
707 BOOST_CHECK(M3.isApprox(Ivariation));
713 Inertia::Matrix6 I_inv = I.inverse();
715 BOOST_CHECK(I_inv.isApprox(I.matrix().inverse()));
724 BOOST_CHECK_CLOSE(
v[0], I.
mass(), 1e-12);
726 BOOST_CHECK(
v.segment<3>(1).isApprox(I.
mass() * I.
lever()));
729 Eigen::Matrix3d I_ov;
730 I_ov <<
v[4],
v[5],
v[7],
v[5],
v[6],
v[8],
v[7],
v[8],
v[9];
732 BOOST_CHECK(I_o.isApprox(I_ov));
735 BOOST_CHECK(I2.isApprox(I));
739 std::cout << aI << std::endl;
752 Eigen::Matrix4d pseudo_matrix = pseudo.
toMatrix();
759 BOOST_CHECK(pseudo_matrix.isApprox(pseudo_from_inertia, 1e-10));
781 U << exp_d1, s12, s13, t1,
788 Eigen::Matrix4d pseudo_chol =
U *
U.transpose();
789 BOOST_CHECK(pseudo_matrix.isApprox(pseudo_chol, 1e-10));
793 BOOST_CHECK_CLOSE(I_back.
mass(), I_from_log_cholesky.
mass(), 1e-12);
794 BOOST_CHECK(I_back.
lever().isApprox(I_from_log_cholesky.
lever(), 1e-12));
804 BOOST_CHECK(dynamic_params_inertia.isApprox(dynamic_params_log_cholesky, 1e-10));
811 BOOST_CHECK(dynamic_params_inertia.isApprox(dynamic_params_pseudo_inertia, 1e-10));
814 BOOST_CHECK(dynamic_params_log_cholesky.isApprox(dynamic_params_pseudo_inertia, 1e-10));
820 BOOST_CHECK(std::abs(
jacobian.determinant()) > 1e-10);
823 Eigen::SelfAdjointEigenSolver<Eigen::Matrix4d> eigensolver(pseudo_matrix);
824 BOOST_CHECK((eigensolver.eigenvalues().array() > 0).all());
827 std::cout << I_from_log_cholesky << std::endl;
828 std::cout << log_cholesky << std::endl;
829 std::cout << pseudo_inertia << std::endl;
840 BOOST_CHECK(
Y.cast<
double>() ==
Y);
841 BOOST_CHECK(
Y.cast<
long double>().cast<
double>() ==
Y);
844 BOOST_CHECK(Y2.isApprox(
Y.cast<
long double>()));
851 typedef Eigen::Matrix<double, 6, N> Matrix6N;
858 Matrix6N iF = Matrix6N::Random(), jF, jFinv, jF_ref, jFinv_ref;
862 for (
int k = 0; k <
N; ++k)
863 BOOST_CHECK(jMi.act(
Force(iF.col(k))).toVector().isApprox(jF.col(k)));
865 jF_ref = jMi.toDualActionMatrix() * iF;
866 BOOST_CHECK(jF_ref.isApprox(jF));
869 BOOST_CHECK(jFinv.isApprox(jF));
872 Matrix6N iF2 = Matrix6N::Random();
873 jF_ref += jMi.toDualActionMatrix() * iF2;
875 forceSet::se3Action<ADDTO>(jMi, iF2, jF);
876 BOOST_CHECK(jF.isApprox(jF_ref));
878 Matrix6N iF3 = Matrix6N::Random();
879 jF_ref -= jMi.toDualActionMatrix() * iF3;
881 forceSet::se3Action<RMTO>(jMi, iF3, jF);
882 BOOST_CHECK(jF.isApprox(jF_ref));
886 jFinv_ref = jMi.
inverse().toDualActionMatrix() * iF;
887 BOOST_CHECK(jFinv_ref.isApprox(jFinv));
889 jFinv_ref += jMi.
inverse().toDualActionMatrix() * iF2;
890 forceSet::se3ActionInverse<ADDTO>(jMi, iF2, jFinv);
891 BOOST_CHECK(jFinv.isApprox(jFinv_ref));
893 jFinv_ref -= jMi.
inverse().toDualActionMatrix() * iF3;
894 forceSet::se3ActionInverse<RMTO>(jMi, iF3, jFinv);
895 BOOST_CHECK(jFinv.isApprox(jFinv_ref));
899 for (
int k = 0; k <
N; ++k)
900 BOOST_CHECK(
v.cross(
Force(iF.col(k))).toVector().isApprox(jF.col(k)));
902 jF_ref =
v.toDualActionMatrix() * iF;
903 BOOST_CHECK(jF.isApprox(jF_ref));
905 jF_ref +=
v.toDualActionMatrix() * iF2;
906 forceSet::motionAction<ADDTO>(
v, iF2, jF);
907 BOOST_CHECK(jF.isApprox(jF_ref));
909 jF_ref -=
v.toDualActionMatrix() * iF3;
910 forceSet::motionAction<RMTO>(
v, iF3, jF);
911 BOOST_CHECK(jF.isApprox(jF_ref));
916 Matrix6N iV = Matrix6N::Random(), jV, jV_ref, jVinv, jVinv_ref;
920 for (
int k = 0; k <
N; ++k)
921 BOOST_CHECK(jMi.act(
Motion(iV.col(k))).toVector().isApprox(jV.col(k)));
923 jV_ref = jMi.toActionMatrix() * iV;
924 BOOST_CHECK(jV.isApprox(jV_ref));
927 BOOST_CHECK(jVinv.isApprox(jV));
930 Matrix6N iV2 = Matrix6N::Random();
931 jV_ref += jMi.toActionMatrix() * iV2;
932 motionSet::se3Action<ADDTO>(jMi, iV2, jV);
933 BOOST_CHECK(jV.isApprox(jV_ref));
935 Matrix6N iV3 = Matrix6N::Random();
936 jV_ref -= jMi.toActionMatrix() * iV3;
937 motionSet::se3Action<RMTO>(jMi, iV3, jV);
938 BOOST_CHECK(jV.isApprox(jV_ref));
942 jVinv_ref = jMi.
inverse().toActionMatrix() * iV;
943 BOOST_CHECK(jVinv.isApprox(jVinv_ref));
945 jVinv_ref += jMi.
inverse().toActionMatrix() * iV2;
946 motionSet::se3ActionInverse<ADDTO>(jMi, iV2, jVinv);
947 BOOST_CHECK(jVinv.isApprox(jVinv_ref));
949 jVinv_ref -= jMi.
inverse().toActionMatrix() * iV3;
950 motionSet::se3ActionInverse<RMTO>(jMi, iV3, jVinv);
951 BOOST_CHECK(jVinv.isApprox(jVinv_ref));
955 for (
int k = 0; k <
N; ++k)
956 BOOST_CHECK(
v.cross(
Motion(iV.col(k))).toVector().isApprox(jV.col(k)));
958 jV_ref =
v.toActionMatrix() * iV;
959 BOOST_CHECK(jV.isApprox(jV_ref));
961 jV_ref +=
v.toActionMatrix() * iV2;
962 motionSet::motionAction<ADDTO>(
v, iV2, jV);
963 BOOST_CHECK(jV.isApprox(jV_ref));
965 jV_ref -=
v.toActionMatrix() * iV3;
966 motionSet::motionAction<RMTO>(
v, iV3, jV);
967 BOOST_CHECK(jV.isApprox(jV_ref));
972 for (
int k = 0; k <
N; ++k)
973 BOOST_CHECK((I * (
Motion(iV.col(k)))).toVector().isApprox(jV.col(k)));
975 jV_ref = I.matrix() * iV;
976 BOOST_CHECK(jV.isApprox(jV_ref));
978 jV_ref += I.matrix() * iV2;
979 motionSet::inertiaAction<ADDTO>(I, iV2, jV);
980 BOOST_CHECK(jV.isApprox(jV_ref));
982 jV_ref -= I.matrix() * iV3;
983 motionSet::inertiaAction<RMTO>(I, iV3, jV);
984 BOOST_CHECK(jV.isApprox(jV_ref));
989 for (
int k = 0; k <
N; ++k)
990 BOOST_CHECK(
Motion(iV.col(k)).cross(
f).toVector().isApprox(jF.col(k)));
992 for (
int k = 0; k <
N; ++k)
993 jF_ref.col(k) =
Force(
Motion(iV.col(k)).cross(
f)).toVector();
994 BOOST_CHECK(jF.isApprox(jF_ref));
996 for (
int k = 0; k <
N; ++k)
997 jF_ref.col(k) +=
Force(
Motion(iV2.col(k)).cross(
f)).toVector();
998 motionSet::act<ADDTO>(iV2,
f, jF);
999 BOOST_CHECK(jF.isApprox(jF_ref));
1001 for (
int k = 0; k <
N; ++k)
1002 jF_ref.col(k) -=
Force(
Motion(iV3.col(k)).cross(
f)).toVector();
1003 motionSet::act<RMTO>(iV3,
f, jF);
1004 BOOST_CHECK(jF.isApprox(jF_ref));
1011 typedef Motion::Vector6 Vector6;
1013 Vector3 v3(Vector3::Random());
1014 Vector6 v6(Vector6::Random());
1017 BOOST_CHECK(res1.isApprox(v3));
1020 BOOST_CHECK(res2.isApprox(v6.head<3>()));
1023 BOOST_CHECK(res3.isZero());
1029 BOOST_CHECK(res41.isApprox(res42));
1039 Matrix3
M(Matrix3::Random());
1044 BOOST_CHECK(
M.isApprox(
Mref));
1048 BOOST_CHECK(
M.isApprox(Mcopy));
1052 BOOST_CHECK(
M.isApprox(
skew(
v)));
1068 BOOST_CHECK(
res.isApprox(
ref));
1084 BOOST_CHECK(r1.isApprox(
r2));
1090 BOOST_CHECK(r1[k] ==
alpha);
1095 BOOST_CHECK(r1[k] ==
Scalar(0));
1104 using namespace Eigen;
1106 Vector3d
v(Vector3d::Random());
1107 const double alpha = 3;
1122 BOOST_CHECK(XAxis::vector() == Vector3d::UnitX());
1123 BOOST_CHECK(YAxis::vector() == Vector3d::UnitY());
1124 BOOST_CHECK(ZAxis::vector() == Vector3d::UnitZ());
1140 BOOST_CHECK(r1.isApprox(
r2));
1142 for (
int k = 0; k < Axis::dim; ++k)
1146 BOOST_CHECK(r1.toVector()[k] ==
alpha);
1147 BOOST_CHECK(
r2.toVector()[k] ==
alpha);
1151 BOOST_CHECK(r1.toVector()[k] ==
Scalar(0));
1152 BOOST_CHECK(
r2.toVector()[k] ==
Scalar(0));
1163 Force f(Force::Random());
1205 typedef Motion::ActionMatrixType ActionMatrixType;
1206 typedef ActionMatrixType::ColXpr ColType;
1209 ActionMatrixType Sxf, Sxf_ref;
1210 ActionMatrixType
S(ActionMatrixType::Identity());
1219 for (
int k = 0; k < 6; ++k)
1221 MotionRefOnColType Scol(
S.col(k));
1222 ForceRefOnColType(Sxf_ref.col(k)) = Scol.cross(
f);
1225 BOOST_CHECK(Sxf.isApprox(Sxf_ref));
1228 BOOST_AUTO_TEST_SUITE_END()