45 #include <visp/vpRxyzVector.h>
86 double COEF_MIN_ROT = 1e-6;
89 if ((fabs(R[1][2]) < COEF_MIN_ROT) && (fabs(R[2][2]) < COEF_MIN_ROT)) phi = 0 ;
90 else phi = atan2(-R[1][2], R[2][2]) ;
92 double si = sin(phi) ;
93 double co = cos(phi) ;
94 double theta = atan2(R[0][2], -si*R[1][2] + co*R[2][2]) ;
95 double psi = atan2(co*R[1][0] + si*R[2][0], co*R[1][1] + si*R[2][1]);
109 if (v1 > 1.0 ) v1 = 1.0;
110 if (v1 < -1.0 ) v1 = -1.0;
112 if ( fabs(fabs(r2[1]) - M_PI_2) < 0.00001)
115 r2[2] = atan2(R[1][0],R[1][1]);
119 r2[0] = atan2(-R[1][2],R[2][2]);
120 r2[2] = atan2(-R[0][1],R[0][0]);
127 if (fabs(
r[i] - r2[i]) > 1e-5) pb = 1;
131 printf(
"vpRxyzVector::buildFrom(const vpRotationMatrix& R)\n");
132 printf(
" r : %lf %lf %lf\n",
r[0],
r[1],
r[2]);
133 printf(
" r2 : %lf %lf %lf\n",r2[0],r2[1],r2[2]);
134 printf(
" r - r2 : %lf %lf %lf\n",
r[0]-r2[0],
r[1]-r2[1],
r[2]-r2[2]);
The vpRotationMatrix considers the particular case of a rotation matrix.
vpRotationMatrix buildFrom(const vpHomogeneousMatrix &M)
Build a rotation matrix from an homogeneous matrix.
Class that consider the case of the Euler angle using the x-y-z convention, where are respectively ...
void buildFrom(const double phi, const double theta, const double psi)
Class that consider the case of the parameterization for the rotation.