Open Inventor Reference
|
4x4 matrix class with double values. More...
#include <Inventor/SbLineard.h>
Public Member Functions | |
SbMatrixd () | |
Default constructor, initialized to identity. | |
SbMatrixd (double a11, double a12, double a13, double a14, double a21, double a22, double a23, double a24, double a31, double a32, double a33, double a34, double a41, double a42, double a43, double a44) | |
Constructor given all 16 elements in row-major order. | |
SbMatrixd (const SbMatd &m) | |
Constructors. | |
void | setValue (const SbMatd &m) |
Sets value from 4x4 array of elements. | |
void | setValue (const double *data) |
Sets value from a double array of 16 elements. | |
void | makeIdentity () |
Sets matrix to be identity. | |
void | setRotate (const SbRotationd &q) |
Sets matrix to rotate by given rotation. | |
void | setScale (double s) |
Sets matrix to scale by given uniform factor. | |
void | setScale (const SbVec3d &s) |
Sets matrix to scale by given vector. | |
void | setTranslate (const SbVec3d &t) |
Sets matrix to translate by given vector. | |
void | setTransform (const SbVec3d &translation, const SbRotationd &rotation, const SbVec3d &scaleFactor, const SbRotationd &scaleOrientation, const SbVec3d ¢er) |
Composes the matrix based on a translation, rotation, scale, orientation for scale, and center. | |
void | setTransform (const SbVec3d &t, const SbRotationd &r, const SbVec3d &s) |
Overloaded methods as a kludge because the compiler won't let us have SbVec3d(0,0,0) as a default value: | |
void | setTransform (const SbVec3d &t, const SbRotationd &r, const SbVec3d &s, const SbRotationd &so) |
void | getTransform (SbVec3d &translation, SbRotationd &rotation, SbVec3d &scaleFactor, SbRotationd &scaleOrientation, const SbVec3d ¢er) const |
Decomposes the matrix into a translation, rotation, scale, and scale orientation. | |
void | getTransform (SbVec3d &t, SbRotationd &r, SbVec3d &s, SbRotationd &so) const |
void | getValue (SbMatd &m) const |
The following methods return matrix values and other info: | |
const SbMatd & | getValue () const |
double | det3 (int r1, int r2, int r3, int c1, int c2, int c3) const |
Returns determinant of 3x3 submatrix composed of given row and column indices (0-3 for each). | |
double | det3 () const |
Returns determinant of upper-left 3x3 submatrix. | |
double | det4 () const |
Returns determinant of entire matrix. | |
bool | factor (SbMatrixd &r, SbVec3d &s, SbMatrixd &u, SbVec3d &t, SbMatrixd &proj) const |
Factors a matrix m into 5 pieces: m = r s r^ u t, where r^ means transpose of r, and r and u are rotations, s is a scale, and t is a translation. | |
SbMatrixd | inverse () const |
Returns inverse of matrix. | |
bool | LUDecomposition (int index[4], double &d) |
Perform in-place LU decomposition of matrix. | |
void | LUBackSubstitution (int index[4], double b[4]) const |
Perform back-substitution on LU-decomposed matrix. | |
SbMatrixd | transpose () const |
Returns transpose of matrix. | |
SbMatrixd & | multRight (const SbMatrixd &m) |
Multiplies matrix by given matrix on right or left. | |
SbMatrixd & | multLeft (const SbMatrixd &m) |
Multiplies matrix by given matrix on right or left. | |
SbVec3d | transformPoint (const SbVec3d &src) const |
Multiplies given row vector by matrix, giving vector result. Use this method to transform points from object coordinates to world coordinates. (MEVIS) | |
SbVec4d | transformPoint (const SbVec4d &src) const |
Multiplies given row vector by matrix, giving vector result. Takes homogenous coordinate and returns homogenous coordinate. (MEVIS) | |
SbVec3d | transformDirection (const SbVec3d &src) const |
Multiplies given row vector by matrix, giving vector result. | |
SbLined | transformLine (const SbLined &src) const |
Multiplies the given line's origin by the matrix, and the line's direction by the rotation portion of the matrix. | |
void | multMatrixVec (const SbVec3d &src, SbVec3d &dst) const |
Multiplies matrix by given column vector, giving vector result. | |
void | multVecMatrix (const SbVec3d &src, SbVec3d &dst) const |
Multiplies given row vector by matrix, giving vector result. Use this method to transform points from object coordinates to world coordinates. | |
void | multVecMatrix (const SbVec4d &src, SbVec4d &dst) const |
Multiplies given row vector by matrix, giving vector result. Takes homogenous coordinate and returns homogenous coordinate. | |
void | multVecMatrix (const SbVec3d &src, SbVec4d &dst) const |
Multiplies given row vector by matrix, giving vector result. Takes SbVec4(src,1.) coordinate and returns homogenous coordinate. | |
void | multDirMatrix (const SbVec3d &src, SbVec3d &dst) const |
Multiplies given row vector by matrix, giving vector result. | |
void | multLineMatrix (const SbLined &src, SbLined &dst) const |
Multiplies the given line's origin by the matrix, and the line's direction by the rotation portion of the matrix. | |
void | print (FILE *fp) const |
Prints a formatted version of the matrix to the given file pointer. | |
operator double * () | |
Binary multiplication of matrices. | |
operator SbMatd & () | |
Cast: returns reference to 4x4 array. | |
double * | operator[] (int i) |
Make it look like a usual matrix (so you can do m[3][2]) | |
const double * | operator[] (int i) const |
SbMatrixd & | operator= (const SbMatd &m) |
Sets value from 4x4 array of elements. | |
SbMatrixd & | operator= (const SbMatrixd &m) |
Set the matrix from another SbMatrixd. | |
SbMatrixd & | operator= (const SbRotationd &q) |
Set the matrix from an SbRotationd. | |
SbMatrixd & | operator*= (const SbMatrixd &m) |
Performs right multiplication with another matrix. | |
bool | equals (const SbMatrixd &m, double tolerance) const |
Equality comparison within given tolerance, for each component. | |
Static Public Member Functions | |
static SbMatrixd | identity () |
Returns an identity matrix. | |
Friends | |
INVENTOR_API SbMatrixd | operator* (const SbMatrixd &m1, const SbMatrixd &m2) |
Binary multiplication of matrices. | |
INVENTOR_API bool | operator== (const SbMatrixd &m1, const SbMatrixd &m2) |
Equality comparison operator. | |
INVENTOR_API bool | operator!= (const SbMatrixd &m1, const SbMatrixd &m2) |
4x4 matrix class/datatype used by many Inventor node and action classes. The matrices are stored in row-major order. {}
Definition at line 616 of file SbLineard.h.
|
inline |
Definition at line 620 of file SbLineard.h.
References makeIdentity().
Referenced by equals(), factor(), identity(), inverse(), multLeft(), multRight(), operator!=, operator*, operator*=(), operator=(), operator=(), operator=(), operator==, and transpose().
SbMatrixd::SbMatrixd | ( | double | a11, |
double | a12, | ||
double | a13, | ||
double | a14, | ||
double | a21, | ||
double | a22, | ||
double | a23, | ||
double | a24, | ||
double | a31, | ||
double | a32, | ||
double | a33, | ||
double | a34, | ||
double | a41, | ||
double | a42, | ||
double | a43, | ||
double | a44 ) |
SbMatrixd::SbMatrixd | ( | const SbMatd & | m | ) |
|
inline |
double SbMatrixd::det3 | ( | int | r1, |
int | r2, | ||
int | r3, | ||
int | c1, | ||
int | c2, | ||
int | c3 ) const |
double SbMatrixd::det4 | ( | ) | const |
bool SbMatrixd::equals | ( | const SbMatrixd & | m, |
double | tolerance ) const |
References SbMatrixd().
bool SbMatrixd::factor | ( | SbMatrixd & | r, |
SbVec3d & | s, | ||
SbMatrixd & | u, | ||
SbVec3d & | t, | ||
SbMatrixd & | proj ) const |
Any projection information is returned in proj
. NOTE: the projection matrix is always set to identity.
References SbMatrixd().
|
inline |
Definition at line 691 of file SbLineard.h.
References getTransform().
void SbMatrixd::getTransform | ( | SbVec3d & | translation, |
SbRotationd & | rotation, | ||
SbVec3d & | scaleFactor, | ||
SbRotationd & | scaleOrientation, | ||
const SbVec3d & | center ) const |
Any projection information is discarded. The decomposition depends upon choice of center point for rotation and scaling, which is optional as the last parameter. Note that if the center is 0, decompose() is the same as factor() where "t" is translation, "u" is rotation, "s" is scaleFactor, and "r" is ScaleOrientattion.
Referenced by getTransform().
|
inline |
Definition at line 700 of file SbLineard.h.
void SbMatrixd::getValue | ( | SbMatd & | m | ) | const |
Returns 4x4 array of elements
|
static |
References SbMatrixd().
SbMatrixd SbMatrixd::inverse | ( | ) | const |
Results are undefined for singular matrices. Uses LU decomposition.
References SbMatrixd().
void SbMatrixd::LUBackSubstitution | ( | int | index[4], |
double | b[4] ) const |
Index is permutation of rows from original matrix.
bool SbMatrixd::LUDecomposition | ( | int | index[4], |
double & | d ) |
index
is index of rows in matrix. d
is the parity of row swaps. Returns FALSE if singular.
void SbMatrixd::makeIdentity | ( | ) |
Referenced by SbMatrixd().
src
is assumed to be a direction vector, so translation part of matrix is ignored. Note: if you wish to transform surface points and normals by a matrix, call multVecMatrix() for the points and call multDirMatrix() on the inverse transpose of the matrix for the normals.
Referenced by transformDirection().
References SbMatrixd().
NOTE: Typically you should use multVecMatrix() instead, since object/world transforms normally use row vectors.
References SbMatrixd().
Referenced by operator*=().
Referenced by transformPoint(), and transformPoint().
|
inline |
Definition at line 788 of file SbLineard.h.
|
inline |
Definition at line 791 of file SbLineard.h.
Definition at line 807 of file SbLineard.h.
References multRight(), and SbMatrixd().
References SbMatrixd().
References SbMatrixd().
|
inline |
Definition at line 804 of file SbLineard.h.
References SbMatrixd(), and setRotate().
|
inline |
Definition at line 794 of file SbLineard.h.
|
inline |
Definition at line 795 of file SbLineard.h.
void SbMatrixd::print | ( | FILE * | fp | ) | const |
void SbMatrixd::setRotate | ( | const SbRotationd & | q | ) |
Referenced by operator=().
void SbMatrixd::setScale | ( | const SbVec3d & | s | ) |
void SbMatrixd::setScale | ( | double | s | ) |
|
inline |
Definition at line 671 of file SbLineard.h.
References setTransform().
|
inline |
Definition at line 675 of file SbLineard.h.
References setTransform().
void SbMatrixd::setTransform | ( | const SbVec3d & | translation, |
const SbRotationd & | rotation, | ||
const SbVec3d & | scaleFactor, | ||
const SbRotationd & | scaleOrientation, | ||
const SbVec3d & | center ) |
The "center" is the center point for scaling and rotation. The "scaleOrientation" chooses the primary axes for the scale.
Referenced by setTransform(), and setTransform().
void SbMatrixd::setTranslate | ( | const SbVec3d & | t | ) |
void SbMatrixd::setValue | ( | const double * | data | ) |
void SbMatrixd::setValue | ( | const SbMatd & | m | ) |
src
is assumed to be a direction vector, so translation part of matrix is ignored. Note: if you wish to transform surface points and normals by a matrix, call multVecMatrix() for the points and call multDirMatrix() on the inverse transpose of the matrix for the normals. (MEVIS)
Definition at line 753 of file SbLineard.h.
References multDirMatrix().
Definition at line 741 of file SbLineard.h.
References multVecMatrix().
Definition at line 743 of file SbLineard.h.
References multVecMatrix().
SbMatrixd SbMatrixd::transpose | ( | ) | const |
References SbMatrixd().
|
friend |
Definition at line 832 of file SbLineard.h.
References INVENTOR_API, and SbMatrixd().
|
friend |
References INVENTOR_API, and SbMatrixd().
|
friend |
References INVENTOR_API, and SbMatrixd().