Visual Servoing Platform
version 3.0.1
|
#include <visp3/core/vpRotationMatrix.h>
Static Public Member Functions | |
Inherited I/O from vpArray2D with Static Public Member Functions | |
static bool | load (const std::string &filename, vpArray2D< double > &A, const bool binary=false, char *header=NULL) |
static bool | loadYAML (const std::string &filename, vpArray2D< double > &A, char *header=NULL) |
static bool | save (const std::string &filename, const vpArray2D< double > &A, const bool binary=false, const char *header="") |
static bool | saveYAML (const std::string &filename, const vpArray2D< double > &A, const char *header="") |
Public Attributes | |
double * | data |
Protected Attributes | |
unsigned int | rowNum |
unsigned int | colNum |
double ** | rowPtrs |
unsigned int | dsize |
Related Functions | |
(Note that these are not member functions.) | |
enum | vpGEMMmethod |
Implementation of a rotation matrix and operations on such kind of matrices.
The vpRotationMatrix considers the particular case of a rotation matrix.
The vpRotationMatrix class is derived from vpArray2D<double>.
Definition at line 70 of file vpRotationMatrix.h.
vpRotationMatrix::vpRotationMatrix | ( | ) |
Default constructor that initialise a 3-by-3 rotation matrix to identity.
Definition at line 334 of file vpRotationMatrix.cpp.
References eye().
vpRotationMatrix::vpRotationMatrix | ( | const vpRotationMatrix & | M | ) |
Copy contructor that construct a 3-by-3 rotation matrix from another rotation matrix.
Definition at line 343 of file vpRotationMatrix.cpp.
vpRotationMatrix::vpRotationMatrix | ( | const vpHomogeneousMatrix & | M | ) |
Construct a 3-by-3 rotation matrix from an homogeneous matrix.
Definition at line 350 of file vpRotationMatrix.cpp.
References buildFrom().
vpRotationMatrix::vpRotationMatrix | ( | const vpThetaUVector & | tu | ) |
Construct a 3-by-3 rotation matrix from angle representation.
Definition at line 358 of file vpRotationMatrix.cpp.
References buildFrom().
vpRotationMatrix::vpRotationMatrix | ( | const vpPoseVector & | p | ) |
Construct a 3-by-3 rotation matrix from a pose vector.
Definition at line 366 of file vpRotationMatrix.cpp.
References buildFrom().
vpRotationMatrix::vpRotationMatrix | ( | const vpRzyzVector & | euler | ) |
Construct a 3-by-3 rotation matrix from Euler angle representation.
Definition at line 374 of file vpRotationMatrix.cpp.
References buildFrom().
vpRotationMatrix::vpRotationMatrix | ( | const vpRxyzVector & | Rxyz | ) |
Construct a 3-by-3 rotation matrix from Euler angle representation.
Definition at line 382 of file vpRotationMatrix.cpp.
References buildFrom().
vpRotationMatrix::vpRotationMatrix | ( | const vpRzyxVector & | Rzyx | ) |
Construct a 3-by-3 rotation matrix from Euler angle representation.
Definition at line 390 of file vpRotationMatrix.cpp.
References buildFrom().
vpRotationMatrix::vpRotationMatrix | ( | const vpQuaternionVector & | q | ) |
Construct a 3-by-3 rotation matrix from quaternion angle representation.
Definition at line 406 of file vpRotationMatrix.cpp.
References buildFrom().
vpRotationMatrix::vpRotationMatrix | ( | const double | tux, |
const double | tuy, | ||
const double | tuz | ||
) |
Construct a 3-by-3 rotation matrix from angle representation.
Definition at line 398 of file vpRotationMatrix.cpp.
References buildFrom().
|
inlinevirtual |
Destructor.
Definition at line 86 of file vpRotationMatrix.h.
vpRotationMatrix vpRotationMatrix::buildFrom | ( | const vpHomogeneousMatrix & | M | ) |
Build a rotation matrix from an homogeneous matrix.
Definition at line 519 of file vpRotationMatrix.cpp.
Referenced by buildFrom(), vpForceTwistMatrix::buildFrom(), vpVelocityTwistMatrix::buildFrom(), vpRzyzVector::buildFrom(), vpRzyxVector::buildFrom(), vpRxyzVector::buildFrom(), vpExponentialMap::direct(), vpPoseVector::extract(), vpRobotAfma6::setPosition(), and vpRotationMatrix().
vpRotationMatrix vpRotationMatrix::buildFrom | ( | const vpThetaUVector & | v | ) |
Transform a angle representation into a rotation matrix.
The rotation is computed using :
Definition at line 488 of file vpRotationMatrix.cpp.
References vpMath::mcosc(), and vpMath::sinc().
vpRotationMatrix vpRotationMatrix::buildFrom | ( | const vpPoseVector & | p | ) |
Build a rotation matrix from a pose vector.
Definition at line 534 of file vpRotationMatrix.cpp.
References buildFrom().
vpRotationMatrix vpRotationMatrix::buildFrom | ( | const vpRzyzVector & | v | ) |
Transform a vector representing the Euler angle into a rotation matrix. Rzyz( ) = Rot( ) Rot( ) Rot( )
Definition at line 547 of file vpRotationMatrix.cpp.
vpRotationMatrix vpRotationMatrix::buildFrom | ( | const vpRxyzVector & | v | ) |
Transform a vector representing the Rxyz angle into a rotation matrix. Rxyz( ) = Rot( ) Rot( ) Rot( )
Definition at line 581 of file vpRotationMatrix.cpp.
vpRotationMatrix vpRotationMatrix::buildFrom | ( | const vpRzyxVector & | v | ) |
Transform a vector representing the Rzyx angle into a rotation matrix. Rxyz( ) = Rot( ) Rot( )Rot( )
Definition at line 614 of file vpRotationMatrix.cpp.
vpRotationMatrix vpRotationMatrix::buildFrom | ( | const vpQuaternionVector & | q | ) |
Construct a 3-by-3 rotation matrix from a quaternion representation.
Definition at line 660 of file vpRotationMatrix.cpp.
References vpQuaternionVector::w(), vpQuaternionVector::x(), vpQuaternionVector::y(), and vpQuaternionVector::z().
vpRotationMatrix vpRotationMatrix::buildFrom | ( | const double | tux, |
const double | tuy, | ||
const double | tuz | ||
) |
Construct a 3-by-3 rotation matrix from angle representation.
Definition at line 646 of file vpRotationMatrix.cpp.
References buildFrom().
void vpRotationMatrix::eye | ( | ) |
Initialize the rotation matrix as identity.
Definition at line 66 of file vpRotationMatrix.cpp.
Referenced by vpCalibration::calibrationTsai(), setIdentity(), and vpRotationMatrix().
vpColVector vpRotationMatrix::getCol | ( | const unsigned int | j | ) | const |
Extract a column vector from a rotation matrix.
j | : Index of the column to extract. If j=0, the first column is extracted. |
The following example shows how to use this function:
It produces the following output:
Definition at line 734 of file vpRotationMatrix.cpp.
References vpException::dimensionError, vpArray2D< double >::getCols(), and vpArray2D< double >::getRows().
|
inlineinherited |
Return the number of columns of the 2D array.
Definition at line 154 of file vpArray2D.h.
References vpArray2D< Type >::colNum.
Referenced by vpRowVector::csvPrint(), vpMatrix::csvPrint(), getCol(), vpHomogeneousMatrix::getCol(), vpMatrix::getCol(), vpMatrix::getRow(), vpMatrix::inverseByQRLapack(), vpMatrix::kernel(), vpRowVector::maplePrint(), vpMatrix::maplePrint(), vpRowVector::operator*(), vpRowVector::operator+(), vpRowVector::operator+=(), vpRowVector::operator-(), vpRowVector::operator-=(), vpForceTwistMatrix::print(), vpVelocityTwistMatrix::print(), vpRowVector::print(), vpMatrix::print(), vpMatrix::pseudoInverse(), vpMatrix::row(), and vpMatrix::svd().
|
inherited |
Return the array max value.
|
inherited |
Return the array min value.
|
inlineinherited |
Return the number of rows of the 2D array.
Definition at line 152 of file vpArray2D.h.
References vpArray2D< Type >::rowNum.
Referenced by vpMatrix::column(), vpColVector::cppPrint(), vpMatrix::cppPrint(), vpColVector::csvPrint(), vpMatrix::csvPrint(), getCol(), vpHomogeneousMatrix::getCol(), vpMatrix::getCol(), vpMatrix::getRow(), vpMatrix::inverseByCholeskyLapack(), vpMatrix::inverseByQRLapack(), vpMatrix::kernel(), vpColVector::maplePrint(), vpMatrix::maplePrint(), vpColVector::matlabPrint(), vpMatrix::matlabPrint(), vpColVector::operator+(), vpColVector::operator+=(), vpColVector::operator-(), vpColVector::operator-=(), vpForceTwistMatrix::print(), vpVelocityTwistMatrix::print(), vpPoseVector::print(), vpColVector::print(), vpMatrix::print(), and vpMatrix::pseudoInverse().
vpThetaUVector vpRotationMatrix::getThetaUVector | ( | ) |
Return the vector that corresponds to the rotation matrix.
Definition at line 699 of file vpRotationMatrix.cpp.
References vpThetaUVector::buildFrom().
|
inline |
Definition at line 150 of file vpRotationMatrix.h.
vpRotationMatrix vpRotationMatrix::inverse | ( | ) | const |
Return the rotation matrix inverse which is also the transpose of the rotation matrix.
Definition at line 434 of file vpRotationMatrix.cpp.
References t().
Referenced by vpViper::get_eJe(), and inverse().
void vpRotationMatrix::inverse | ( | vpRotationMatrix & | R | ) | const |
Inverse the rotation matrix.
R | (output): Inverted rotation matrix. |
Definition at line 459 of file vpRotationMatrix.cpp.
References inverse().
bool vpRotationMatrix::isARotationMatrix | ( | ) | const |
Test if the rotation matrix is really a rotation matrix.
Definition at line 294 of file vpRotationMatrix.cpp.
References vpMath::sqr(), and t().
Referenced by vpHomogeneousMatrix::isAnHomogeneousMatrix(), and operator=().
|
inlinestaticinherited |
Load a matrix from a file.
filename | : Absolute file name. |
A | : Array to be loaded |
binary | : If true the matrix is loaded from a binary file, else from a text file. |
header | : Header of the file is loaded in this parameter. |
Definition at line 308 of file vpArray2D.h.
References vpException::badValue, and vpArray2D< Type >::resize().
|
inlinestaticinherited |
Load an array from a YAML-formatted file.
filename | : absolute file name. |
A | : array to be loaded from the file. |
header | : header of the file is loaded in this parameter. |
Definition at line 417 of file vpArray2D.h.
References vpArray2D< Type >::resize().
vpTranslationVector vpRotationMatrix::operator* | ( | const vpTranslationVector & | tv | ) | const |
Multiply a rotation matrix by a translation vector and return the resulting translation vector.
Definition at line 244 of file vpRotationMatrix.cpp.
References vpArray2D< double >::rowPtrs.
vpRotationMatrix vpRotationMatrix::operator* | ( | const vpRotationMatrix & | R | ) | const |
Compute the product between two rotation matrices.
Definition at line 141 of file vpRotationMatrix.cpp.
References vpArray2D< double >::rowPtrs, and vpArray2D< Type >::rowPtrs.
Operator that allows to multiply a rotation matrix by a 3-by-3 matrix. Allows for example to multiply a rotation matrix by a skew matrix.
vpException::dimensionError | : If M is not a 3-by-3 dimension matrix. |
Definition at line 170 of file vpRotationMatrix.cpp.
References vpException::dimensionError, vpArray2D< Type >::getCols(), and vpArray2D< Type >::getRows().
vpColVector vpRotationMatrix::operator* | ( | const vpColVector & | v | ) | const |
Operator that allows to multiply a rotation matrix by a 3 dimension column vector.
v | : Three dimension column vector. |
vpException::dimensionError | If the column vector v is not a 3 dimension vector. |
The code below shows how to use this operator.
Definition at line 220 of file vpRotationMatrix.cpp.
References vpArray2D< double >::colNum, vpException::dimensionError, vpArray2D< Type >::getRows(), vpArray2D< double >::rowNum, and vpArray2D< double >::rowPtrs.
vpRotationMatrix vpRotationMatrix::operator* | ( | const double | x | ) | const |
Operator that allows to multiply all the elements of a rotation matrix by a scalar.
Definition at line 264 of file vpRotationMatrix.cpp.
References vpArray2D< double >::colNum, vpArray2D< double >::rowNum, and vpArray2D< double >::rowPtrs.
vpRotationMatrix & vpRotationMatrix::operator*= | ( | const double | x | ) |
Operator that allows to multiply all the elements of a rotation matrix by a scalar.
Definition at line 279 of file vpRotationMatrix.cpp.
References vpArray2D< double >::colNum, vpArray2D< double >::rowNum, and vpArray2D< double >::rowPtrs.
vpRotationMatrix & vpRotationMatrix::operator= | ( | const vpRotationMatrix & | R | ) |
Set the current rotation matrix from a rotation matrix R.
R | : Rotation matrix. vpRotationMatrix R2 = R1;
|
Definition at line 88 of file vpRotationMatrix.cpp.
References vpArray2D< double >::rowPtrs, and vpArray2D< Type >::rowPtrs.
vpRotationMatrix & vpRotationMatrix::operator= | ( | const vpMatrix & | M | ) |
Converts a 3-by-3 matrix into a rotation matrix.
M | : Input matrix. |
vpException::fatalError | If the input matrix is not a rotation matrix. |
Definition at line 115 of file vpRotationMatrix.cpp.
References vpException::dimensionError, vpException::fatalError, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), and isARotationMatrix().
|
inlineinherited |
Set element using A[i][j] = x.
Definition at line 259 of file vpArray2D.h.
References vpArray2D< Type >::rowPtrs.
|
inlineinherited |
Get element using x = A[i][j].
Definition at line 261 of file vpArray2D.h.
References vpArray2D< Type >::rowPtrs.
void vpRotationMatrix::printVector | ( | ) |
Print to std::cout the rotation matrix as a angle representation vector.
Definition at line 468 of file vpRotationMatrix.cpp.
|
inline |
This function is not applicable to a rotation matrix that is always a 3-by-3 matrix.
vpException::fatalError | When this function is called. |
Definition at line 129 of file vpRotationMatrix.h.
References vpException::fatalError.
|
inlinestaticinherited |
Save a matrix to a file.
filename | : Absolute file name. |
A | : Array to be saved. |
binary | : If true the matrix is saved in a binary file, else a text file. |
header | : Optional line that will be saved at the beginning of the file. |
Warning : If you save the matrix as in a text file the precision is less than if you save it in a binary file.
Definition at line 499 of file vpArray2D.h.
References vpArray2D< Type >::getCols(), and vpArray2D< Type >::getRows().
|
inlinestaticinherited |
Save an array in a YAML-formatted file.
filename | : absolute file name. |
A | : array to be saved in the file. |
header | : optional lines that will be saved at the beginning of the file. Should be YAML-formatted and will adapt to the indentation if any. |
Here is an example of outputs.
Content of matrix.yml:
Content of matrixIndent.yml:
Definition at line 588 of file vpArray2D.h.
References vpArray2D< Type >::getCols(), and vpArray2D< Type >::getRows().
void vpRotationMatrix::setIdentity | ( | ) |
Initializes the rotation matrix as identity.
Definition at line 756 of file vpRotationMatrix.cpp.
References eye().
|
inlineinherited |
Return the number of elements of the 2D array.
Definition at line 156 of file vpArray2D.h.
References vpArray2D< Type >::colNum, and vpArray2D< Type >::rowNum.
Referenced by vpRowVector::insert(), vpColVector::insert(), and vpColVector::operator*().
vpRotationMatrix vpRotationMatrix::t | ( | ) | const |
Return the rotation matrix transpose which is also the inverse of the rotation matrix.
Definition at line 417 of file vpRotationMatrix.cpp.
Referenced by vpCalibration::calibrationTsai(), vpVelocityTwistMatrix::extract(), inverse(), vpHomogeneousMatrix::inverse(), vpVelocityTwistMatrix::inverse(), isARotationMatrix(), and vpSimulatorAfma6::setPosition().
|
related |
Enumeration of the operations applied on matrices in vpGEMM() function.
Operations are :
|
protectedinherited |
Number of columns in the array.
Definition at line 76 of file vpArray2D.h.
Referenced by vpMatrix::AAt(), vpMatrix::AtA(), vpColVector::clear(), vpMatrix::diag(), vpMatrix::eigenValues(), vpMatrix::expm(), vpMatrix::eye(), vpMatrix::infinityNorm(), vpSubColVector::init(), vpSubRowVector::init(), vpSubMatrix::init(), vpRowVector::insert(), vpMatrix::insert(), vpMatrix::inverseByCholesky(), vpMatrix::inverseByLU(), vpMatrix::inverseByQR(), operator*(), vpRowVector::operator*(), vpMatrix::operator*(), operator*=(), vpRowVector::operator*=(), vpMatrix::operator*=(), vpRowVector::operator+(), vpRowVector::operator+=(), vpMatrix::operator+=(), vpRowVector::operator-(), vpRowVector::operator-=(), vpMatrix::operator-=(), vpRowVector::operator/(), vpMatrix::operator/(), vpRowVector::operator/=(), vpMatrix::operator/=(), vpMatrix::operator<<(), vpColVector::operator<<(), vpSubRowVector::operator=(), vpSubMatrix::operator=(), vpRowVector::operator=(), vpMatrix::operator=(), vpRowVector::reshape(), vpMatrix::setIdentity(), vpMatrix::solveBySVD(), vpRowVector::stack(), vpMatrix::stackColumns(), vpMatrix::stackRows(), vpRowVector::sum(), vpMatrix::sum(), vpRowVector::sumSquare(), vpMatrix::sumSquare(), vpRowVector::t(), vpMatrix::t(), and vpMatrix::transpose().
|
inherited |
Address of the first element of the data array.
Definition at line 84 of file vpArray2D.h.
Referenced by vpMatrix::AtA(), vpHomogeneousMatrix::buildFrom(), vpRzyzVector::buildFrom(), vpRzyxVector::buildFrom(), vpRxyzVector::buildFrom(), vpThetaUVector::buildFrom(), vpSubColVector::checkParentStatus(), vpSubRowVector::checkParentStatus(), vpSubMatrix::checkParentStatus(), vpColVector::clear(), vpHomogeneousMatrix::convert(), vpTranslationVector::euclideanNorm(), vpRowVector::euclideanNorm(), vpMatrix::euclideanNorm(), vpMatrix::expm(), vpThetaUVector::extract(), vpThetaUVector::getTheta(), vpThetaUVector::getU(), vpSubColVector::init(), vpSubRowVector::init(), vpSubMatrix::init(), vpTranslationVector::operator*(), vpRowVector::operator*(), vpColVector::operator*(), vpHomography::operator*(), vpTranslationVector::operator-(), vpRowVector::operator-(), vpColVector::operator-(), vpTranslationVector::operator/(), vpRowVector::operator/(), vpColVector::operator/(), vpHomography::operator/(), vpHomography::operator/=(), vpSubColVector::operator=(), vpSubRowVector::operator=(), vpQuaternionVector::operator=(), vpTranslationVector::operator=(), vpRowVector::operator=(), vpRzyzVector::operator=(), vpRzyxVector::operator=(), vpRxyzVector::operator=(), vpColVector::operator=(), vpMatrix::operator=(), vpThetaUVector::operator=(), vpColVector::operator[](), vpRowVector::reshape(), vpColVector::reshape(), vpQuaternionVector::set(), vpMatrix::stackRows(), vpColVector::sum(), vpColVector::sumSquare(), vpRotationVector::t(), vpTranslationVector::t(), vpPoseVector::t(), vpRowVector::t(), vpColVector::t(), vpQuaternionVector::vpQuaternionVector(), vpRxyzVector::vpRxyzVector(), vpRzyxVector::vpRzyxVector(), vpRzyzVector::vpRzyzVector(), vpThetaUVector::vpThetaUVector(), vpQuaternionVector::w(), vpQuaternionVector::x(), vpQuaternionVector::y(), vpQuaternionVector::z(), vpSubColVector::~vpSubColVector(), vpSubMatrix::~vpSubMatrix(), and vpSubRowVector::~vpSubRowVector().
|
protectedinherited |
Current array size (rowNum * colNum)
Definition at line 80 of file vpArray2D.h.
Referenced by vpColVector::clear(), vpTranslationVector::euclideanNorm(), vpRowVector::euclideanNorm(), vpMatrix::euclideanNorm(), vpSubColVector::init(), vpSubRowVector::init(), vpSubMatrix::init(), vpTranslationVector::operator*(), vpRotationVector::operator*(), vpTranslationVector::operator-(), vpTranslationVector::operator/(), vpRzyzVector::operator=(), vpRzyxVector::operator=(), vpRxyzVector::operator=(), vpMatrix::operator=(), vpThetaUVector::operator=(), vpRowVector::reshape(), vpColVector::reshape(), vpMatrix::stackRows(), and vpRotationVector::t().
|
protectedinherited |
Number of rows in the array.
Definition at line 74 of file vpArray2D.h.
Referenced by vpMatrix::AAt(), vpMatrix::AtA(), vpColVector::clear(), vpMatrix::diag(), vpMatrix::eigenValues(), vpMatrix::expm(), vpColVector::extract(), vpMatrix::eye(), vpColVector::infinityNorm(), vpMatrix::infinityNorm(), vpSubColVector::init(), vpSubRowVector::init(), vpSubMatrix::init(), vpMatrix::insert(), vpMatrix::inverseByCholesky(), vpMatrix::inverseByLU(), vpMatrix::inverseByQR(), operator*(), vpTranslationVector::operator*(), vpHomogeneousMatrix::operator*(), vpColVector::operator*(), vpMatrix::operator*(), operator*=(), vpTranslationVector::operator*=(), vpColVector::operator*=(), vpMatrix::operator*=(), vpColVector::operator+(), vpColVector::operator+=(), vpMatrix::operator+=(), vpColVector::operator-(), vpColVector::operator-=(), vpMatrix::operator-=(), vpColVector::operator/(), vpMatrix::operator/(), vpTranslationVector::operator/=(), vpColVector::operator/=(), vpMatrix::operator/=(), vpMatrix::operator<<(), vpColVector::operator<<(), vpSubColVector::operator=(), vpSubRowVector::operator=(), vpSubMatrix::operator=(), vpTranslationVector::operator=(), vpRowVector::operator=(), vpColVector::operator=(), vpMatrix::operator=(), vpColVector::reshape(), vpMatrix::setIdentity(), vpMatrix::stack(), vpColVector::stack(), vpMatrix::stackColumns(), vpMatrix::stackRows(), vpColVector::sum(), vpMatrix::sum(), vpRotationVector::sumSquare(), vpTranslationVector::sumSquare(), vpColVector::sumSquare(), vpMatrix::sumSquare(), vpTranslationVector::t(), vpPoseVector::t(), vpColVector::t(), vpMatrix::t(), and vpMatrix::transpose().
|
protectedinherited |
Address of the first element of each rows.
Definition at line 78 of file vpArray2D.h.
Referenced by vpMatrix::AAt(), vpColVector::clear(), vpMatrix::infinityNorm(), vpSubColVector::init(), vpSubRowVector::init(), vpSubMatrix::init(), vpRowVector::init(), vpColVector::init(), vpMatrix::init(), operator*(), vpForceTwistMatrix::operator*(), vpVelocityTwistMatrix::operator*(), vpHomogeneousMatrix::operator*(), vpMatrix::operator*(), operator*=(), vpMatrix::operator*=(), vpMatrix::operator+=(), vpMatrix::operator-=(), vpMatrix::operator/(), vpMatrix::operator/=(), vpMatrix::operator<<(), vpColVector::operator<<(), vpSubMatrix::operator=(), operator=(), vpForceTwistMatrix::operator=(), vpVelocityTwistMatrix::operator=(), vpHomogeneousMatrix::operator=(), vpRowVector::operator=(), vpMatrix::operator=(), vpMatrix::stackColumns(), vpRowVector::sum(), vpMatrix::sum(), vpRotationVector::sumSquare(), vpTranslationVector::sumSquare(), vpRowVector::sumSquare(), vpMatrix::sumSquare(), and vpMatrix::transpose().