ViSP  2.10.0

#include <vpQuaternionVector.h>

+ Inheritance diagram for vpQuaternionVector:

Public Member Functions

 vpQuaternionVector ()
 
 vpQuaternionVector (const vpQuaternionVector &q)
 
 vpQuaternionVector (const double x, const double y, const double z, const double w)
 
 vpQuaternionVector (const vpRotationMatrix &R)
 
void buildFrom (const vpRotationMatrix &R)
 
void set (const double x, const double y, const double z, const double w)
 
double x () const
 
double y () const
 
double z () const
 
double w () const
 
vpQuaternionVector operator+ (vpQuaternionVector &q)
 
vpQuaternionVector operator- (vpQuaternionVector &q)
 
vpQuaternionVector operator- ()
 
vpQuaternionVector operator* (const double l)
 
vpQuaternionVector operator* (vpQuaternionVector &rq)
 
double & operator[] (unsigned int n)
 
const double & operator[] (unsigned int n) const
 
unsigned int size () const
 
vpRowVector t () const
 

Protected Member Functions

void init (const unsigned int size)
 

Protected Attributes

double * r
 
unsigned int _size
 

Detailed Description

Defines a quaternion and its basic operations.

A quaternion is defined by four values: ${\bf q} = (x, y, z, w)$.

This class allows to compute a quaternion from a rotation matrix using either vpQuaternionVector(const vpRotationMatrix &) constructor or buildFrom() method.

It also defines common operations on a quaternion such as:

  • multiplication (scalar and quaternion)
  • addition
  • substraction.

Definition at line 79 of file vpQuaternionVector.h.

Constructor & Destructor Documentation

vpQuaternionVector::vpQuaternionVector ( )
inline

Default constructor that initialize all the angles to zero.

Definition at line 86 of file vpQuaternionVector.h.

Referenced by operator*(), operator+(), and operator-().

vpQuaternionVector::vpQuaternionVector ( const vpQuaternionVector q)
inline

Copy constructor.

Definition at line 88 of file vpQuaternionVector.h.

vpQuaternionVector::vpQuaternionVector ( const double  x,
const double  y,
const double  z,
const double  w 
)

Constructor from doubles.

Definition at line 59 of file vpQuaternionVector.cpp.

vpQuaternionVector::vpQuaternionVector ( const vpRotationMatrix R)

Constructs a quaternion from a rotation matrix.

Parameters
R: Matrix containing a rotation.

Definition at line 71 of file vpQuaternionVector.cpp.

References buildFrom().

Member Function Documentation

void vpQuaternionVector::buildFrom ( const vpRotationMatrix R)

Constructs a quaternion from a rotation matrix.

Parameters
R: Rotation matrix.

Definition at line 142 of file vpQuaternionVector.cpp.

References vpThetaUVector::extract(), and set().

Referenced by vpHomogeneousMatrix::extract(), and vpQuaternionVector().

void vpRotationVector::init ( const unsigned int  size)
protectedinherited

Definition at line 117 of file vpRotationVector.cpp.

References vpRotationVector::_size, and vpRotationVector::r.

vpQuaternionVector vpQuaternionVector::operator* ( const double  l)

Multiplication by scalar. Returns a quaternion defined by (lx,ly,lz,lw).

Definition at line 124 of file vpQuaternionVector.cpp.

References vpQuaternionVector(), w(), x(), y(), and z().

vpQuaternionVector vpQuaternionVector::operator* ( vpQuaternionVector rq)

Multiply two quaternions.

Definition at line 130 of file vpQuaternionVector.cpp.

References vpQuaternionVector(), w(), x(), y(), and z().

vpQuaternionVector vpQuaternionVector::operator+ ( vpQuaternionVector q)

Quaternion addition.

Adds two quaternions. Addition is component-wise.

Parameters
q: quaternion to add.

Definition at line 101 of file vpQuaternionVector.cpp.

References vpQuaternionVector(), w(), x(), y(), and z().

vpQuaternionVector vpQuaternionVector::operator- ( vpQuaternionVector q)

Quaternion substraction.

Substracts a quaternion from another. Substraction is component-wise.

Parameters
q: quaternion to substract.

Definition at line 112 of file vpQuaternionVector.cpp.

References vpQuaternionVector(), w(), x(), y(), and z().

vpQuaternionVector vpQuaternionVector::operator- ( void  )

Negate operator. Returns a quaternion defined by (-x,-y,-z-,-w).

Definition at line 118 of file vpQuaternionVector.cpp.

References vpQuaternionVector(), w(), x(), y(), and z().

double& vpRotationVector::operator[] ( unsigned int  n)
inlineinherited

Operator that allows to set the value of an element of the rotation vector: r[i] = value

Definition at line 130 of file vpRotationVector.h.

const double& vpRotationVector::operator[] ( unsigned int  n) const
inlineinherited

Operator that allows to get the value of an element of the rotation vector: value = r[i]

Definition at line 135 of file vpRotationVector.h.

void vpQuaternionVector::set ( const double  x_,
const double  y_,
const double  z_,
const double  w_ 
)

Manually change values of a quaternion.

Parameters
x_: x quaternion parameter.
y_: y quaternion parameter.
z_: z quaternion parameter.
w_: w quaternion parameter.

Definition at line 84 of file vpQuaternionVector.cpp.

References vpRotationVector::r.

Referenced by buildFrom().

unsigned int vpRotationVector::size ( ) const
inherited

Returns the size of the rotation vector

Size of the rotation vector: number of double values describing the rotation. Common sizes are 4 for a quaternion and 3 for angle-based rotation vectors.

Definition at line 71 of file vpRotationVector.cpp.

References vpRotationVector::_size.

Referenced by vpRotationVector::operator=().

vpRowVector vpRotationVector::t ( ) const
inherited

Return the transpose of the rotation vector.

Examples:
testViper850.cpp.

Definition at line 57 of file vpRotationVector.cpp.

References vpRotationVector::_size, and vpRotationVector::r.

double vpQuaternionVector::w ( ) const
inline

Returns w-component of the quaternion.

Definition at line 103 of file vpQuaternionVector.h.

Referenced by vpRotationMatrix::buildFrom(), operator*(), operator+(), and operator-().

double vpQuaternionVector::x ( ) const
inline

Returns x-component of the quaternion.

Definition at line 97 of file vpQuaternionVector.h.

Referenced by vpRotationMatrix::buildFrom(), operator*(), operator+(), and operator-().

double vpQuaternionVector::y ( ) const
inline

Returns y-component of the quaternion.

Definition at line 99 of file vpQuaternionVector.h.

Referenced by vpRotationMatrix::buildFrom(), operator*(), operator+(), and operator-().

double vpQuaternionVector::z ( ) const
inline

Returns z-component of the quaternion.

Definition at line 101 of file vpQuaternionVector.h.

Referenced by vpRotationMatrix::buildFrom(), operator*(), operator+(), and operator-().

Member Data Documentation

unsigned int vpRotationVector::_size
protectedinherited