43 rot = rot * (
Matrix3D)AngleAxisd(0.01, Vector3D::UnitX());
45 cerr <<
"Initial rotation matrix accuracy" << endl;
46 I = R * R.transpose();
47 for (
int i = 0; i < 3; ++i) {
48 for (
int j = 0; j < 3; ++j) {
49 printf(
"%.30f ", I(i,j));
54 cerr <<
"After further multiplications" << endl;
55 for (
int i = 0; i < 10000; ++i)
57 I = R * R.transpose();
58 for (
int i = 0; i < 3; ++i) {
59 for (
int j = 0; j < 3; ++j) {
60 printf(
"%.30f ", I(i,j));
65 cerr << PVAR(R) << endl;
66 printf(
"det %.30f\n", R.determinant());
67 printf(
"\nUsing nearest orthogonal matrix\n");
71 cerr << PVAR(R) << endl;
72 printf(
"det %.30f\n", R.determinant());
73 I = R * R.transpose();
74 for (
int i = 0; i < 3; ++i) {
75 for (
int j = 0; j < 3; ++j) {
76 printf(
"%.30f ", I(i,j));
80 cerr <<
"Norm of the columns" << endl;
81 for (
int i = 0; i < 3; ++i)
82 printf(
"%.30f ", R.col(i).norm());
83 printf(
"\nUsing approximate nearest orthogonal matrix\n");
84 I = approxSolution * approxSolution.transpose();
85 cerr << PVAR(approxSolution) << endl;
86 printf(
"det %.30f\n", approxSolution.determinant());
87 for (
int i = 0; i < 3; ++i) {
88 for (
int j = 0; j < 3; ++j) {
89 printf(
"%.30f ", I(i,j));
93 cerr <<
"Norm of the columns" << endl;
94 for (
int i = 0; i < 3; ++i)
95 printf(
"%.30f ", approxSolution.col(i).norm());
102 cerr <<
"m1=fromEuler(eulerAngles)" << endl;
103 cerr <<
"eulerAngles:" << endl;
104 cerr << eulerAngles << endl;
105 cerr <<
"m1:" << endl;
109 cerr <<
"eulerAngles1 = toEuler(m1) " << endl;
110 cerr <<
"eulerAngles1:" << endl;
111 cerr << eulerAngles1 << endl;
114 cerr <<
"q=toCompactQuaternion(m1)" << endl;
115 cerr <<
"q:" << endl;
119 cerr <<
"m2=fromCompactQuaternion(q);" << endl;
120 cerr <<
"m2:" << endl;
125 et.block<3,1>(0,0)=eulerAngles;
126 et.block<3,1>(3,0)=t;
128 cerr <<
"i1 = fromVectorET(et);" << endl;
129 cerr <<
"et:" << endl;
131 cerr <<
"i1" << endl;
132 cerr << i1.rotation() << endl;
133 cerr << i1.translation() << endl;
135 cerr <<
"et2=toVectorET(i1);" << endl;
136 cerr <<
"et2" << endl;
140 cerr <<
"qt1=toVectorMQT(i1)" << endl;
141 cerr <<
"qt1:" << endl;
145 cerr <<
"i2 = fromVectorMQT(qt1)" << endl;
146 cerr <<
"i2" << endl;
147 cerr << i2.rotation() << endl;
148 cerr << i2.translation() << endl;
151 cerr <<
"qt2=toVectorQT(i1)" << endl;
152 cerr <<
"qt2:" << endl;
156 cerr <<
"i3 = fromVectorQT(qt2)" << endl;
157 cerr <<
"i3" << endl;
158 cerr << i3.rotation() << endl;
159 cerr << i3.translation() << endl;
Vector3D toEuler(const Matrix3D &R)
void nearestOrthogonalMatrix(const Eigen::MatrixBase< Derived > &R)
Matrix3D fromCompactQuaternion(const Vector3D &v)
Eigen::Matrix< double, 3, 1, Eigen::ColMajor > Vector3D
Isometry3D fromVectorQT(const Vector7d &v)
Eigen::Matrix< double, 7, 1 > Vector7d
Vector3D toCompactQuaternion(const Matrix3D &R)
Vector6d toVectorET(const Isometry3D &t)
Eigen::Transform< double, 3, Eigen::Isometry, Eigen::ColMajor > Isometry3D
Vector6d toVectorMQT(const Isometry3D &t)
Eigen::Matrix< double, 3, 3, Eigen::ColMajor > Matrix3D
void approximateNearestOrthogonalMatrix(const Eigen::MatrixBase< Derived > &R)
Eigen::Matrix< double, 6, 1 > Vector6d
Vector7d toVectorQT(const Isometry3D &t)
Isometry3D fromVectorMQT(const Vector6d &v)
Isometry3D fromVectorET(const Vector6d &v)
Matrix3D fromEuler(const Vector3D &v)