47 #include <visp/vpConfig.h>    48 #include <visp/vpMath.h>    50 #if VISP_VERSION_INT <= (2<<16 | 6<<8 | 1)    65                                        const double z,
const double w) 
    88   for(
unsigned int i=0;i<
size();i++) (*
this)[i]=q.
r[i];   
    99                              const double z,
const double w) 
   146                             w() * rq.
y() + 
y() * rq.
w() + 
z() * rq.
x() - 
x() * rq.
z(),
   147                             w() * rq.
z() + 
z() * rq.
w() + 
x() * rq.
y() - 
y() * rq.
x(),
   148                             w() * rq.
w() - 
x() * rq.
x() - 
y() * rq.
y() - 
z() * rq.
z());
   154   for(
unsigned int i=0;i<
size();i++) (*
this)[i]=q.
r[i];
   165   double s,c,theta,sinc;
   166   double axis_x,axis_y,axis_z;
   168   s = (R[1][0]-R[0][1])*(R[1][0]-R[0][1])
   169       + (R[2][0]-R[0][2])*(R[2][0]-R[0][2])
   170       + (R[2][1]-R[1][2])*(R[2][1]-R[1][2]);
   172   c = (R[0][0]+R[1][1]+R[2][2]-1.0)/2.0;
   175   if ((s > 
minimum) || (c > 0.0)) {   
   176     sinc = vpMath::sinc(s,theta);
   178     axis_x = (R[2][1]-R[1][2])/(2*sinc);
   179     axis_y = (R[0][2]-R[2][0])/(2*sinc);
   180     axis_z = (R[1][0]-R[0][1])/(2*sinc);
   182     axis_x = theta*(sqrt((R[0][0]-c)/(1-c)));
   183     if ((R[2][1]-R[1][2]) < 0) axis_x = -axis_x;
   184     axis_y = theta*(sqrt((R[1][1]-c)/(1-c)));
   185     if ((R[0][2]-R[2][0]) < 0) axis_y = -axis_y;
   186     axis_z = theta*(sqrt((R[2][2]-c)/(1-c)));
   187     if ((R[1][0]-R[0][1]) < 0) axis_z = -axis_z;
   191   double norm = sqrt(axis_x*axis_x+axis_y*axis_y+axis_z*axis_z);        
   192   if(fabs(norm)<
minimum) norm = 1.;
   193   double sinTheta_2 = sin(theta);
   194   set((axis_x * sinTheta_2)/norm,
   195       (axis_y * sinTheta_2)/norm,
   196       (axis_z * sinTheta_2)/norm,
 void set(const double x, const double y, const double z, const double w)
static const double minimum
vpQuaternionVector operator-()
Negate operator. Returns a quaternion defined by (-x,-y,-z-,-w). 
double z() const
returns z-component of the quaternion 
vpQuaternionVector operator*(const double l)
Multiplication by scalar. Returns a quaternion defined by (lx,ly,lz,lw). 
Class that consider the case of a quaternion and basic operations on it. 
Defines a quaternion and its basic operations. 
double y() const
returns y-component of the quaternion 
void buildFrom(const vpRotationMatrix &R)
double x() const
returns x-component of the quaternion 
vpQuaternionVector operator+(vpQuaternionVector &q)
double w() const
returns w-component of the quaternion 
vpQuaternionVector & operator=(vpQuaternionVector &q)
Copy operator. Allow operation such as Q = q.