39 #include <visp3/core/vpExponentialMap.h>
84 double theta,si,co,sinc,mcosc,msinc;
96 theta = sqrt(u[0]*u[0] + u[1]*u[1] + u[2]*u[2]);
103 dt[0] = v_dt[0]*(sinc + u[0]*u[0]*msinc)
104 + v_dt[1]*(u[0]*u[1]*msinc - u[2]*mcosc)
105 + v_dt[2]*(u[0]*u[2]*msinc + u[1]*mcosc);
107 dt[1] = v_dt[0]*(u[0]*u[1]*msinc + u[2]*mcosc)
108 + v_dt[1]*(sinc + u[1]*u[1]*msinc)
109 + v_dt[2]*(u[1]*u[2]*msinc - u[0]*mcosc);
111 dt[2] = v_dt[0]*(u[0]*u[2]*msinc - u[1]*mcosc)
112 + v_dt[1]*(u[1]*u[2]*msinc + u[0]*mcosc)
113 + v_dt[2]*(sinc + u[2]*u[2]*msinc);
129 s = sqrt(v_dt[3]*v_dt[3] + v_dt[4]*v_dt[4] + v_dt[5]*v_dt[5]);
132 for (i=0;i<3;i++) u[i] = v_dt[3+i]/s;
133 double sinu = sin(s);
134 double cosi = cos(s);
135 double mcosi = 1-cosi;
136 rd[0][0] = cosi + mcosi*u[0]*u[0];
137 rd[0][1] = -sinu*u[2] + mcosi*u[0]*u[1];
138 rd[0][2] = sinu*u[1] + mcosi*u[0]*u[2];
139 rd[1][0] = sinu*u[2] + mcosi*u[1]*u[0];
140 rd[1][1] = cosi + mcosi*u[1]*u[1];
141 rd[1][2] = -sinu*u[0] + mcosi*u[1]*u[2];
142 rd[2][0] = -sinu*u[1] + mcosi*u[2]*u[0];
143 rd[2][1] = sinu*u[0] + mcosi*u[2]*u[1];
144 rd[2][2] = cosi + mcosi*u[2]*u[2];
146 dt[0] = v_dt[0]*(sinu/s + u[0]*u[0]*(1-sinu/s))
147 + v_dt[1]*(u[0]*u[1]*(1-sinu/s)-u[2]*mcosi/s)
148 + v_dt[2]*(u[0]*u[2]*(1-sinu/s)+u[1]*mcosi/s);
150 dt[1] = v_dt[0]*(u[0]*u[1]*(1-sinu/s)+u[2]*mcosi/s)
151 + v_dt[1]*(sinu/s + u[1]*u[1]*(1-sinu/s))
152 + v_dt[2]*(u[1]*u[2]*(1-sinu/s)-u[0]*mcosi/s);
154 dt[2] = v_dt[0]*(u[0]*u[2]*(1-sinu/s)-u[1]*mcosi/s)
155 + v_dt[1]*(u[1]*u[2]*(1-sinu/s)+u[0]*mcosi/s)
156 + v_dt[2]*(sinu/s + u[2]*u[2]*(1-sinu/s));
162 for(j=0;j<3;j++) rd[i][j] = 0.0;
178 if (fabs(Delta[i][j] - Delta_old[i][j]) > 1.e-5) pb = 1;
182 printf(
"pb vpHomogeneousMatrix::expMap\n");
183 std::cout <<
" Delta : " << std::endl << Delta << std::endl;
184 std::cout <<
" Delta_old : " << std::endl << Delta_old << std::endl;
234 double theta,si,co,sinc,mcosc,msinc,det;
241 for (i=0;i<3;i++) v[3+i] = u[i];
243 theta = sqrt(u[0]*u[0] + u[1]*u[1] + u[2]*u[2]);
254 a[0][0] = sinc + u[0]*u[0]*msinc;
255 a[0][1] = u[0]*u[1]*msinc - u[2]*mcosc;
256 a[0][2] = u[0]*u[2]*msinc + u[1]*mcosc;
258 a[1][0] = u[0]*u[1]*msinc + u[2]*mcosc;
259 a[1][1] = sinc + u[1]*u[1]*msinc;
260 a[1][2] = u[1]*u[2]*msinc - u[0]*mcosc;
262 a[2][0] = u[0]*u[2]*msinc - u[1]*mcosc;
263 a[2][1] = u[1]*u[2]*msinc + u[0]*mcosc;
264 a[2][2] = sinc + u[2]*u[2]*msinc;
266 det = a[0][0]*a[1][1]*a[2][2] + a[1][0]*a[2][1]*a[0][2]
267 + a[0][1]*a[1][2]*a[2][0] - a[2][0]*a[1][1]*a[0][2]
268 - a[1][0]*a[0][1]*a[2][2] - a[0][0]*a[2][1]*a[1][2];
270 if (fabs(det) > 1.e-5)
272 v[0] = (M[0][3]*a[1][1]*a[2][2]
273 + M[1][3]*a[2][1]*a[0][2]
274 + M[2][3]*a[0][1]*a[1][2]
275 - M[2][3]*a[1][1]*a[0][2]
276 - M[1][3]*a[0][1]*a[2][2]
277 - M[0][3]*a[2][1]*a[1][2])/det;
278 v[1] = (a[0][0]*M[1][3]*a[2][2]
279 + a[1][0]*M[2][3]*a[0][2]
280 + M[0][3]*a[1][2]*a[2][0]
281 - a[2][0]*M[1][3]*a[0][2]
282 - a[1][0]*M[0][3]*a[2][2]
283 - a[0][0]*M[2][3]*a[1][2])/det;
284 v[2] = (a[0][0]*a[1][1]*M[2][3]
285 + a[1][0]*a[2][1]*M[0][3]
286 + a[0][1]*M[1][3]*a[2][0]
287 - a[2][0]*a[1][1]*M[0][3]
288 - a[1][0]*a[0][1]*M[2][3]
289 - a[0][0]*a[2][1]*M[1][3])/det;
static vpColVector inverse(const vpHomogeneousMatrix &M)
Implementation of an homogeneous matrix and operations on such kind of matrices.
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)
void extract(vpRotationMatrix &R) const
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)