45 #include <visp/vpRxyzVector.h>
61 for (
int i=0; i<3; i++)
107 double COEF_MIN_ROT = 1e-6;
110 if ((fabs(R[1][2]) < COEF_MIN_ROT) && (fabs(R[2][2]) < COEF_MIN_ROT)) phi = 0 ;
111 else phi = atan2(-R[1][2], R[2][2]) ;
113 double si = sin(phi) ;
114 double co = cos(phi) ;
115 double theta = atan2(R[0][2], -si*R[1][2] + co*R[2][2]) ;
116 double psi = atan2(co*R[1][0] + si*R[2][0], co*R[1][1] + si*R[2][1]);
130 if (v1 > 1.0 ) v1 = 1.0;
131 if (v1 < -1.0 ) v1 = -1.0;
133 if ( fabs(fabs(r2[1]) - M_PI_2) < 0.00001)
136 r2[2] = atan2(R[1][0],R[1][1]);
140 r2[0] = atan2(-R[1][2],R[2][2]);
141 r2[2] = atan2(-R[0][1],R[0][0]);
148 if (fabs(
r[i] - r2[i]) > 1e-5) pb = 1;
152 printf(
"vpRxyzVector::buildFrom(const vpRotationMatrix& R)\n");
153 printf(
" r : %lf %lf %lf\n",
r[0],
r[1],
r[2]);
154 printf(
" r2 : %lf %lf %lf\n",r2[0],r2[1],r2[2]);
155 printf(
" r - r2 : %lf %lf %lf\n",
r[0]-r2[0],
r[1]-r2[1],
r[2]-r2[2]);
Class that consider the case of a generic rotation vector (cannot be used as is !) consisting in thre...
vpRxyzVector()
Default constructor. Initialize the angles to zero.
The vpRotationMatrix considers the particular case of a rotation matrix.
vpRotationMatrix buildFrom(const vpThetaUVector &v)
Transform a vector vpThetaUVector into an rotation matrix.
vpRxyzVector & operator=(const vpRxyzVector &m)
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.