ViSP  2.10.0

#include <vpThetaUVector.h>

+ Inheritance diagram for vpThetaUVector:

Public Member Functions

 vpThetaUVector ()
 
 vpThetaUVector (const vpThetaUVector &tu)
 
 vpThetaUVector (const vpHomogeneousMatrix &M)
 
 vpThetaUVector (const vpPoseVector &p)
 
 vpThetaUVector (const vpRotationMatrix &R)
 
 vpThetaUVector (const vpRzyxVector &rzyx)
 
 vpThetaUVector (const vpRzyzVector &rzyz)
 
 vpThetaUVector (const vpRxyzVector &rxyz)
 
 vpThetaUVector (const double tux, const double tuy, const double tuz)
 
vpThetaUVector buildFrom (const vpHomogeneousMatrix &M)
 
vpThetaUVector buildFrom (const vpPoseVector &p)
 
vpThetaUVector buildFrom (const vpRotationMatrix &R)
 
vpThetaUVector buildFrom (const vpRzyxVector &rzyx)
 
vpThetaUVector buildFrom (const vpRzyzVector &zyz)
 
vpThetaUVector buildFrom (const vpRxyzVector &xyz)
 
vpThetaUVectoroperator= (double x)
 
void extract (double &theta, vpColVector &u) const
 
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

Class that consider the case of the $\theta {\bf u}$ parameterization for the rotation.

The $\theta {\bf u}$ representation is one of the minimal representation of a rotation matrix, where ${\bf u} = (u_{x} \; u_{y} \; u_{z})^{\top}$ is a unit vector representing the rotation axis and $\theta$ is the rotation angle.

From the $\theta {\bf u}$ representation it is possible to build the rotation matrix ${\bf R}$ using the Rodrigues formula:

\[ {\bf R} = {\bf I}_{3} + (1 - \cos{ \theta}) \; {\bf u u}^{\top} + \sin{ \theta} \; [{\bf u}]_{\times} \]

with ${\bf I}_{3}$ the identity matrix of dimension $3\times3$ and $[{\bf u}]_{\times}$ the skew matrix:

\[ [{\bf u}]_{\times} = \left( \begin{array}{ccc} 0 & -u_{z} & u_{y} \\ u_{z} & 0 & -u_{x} \\ -u_{y} & u_{x} & 0 \end{array} \right) \]

From the implementation point of view, it is nothing more than an array of three floats.

The code below shows first how to initialize a $\theta {\bf u}$ vector, than how to contruct a rotation matrix from a vpThetaUVector and finaly how to extract the theta U angles from the build rotation matrix.

#include <iostream>
#include <visp/vpMath.h>
#include <visp/vpRotationMatrix.h>
#include <visp/vpThetaUVector.h>
int main()
{
// Initialise the theta U rotation vector
tu[0] = vpMath::rad( 45.f);
tu[1] = vpMath::rad(-30.f);
tu[2] = vpMath::rad( 90.f);
// Construct a rotation matrix from the theta U angles
// Extract the theta U angles from a rotation matrix
tu.buildFrom(R);
// Print the extracted theta U angles. Values are the same than the
// one used for initialization
std::cout << tu;
// Since the rotation vector is 3 values column vector, the
// transpose operation produce a row vector.
vpRowVector tu_t = tu.t();
// Print the transpose row vector
std::cout << tu_t << std::endl;
}
Examples:
calibrateTsai.cpp, exponentialMap.cpp, servoSimu3D_cdMc_CamVelocityWithoutVpServo.cpp, servoSimu3D_cMcd_CamVelocityWithoutVpServo.cpp, testDisplacement.cpp, testFeature.cpp, and tutorial-homography-from-points.cpp.

Definition at line 140 of file vpThetaUVector.h.

Constructor & Destructor Documentation

vpThetaUVector::vpThetaUVector ( )
inline

Default constructor that initialize all the angles to zero.

Definition at line 152 of file vpThetaUVector.h.

vpThetaUVector::vpThetaUVector ( const vpThetaUVector tu)
inline

Copy constructor.

Definition at line 154 of file vpThetaUVector.h.

vpThetaUVector::vpThetaUVector ( const vpHomogeneousMatrix M)

Initialize a $\theta {\bf u}$ vector from an homogeneous matrix.

Definition at line 60 of file vpThetaUVector.cpp.

References buildFrom().

vpThetaUVector::vpThetaUVector ( const vpPoseVector p)

Initialize a $\theta {\bf u}$ vector from a pose vector.

Definition at line 67 of file vpThetaUVector.cpp.

References buildFrom().

vpThetaUVector::vpThetaUVector ( const vpRotationMatrix R)

Initialize a $\theta {\bf u}$ vector from a rotation matrix.

Definition at line 74 of file vpThetaUVector.cpp.

References buildFrom().

vpThetaUVector::vpThetaUVector ( const vpRzyxVector rzyx)

Initialize a $\theta {\bf u}$ vector from an Euler z-y-x representation vector.

Definition at line 83 of file vpThetaUVector.cpp.

References buildFrom().

vpThetaUVector::vpThetaUVector ( const vpRzyzVector rzyz)

Initialize a $\theta {\bf u}$ vector from an Euler z-y-z representation vector.

Definition at line 91 of file vpThetaUVector.cpp.

References buildFrom().

vpThetaUVector::vpThetaUVector ( const vpRxyzVector rxyz)

Initialize a $\theta {\bf u}$ vector from an Euler x-y-z representation vector.

Definition at line 99 of file vpThetaUVector.cpp.

References buildFrom().

vpThetaUVector::vpThetaUVector ( const double  tux,
const double  tuy,
const double  tuz 
)
inline

Build a $\theta {\bf u}$ vector from 3 angles in radian.

Definition at line 172 of file vpThetaUVector.h.

Member Function Documentation

vpThetaUVector vpThetaUVector::buildFrom ( const vpPoseVector p)

Converts a pose vector into a $\theta {\bf u}$ vector.

Definition at line 121 of file vpThetaUVector.cpp.

References vpRotationVector::r.

vpThetaUVector vpThetaUVector::buildFrom ( const vpRotationMatrix R)

Converts a rotation matrix into a $\theta {\bf u}$ vector.

Definition at line 133 of file vpThetaUVector.cpp.

References vpRotationVector::r, and vpMath::sinc().

vpThetaUVector vpThetaUVector::buildFrom ( const vpRzyxVector rzyx)

Build a $\theta {\bf u}$ vector from an Euler z-y-x representation vector.

Definition at line 238 of file vpThetaUVector.cpp.

References buildFrom().

vpThetaUVector vpThetaUVector::buildFrom ( const vpRzyzVector rzyz)

Build a $\theta {\bf u}$ vector from an Euler z-y-z representation vector.

Definition at line 250 of file vpThetaUVector.cpp.

References buildFrom().

vpThetaUVector vpThetaUVector::buildFrom ( const vpRxyzVector rxyz)

Build a $\theta {\bf u}$ vector from an Euler x-y-z representation vector.

Definition at line 262 of file vpThetaUVector.cpp.

References buildFrom().

void vpThetaUVector::extract ( double &  theta,
vpColVector u 
) const

Extract the rotation angle $ \theta $ and the unit vector $\bf u $ from the $ \theta {\bf u} $ representation.

Parameters
theta: Rotation angle $ \theta $.
u: Unit vector ${\bf u} = (u_{x},u_{y},u_{z})^{\top} $ representing the rotation axis.

Definition at line 311 of file vpThetaUVector.cpp.

References vpRotationVector::r, and vpColVector::resize().

Referenced by vpQuaternionVector::buildFrom().

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

Definition at line 117 of file vpRotationVector.cpp.

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

vpThetaUVector & vpThetaUVector::operator= ( double  v)

Initialize each element of the $\theta {\bf u}$ vector to the same angle value v.

Parameters
v: Angle value to set for each element of the $\theta {\bf u}$ vector.
#include <visp/vpMath.h>
#include <visp/vpThetaUVector.h>
int main()
{
// Initialise the theta U rotation vector
tu = vpMath::rad( 45.f); // All the 3 angles are set to 45 degrees
}

Definition at line 291 of file vpThetaUVector.cpp.

References vpRotationVector::r.

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.

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.

Member Data Documentation

unsigned int vpRotationVector::_size
protectedinherited