opensurgsim
|
Definitions of small fixed-size square matrix types. More...
#include <vector>
#include <Eigen/Core>
#include <Eigen/Geometry>
#include <Eigen/LU>
Go to the source code of this file.
Namespaces | |
SurgSim | |
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui needs glew but we need to call glewInit() from a osg callback, using this call we avoid getting warnings about redefinitions. | |
Typedefs | |
typedef Eigen::Matrix< float, 2, 2, Eigen::RowMajor > | SurgSim::Math::Matrix22f |
A 2x2 matrix of floats. More... | |
typedef Eigen::Matrix< float, 3, 3, Eigen::RowMajor > | SurgSim::Math::Matrix33f |
A 3x3 matrix of floats. More... | |
typedef Eigen::Matrix< float, 4, 4, Eigen::RowMajor > | SurgSim::Math::Matrix44f |
A 4x4 matrix of floats. More... | |
typedef Eigen::Matrix< double, 2, 2, Eigen::RowMajor > | SurgSim::Math::Matrix22d |
A 2x2 matrix of doubles. More... | |
typedef Eigen::Matrix< double, 3, 3, Eigen::RowMajor > | SurgSim::Math::Matrix33d |
A 3x3 matrix of doubles. More... | |
typedef Eigen::Matrix< double, 4, 4, Eigen::RowMajor > | SurgSim::Math::Matrix44d |
A 4x4 matrix of doubles. More... | |
typedef Eigen::Matrix< double, 6, 6, Eigen::RowMajor > | SurgSim::Math::Matrix66d |
A 6x6 matrix of doubles. More... | |
typedef Eigen::DiagonalMatrix< double, Eigen::Dynamic > | SurgSim::Math::DiagonalMatrix |
A dynamic size diagonal matrix. | |
typedef Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > | SurgSim::Math::Matrix |
A dynamic size matrix. | |
Functions | |
template<typename T , int VOpt> | |
Eigen::Matrix< T, 3, 3 > | SurgSim::Math::makeRotationMatrix (const T &angle, const Eigen::Matrix< T, 3, 1, VOpt > &axis) |
Create a rotation matrix corresponding to the specified angle (in radians) and axis. More... | |
template<typename T , int VOpt> | |
Eigen::Matrix< T, 3, 3 > | SurgSim::Math::makeSkewSymmetricMatrix (const Eigen::Matrix< T, 3, 1, VOpt > &vector) |
Create a skew-symmetric matrix corresponding to the specified vector. More... | |
template<typename T , int MOpt> | |
Eigen::Matrix< T, 3, 1 > | SurgSim::Math::skew (const Eigen::Matrix< T, 3, 3, MOpt > &matrix) |
Extract the unique vector from the skew-symmetric part of a given matrix. More... | |
template<typename T , int MOpt, int VOpt> | |
void | SurgSim::Math::computeAngleAndAxis (const Eigen::Matrix< T, 3, 3, MOpt > &matrix, T *angle, Eigen::Matrix< T, 3, 1, VOpt > *axis) |
Get the angle (in radians) and axis corresponding to a rotation matrix. More... | |
template<typename T , int MOpt> | |
T | SurgSim::Math::computeAngle (const Eigen::Matrix< T, 3, 3, MOpt > &matrix) |
Get the angle corresponding to a quaternion's rotation, in radians. More... | |
template<class Matrix , class SubMatrix > | |
void | SurgSim::Math::addSubMatrix (const SubMatrix &subMatrix, size_t blockIdRow, size_t blockIdCol, size_t blockSizeRow, size_t blockSizeCol, Matrix *matrix) |
Helper method to add a sub-matrix into a matrix, for the sake of clarity. More... | |
template<class Matrix , class SubMatrix > | |
void | SurgSim::Math::addSubMatrix (const SubMatrix &subMatrix, const std::vector< size_t > &blockIds, size_t blockSize, Matrix *matrix) |
Helper method to add a sub-matrix made of squared-blocks into a matrix, for the sake of clarity. More... | |
template<class Matrix , class SubMatrix > | |
void | SurgSim::Math::setSubMatrix (const SubMatrix &subMatrix, size_t blockIdRow, size_t blockIdCol, size_t blockSizeRow, size_t blockSizeCol, Matrix *matrix) |
Helper method to set a sub-matrix into a matrix, for the sake of clarity. More... | |
template<class Matrix > | |
Eigen::Block< Matrix > | SurgSim::Math::getSubMatrix (Matrix &matrix, size_t blockIdRow, size_t blockIdCol, size_t blockSizeRow, size_t blockSizeCol) |
Helper method to access a sub-matrix from a matrix, for the sake of clarity. More... | |
template<class Derived > | |
void | SurgSim::Math::zeroRow (size_t row, Eigen::DenseBase< Derived > *matrix) |
Helper method to zero a row of a matrix. More... | |
template<class Derived > | |
void | SurgSim::Math::zeroColumn (size_t column, Eigen::DenseBase< Derived > *matrix) |
Helper method to zero a column of a matrix. More... | |
Definitions of small fixed-size square matrix types.
typedef Eigen::Matrix<double, 2, 2, Eigen::RowMajor> SurgSim::Math::Matrix22d |
A 2x2 matrix of doubles.
This type (and any structs that contain it) can be safely allocated via new.
typedef Eigen::Matrix<float, 2, 2, Eigen::RowMajor> SurgSim::Math::Matrix22f |
A 2x2 matrix of floats.
This type (and any structs that contain it) can be safely allocated via new.
typedef Eigen::Matrix<double, 3, 3, Eigen::RowMajor> SurgSim::Math::Matrix33d |
A 3x3 matrix of doubles.
This type (and any structs that contain it) can be safely allocated via new.
typedef Eigen::Matrix<float, 3, 3, Eigen::RowMajor> SurgSim::Math::Matrix33f |
A 3x3 matrix of floats.
This type (and any structs that contain it) can be safely allocated via new.
typedef Eigen::Matrix<double, 4, 4, Eigen::RowMajor> SurgSim::Math::Matrix44d |
A 4x4 matrix of doubles.
This type (and any structs that contain it) can be safely allocated via new.
typedef Eigen::Matrix<float, 4, 4, Eigen::RowMajor> SurgSim::Math::Matrix44f |
A 4x4 matrix of floats.
This type (and any structs that contain it) can be safely allocated via new.
typedef Eigen::Matrix<double, 6, 6, Eigen::RowMajor> SurgSim::Math::Matrix66d |
A 6x6 matrix of doubles.
This type (and any structs that contain it) can be safely allocated via new.
void SurgSim::Math::addSubMatrix | ( | const SubMatrix & | subMatrix, |
size_t | blockIdRow, | ||
size_t | blockIdCol, | ||
size_t | blockSizeRow, | ||
size_t | blockSizeCol, | ||
Matrix * | matrix | ||
) |
Helper method to add a sub-matrix into a matrix, for the sake of clarity.
Matrix | The matrix type |
SubMatrix | The sub-matrix type |
subMatrix | The sub-matrix | |
blockIdRow,blockIdCol | The block indices in matrix | |
blockSizeRow,blockSizeCol | The block size (size of the sub-matrix) | |
[out] | matrix | The matrix to add the sub-matrix into |
void SurgSim::Math::addSubMatrix | ( | const SubMatrix & | subMatrix, |
const std::vector< size_t > & | blockIds, | ||
size_t | blockSize, | ||
Matrix * | matrix | ||
) |
Helper method to add a sub-matrix made of squared-blocks into a matrix, for the sake of clarity.
Matrix | The matrix type |
SubMatrix | The sub-matrix type |
subMatrix | The sub-matrix (containing all the squared-blocks) | |
blockIds | Vector of block indices (for accessing matrix) corresponding to the blocks in sub-matrix | |
blockSize | The blocks size | |
[out] | matrix | The matrix to add the sub-matrix blocks into |
|
inline |
Get the angle corresponding to a quaternion's rotation, in radians.
If you don't care about the rotation axis, this is more efficient than computeAngleAndAxis().
T | the numeric data type used for arguments and the return value. Can usually be deduced. |
MOpt | the option flags (alignment etc.) used for the rotation matrix argument. Can be deduced. |
matrix | the rotation matrix to inspect. |
|
inline |
Get the angle (in radians) and axis corresponding to a rotation matrix.
T | the numeric data type used for arguments and the return value. Can usually be deduced. |
MOpt | the option flags (alignment etc.) used for the rotation matrix argument. Can be deduced. |
VOpt | the option flags (alignment etc.) used for the axis vector argument. Can be deduced. |
matrix | the rotation matrix to inspect. | |
[out] | angle | the angle of the rotation, in radians. |
[out] | axis | the axis of the rotation. |
Eigen::Block<Matrix> SurgSim::Math::getSubMatrix | ( | Matrix & | matrix, |
size_t | blockIdRow, | ||
size_t | blockIdCol, | ||
size_t | blockSizeRow, | ||
size_t | blockSizeCol | ||
) |
Helper method to access a sub-matrix from a matrix, for the sake of clarity.
Matrix | The matrix type to get the sub-matrix from |
matrix | The matrix to get the sub-matrix from |
blockIdRow,blockIdCol | The block indices |
blockSizeRow,blockSizeCol | The block size |
|
inline |
Create a rotation matrix corresponding to the specified angle (in radians) and axis.
T | the numeric data type used for arguments and the return value. Can usually be deduced. |
VOpt | the option flags (alignment etc.) used for the axis vector argument. Can be deduced. |
angle | the angle of the rotation, in radians. |
axis | the axis of the rotation. |
|
inline |
Create a skew-symmetric matrix corresponding to the specified vector.
Skew-symmetric matrices are particularly useful for representing a portion of the vector cross-product.
T | the numeric data type used for arguments and the return value. Can usually be deduced. |
VOpt | the option flags (alignment etc.) used for the vector argument. Can be deduced. |
vector | the vector to be transformed. |
void SurgSim::Math::setSubMatrix | ( | const SubMatrix & | subMatrix, |
size_t | blockIdRow, | ||
size_t | blockIdCol, | ||
size_t | blockSizeRow, | ||
size_t | blockSizeCol, | ||
Matrix * | matrix | ||
) |
Helper method to set a sub-matrix into a matrix, for the sake of clarity.
Matrix | The matrix type |
SubMatrix | The sub-matrix type |
subMatrix | The sub-matrix | |
blockIdRow,blockIdCol | The block indices for row and column in matrix | |
blockSizeRow,blockSizeCol | The size of the sub-matrix | |
[out] | matrix | The matrix to set the sub-matrix into |
|
inline |
Extract the unique vector from the skew-symmetric part of a given matrix.
T | the numeric data type used for arguments and the return value. Can usually be deduced. |
MOpt | the option flags (alignment etc.) used for the matrix argument. Can be deduced. |
matrix | the matrix to compute the skew symmetric part from. |
void SurgSim::Math::zeroColumn | ( | size_t | column, |
Eigen::DenseBase< Derived > * | matrix | ||
) |
Helper method to zero a column of a matrix.
Matrix | The matrix type |
column | The column to set to zero | |
[in,out] | matrix | The matrix to set the zero column on. |
void SurgSim::Math::zeroRow | ( | size_t | row, |
Eigen::DenseBase< Derived > * | matrix | ||
) |
Helper method to zero a row of a matrix.
Matrix | The matrix type |
row | The row to set to zero | |
[in,out] | matrix | The matrix to set the zero row on. |