39 #include <visp3/core/vpQuaternionVector.h>
40 #include <visp3/core/vpMath.h>
47 const double vpQuaternionVector::minimum = 0.0001;
66 const double z_,
const double w_)
104 const double qz,
const double qw)
122 const double qz,
const double qw)
180 w() * rq.
y() +
y() * rq.
w() +
z() * rq.
x() -
x() * rq.
z(),
181 w() * rq.
z() +
z() * rq.
w() +
x() * rq.
y() -
y() * rq.
x(),
182 w() * rq.
w() -
x() * rq.
x() -
y() * rq.
y() -
z() * rq.
z());
188 if(
vpMath::nul(l, std::numeric_limits<double>::epsilon())) {
210 double sinTheta_2 = sin(theta);
211 set( u[0] * sinTheta_2, u[1] * sinTheta_2, u[2] * sinTheta_2, cos(theta) );
232 double mag_square =
w()*
w() +
x()*
x() +
y()*
y() +
z()*
z();
233 if(!
vpMath::nul(mag_square, std::numeric_limits<double>::epsilon())) {
236 std::cerr <<
"The current quaternion is null ! The inverse cannot be computed !" << std::endl;
248 return sqrt(
w()*
w() +
x()*
x() +
y()*
y() +
z()*
z() );
256 if(!
vpMath::nul(mag, std::numeric_limits<double>::epsilon())) {
257 set(
x()/mag,
y()/mag,
z()/mag,
w()/mag );
vpQuaternionVector operator+(const vpQuaternionVector &q) const
vpQuaternionVector operator*(const double l) const
Multiplication by scalar. Returns a quaternion defined by (lx,ly,lz,lw).
Implementation of a generic rotation vector.
void set(const double x, const double y, const double z, const double w)
vpQuaternionVector operator/(const double l) const
Division by scalar. Returns a quaternion defined by (x/l,y/l,z/l,w/l).
vpQuaternionVector inverse() const
error that can be emited by ViSP classes.
double y() const
Returns y-component of the quaternion.
vpQuaternionVector operator-() const
Negate operator. Returns a quaternion defined by (-x,-y,-z-,-w).
double * data
Address of the first element of the data array.
vpQuaternionVector buildFrom(const double qx, const double qy, const double qz, const double qw)
vpQuaternionVector conjugate() const
Implementation of a rotation matrix and operations on such kind of matrices.
double w() const
Returns w-component of the quaternion.
static bool nul(double x, double s=0.001)
void extract(double &theta, vpColVector &u) const
double z() const
Returns z-component of the quaternion.
double x() const
Returns x-component of the quaternion.
Implementation of a rotation vector as quaternion angle minimal representation.
Implementation of column vector and the associated operations.
Implementation of a rotation vector as axis-angle minimal representation.