43 #include <visp/vpExponentialMap.h>
92 double theta,si,co,sinc,mcosc,msinc;
104 theta = sqrt(u[0]*u[0] + u[1]*u[1] + u[2]*u[2]);
111 dt[0] = v_dt[0]*(sinc + u[0]*u[0]*msinc)
112 + v_dt[1]*(u[0]*u[1]*msinc - u[2]*mcosc)
113 + v_dt[2]*(u[0]*u[2]*msinc + u[1]*mcosc);
115 dt[1] = v_dt[0]*(u[0]*u[1]*msinc + u[2]*mcosc)
116 + v_dt[1]*(sinc + u[1]*u[1]*msinc)
117 + v_dt[2]*(u[1]*u[2]*msinc - u[0]*mcosc);
119 dt[2] = v_dt[0]*(u[0]*u[2]*msinc - u[1]*mcosc)
120 + v_dt[1]*(u[1]*u[2]*msinc + u[0]*mcosc)
121 + v_dt[2]*(sinc + u[2]*u[2]*msinc);
134 double sinu,cosi,mcosi,s;
139 s = sqrt(v_dt[3]*v_dt[3] + v_dt[4]*v_dt[4] + v_dt[5]*v_dt[5]);
142 for (i=0;i<3;i++) u[i] = v_dt[3+i]/s;
146 rd[0][0] = cosi + mcosi*u[0]*u[0];
147 rd[0][1] = -sinu*u[2] + mcosi*u[0]*u[1];
148 rd[0][2] = sinu*u[1] + mcosi*u[0]*u[2];
149 rd[1][0] = sinu*u[2] + mcosi*u[1]*u[0];
150 rd[1][1] = cosi + mcosi*u[1]*u[1];
151 rd[1][2] = -sinu*u[0] + mcosi*u[1]*u[2];
152 rd[2][0] = -sinu*u[1] + mcosi*u[2]*u[0];
153 rd[2][1] = sinu*u[0] + mcosi*u[2]*u[1];
154 rd[2][2] = cosi + mcosi*u[2]*u[2];
156 dt[0] = v_dt[0]*(sinu/s + u[0]*u[0]*(1-sinu/s))
157 + v_dt[1]*(u[0]*u[1]*(1-sinu/s)-u[2]*mcosi/s)
158 + v_dt[2]*(u[0]*u[2]*(1-sinu/s)+u[1]*mcosi/s);
160 dt[1] = v_dt[0]*(u[0]*u[1]*(1-sinu/s)+u[2]*mcosi/s)
161 + v_dt[1]*(sinu/s + u[1]*u[1]*(1-sinu/s))
162 + v_dt[2]*(u[1]*u[2]*(1-sinu/s)-u[0]*mcosi/s);
164 dt[2] = v_dt[0]*(u[0]*u[2]*(1-sinu/s)-u[1]*mcosi/s)
165 + v_dt[1]*(u[1]*u[2]*(1-sinu/s)+u[0]*mcosi/s)
166 + v_dt[2]*(sinu/s + u[2]*u[2]*(1-sinu/s));
172 for(j=0;j<3;j++) rd[i][j] = 0.0;
188 if (fabs(Delta[i][j] - Delta_old[i][j]) > 1.e-5) pb = 1;
192 printf(
"pb vpHomogeneousMatrix::expMap\n");
193 std::cout <<
" Delta : " << std::endl << Delta << std::endl;
194 std::cout <<
" Delta_old : " << std::endl << Delta_old << std::endl;
246 double theta,si,co,sinc,mcosc,msinc,det;
253 for (i=0;i<3;i++) v[3+i] = u[i];
255 theta = sqrt(u[0]*u[0] + u[1]*u[1] + u[2]*u[2]);
266 a[0][0] = sinc + u[0]*u[0]*msinc;
267 a[0][1] = u[0]*u[1]*msinc - u[2]*mcosc;
268 a[0][2] = u[0]*u[2]*msinc + u[1]*mcosc;
270 a[1][0] = u[0]*u[1]*msinc + u[2]*mcosc;
271 a[1][1] = sinc + u[1]*u[1]*msinc;
272 a[1][2] = u[1]*u[2]*msinc - u[0]*mcosc;
274 a[2][0] = u[0]*u[2]*msinc - u[1]*mcosc;
275 a[2][1] = u[1]*u[2]*msinc + u[0]*mcosc;
276 a[2][2] = sinc + u[2]*u[2]*msinc;
278 det = a[0][0]*a[1][1]*a[2][2] + a[1][0]*a[2][1]*a[0][2]
279 + a[0][1]*a[1][2]*a[2][0] - a[2][0]*a[1][1]*a[0][2]
280 - a[1][0]*a[0][1]*a[2][2] - a[0][0]*a[2][1]*a[1][2];
282 if (fabs(det) > 1.e-5)
284 v[0] = (M[0][3]*a[1][1]*a[2][2]
285 + M[1][3]*a[2][1]*a[0][2]
286 + M[2][3]*a[0][1]*a[1][2]
287 - M[2][3]*a[1][1]*a[0][2]
288 - M[1][3]*a[0][1]*a[2][2]
289 - M[0][3]*a[2][1]*a[1][2])/det;
290 v[1] = (a[0][0]*M[1][3]*a[2][2]
291 + a[1][0]*M[2][3]*a[0][2]
292 + M[0][3]*a[1][2]*a[2][0]
293 - a[2][0]*M[1][3]*a[0][2]
294 - a[1][0]*M[0][3]*a[2][2]
295 - a[0][0]*M[2][3]*a[1][2])/det;
296 v[2] = (a[0][0]*a[1][1]*M[2][3]
297 + a[1][0]*a[2][1]*M[0][3]
298 + a[0][1]*M[1][3]*a[2][0]
299 - a[2][0]*a[1][1]*M[0][3]
300 - a[1][0]*a[0][1]*M[2][3]
301 - a[0][0]*a[2][1]*M[1][3])/det;
static vpColVector inverse(const vpHomogeneousMatrix &M)
The class provides a data structure for the homogeneous matrices as well as a set of operations on th...
vpThetaUVector buildFrom(const vpHomogeneousMatrix &M)
static double sinc(double x)
The vpRotationMatrix considers the particular case of a rotation matrix.
void insert(const vpRotationMatrix &R)
static double mcosc(double cosx, double x)
vpRotationMatrix buildFrom(const vpHomogeneousMatrix &M)
Build a rotation matrix from an homogeneous matrix.
void extract(vpRotationMatrix &R) const
Class that provides a data structure for the column vectors as well as a set of operations on these v...
static vpHomogeneousMatrix direct(const vpColVector &v)
Class that consider the case of a translation vector.
Class that consider the case of the parameterization for the rotation.
static double msinc(double sinx, double x)