40 #include <visp3/core/vpExponentialMap.h> 81 double theta, si, co, sinc, mcosc, msinc;
93 theta = sqrt(u[0] * u[0] + u[1] * u[1] + u[2] * u[2]);
100 dt[0] = v_dt[0] * (sinc + u[0] * u[0] * msinc) + v_dt[1] * (u[0] * u[1] * msinc - u[2] * mcosc) +
101 v_dt[2] * (u[0] * u[2] * msinc + u[1] * mcosc);
103 dt[1] = v_dt[0] * (u[0] * u[1] * msinc + u[2] * mcosc) + v_dt[1] * (sinc + u[1] * u[1] * msinc) +
104 v_dt[2] * (u[1] * u[2] * msinc - u[0] * mcosc);
106 dt[2] = v_dt[0] * (u[0] * u[2] * msinc - u[1] * mcosc) + v_dt[1] * (u[1] * u[2] * msinc + u[0] * mcosc) +
107 v_dt[2] * (sinc + u[2] * u[2] * msinc);
123 s = sqrt(v_dt[3] * v_dt[3] + v_dt[4] * v_dt[4] + v_dt[5] * v_dt[5]);
125 for (i = 0; i < 3; i++)
126 u[i] = v_dt[3 + i] / s;
127 double sinu = sin(s);
128 double cosi = cos(s);
129 double mcosi = 1 - cosi;
130 rd[0][0] = cosi + mcosi * u[0] * u[0];
131 rd[0][1] = -sinu * u[2] + mcosi * u[0] * u[1];
132 rd[0][2] = sinu * u[1] + mcosi * u[0] * u[2];
133 rd[1][0] = sinu * u[2] + mcosi * u[1] * u[0];
134 rd[1][1] = cosi + mcosi * u[1] * u[1];
135 rd[1][2] = -sinu * u[0] + mcosi * u[1] * u[2];
136 rd[2][0] = -sinu * u[1] + mcosi * u[2] * u[0];
137 rd[2][1] = sinu * u[0] + mcosi * u[2] * u[1];
138 rd[2][2] = cosi + mcosi * u[2] * u[2];
140 dt[0] = v_dt[0] * (sinu / s + u[0] * u[0] * (1 - sinu / s)) +
141 v_dt[1] * (u[0] * u[1] * (1 - sinu / s) - u[2] * mcosi / s) +
142 v_dt[2] * (u[0] * u[2] * (1 - sinu / s) + u[1] * mcosi / s);
144 dt[1] = v_dt[0] * (u[0] * u[1] * (1 - sinu / s) + u[2] * mcosi / s) +
145 v_dt[1] * (sinu / s + u[1] * u[1] * (1 - sinu / s)) +
146 v_dt[2] * (u[1] * u[2] * (1 - sinu / s) - u[0] * mcosi / s);
148 dt[2] = v_dt[0] * (u[0] * u[2] * (1 - sinu / s) - u[1] * mcosi / s) +
149 v_dt[1] * (u[1] * u[2] * (1 - sinu / s) + u[0] * mcosi / s) +
150 v_dt[2] * (sinu / s + u[2] * u[2] * (1 - sinu / s));
152 for (i = 0; i < 3; i++) {
153 for (j = 0; j < 3; j++)
167 for (i = 0; i < 4; i++) {
168 for (j = 0; j < 4; j++)
169 if (fabs(Delta[i][j] - Delta_old[i][j]) > 1.e-5)
173 printf(
"pb vpHomogeneousMatrix::expMap\n");
174 std::cout <<
" Delta : " << std::endl << Delta << std::endl;
175 std::cout <<
" Delta_old : " << std::endl << Delta_old << std::endl;
220 double theta, si, co, sinc, mcosc, msinc, det;
227 for (i = 0; i < 3; i++)
230 theta = sqrt(u[0] * u[0] + u[1] * u[1] + u[2] * u[2]);
241 a[0][0] = sinc + u[0] * u[0] * msinc;
242 a[0][1] = u[0] * u[1] * msinc - u[2] * mcosc;
243 a[0][2] = u[0] * u[2] * msinc + u[1] * mcosc;
245 a[1][0] = u[0] * u[1] * msinc + u[2] * mcosc;
246 a[1][1] = sinc + u[1] * u[1] * msinc;
247 a[1][2] = u[1] * u[2] * msinc - u[0] * mcosc;
249 a[2][0] = u[0] * u[2] * msinc - u[1] * mcosc;
250 a[2][1] = u[1] * u[2] * msinc + u[0] * mcosc;
251 a[2][2] = sinc + u[2] * u[2] * msinc;
253 det = a[0][0] * a[1][1] * a[2][2] + a[1][0] * a[2][1] * a[0][2] + a[0][1] * a[1][2] * a[2][0] -
254 a[2][0] * a[1][1] * a[0][2] - a[1][0] * a[0][1] * a[2][2] - a[0][0] * a[2][1] * a[1][2];
256 if (fabs(det) > 1.e-5) {
257 v[0] = (M[0][3] * a[1][1] * a[2][2] + M[1][3] * a[2][1] * a[0][2] + M[2][3] * a[0][1] * a[1][2] -
258 M[2][3] * a[1][1] * a[0][2] - M[1][3] * a[0][1] * a[2][2] - M[0][3] * a[2][1] * a[1][2]) /
260 v[1] = (a[0][0] * M[1][3] * a[2][2] + a[1][0] * M[2][3] * a[0][2] + M[0][3] * a[1][2] * a[2][0] -
261 a[2][0] * M[1][3] * a[0][2] - a[1][0] * M[0][3] * a[2][2] - a[0][0] * M[2][3] * a[1][2]) /
263 v[2] = (a[0][0] * a[1][1] * M[2][3] + a[1][0] * a[2][1] * M[0][3] + a[0][1] * M[1][3] * a[2][0] -
264 a[2][0] * a[1][1] * M[0][3] - a[1][0] * a[0][1] * M[2][3] - a[0][0] * a[2][1] * M[1][3]) /
static vpColVector inverse(const vpHomogeneousMatrix &M)
Implementation of an homogeneous matrix and operations on such kind of matrices.
void extract(vpRotationMatrix &R) const
vpThetaUVector buildFrom(const vpHomogeneousMatrix &M)
static double sinc(double x)
Implementation of a rotation matrix and operations on such kind of matrices.
void insert(const vpRotationMatrix &R)
static double mcosc(double cosx, double x)
vpRotationMatrix buildFrom(const vpHomogeneousMatrix &M)
Implementation of column vector and the associated operations.
static vpHomogeneousMatrix direct(const vpColVector &v)
Class that consider the case of a translation vector.
Implementation of a rotation vector as axis-angle minimal representation.
static double msinc(double sinx, double x)