Open Inventor Reference
SbMatrixd Class Reference

4x4 matrix class with double values. More...

#include <Inventor/SbLineard.h>

Public Member Functions

 SbMatrixd ()
 Default constructor, initialized to identity. More...
 
 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. More...
 
 SbMatrixd (const SbMatd &m)
 Constructors. More...
 
void setValue (const SbMatd &m)
 Sets value from 4x4 array of elements. More...
 
void setValue (const double *data)
 Sets value from a double array of 16 elements. More...
 
void makeIdentity ()
 Sets matrix to be identity. More...
 
void setRotate (const SbRotationd &q)
 Sets matrix to rotate by given rotation. More...
 
void setScale (double s)
 Sets matrix to scale by given uniform factor. More...
 
void setScale (const SbVec3d &s)
 Sets matrix to scale by given vector. More...
 
void setTranslate (const SbVec3d &t)
 Sets matrix to translate by given vector. More...
 
void setTransform (const SbVec3d &translation, const SbRotationd &rotation, const SbVec3d &scaleFactor, const SbRotationd &scaleOrientation, const SbVec3d &center)
 Composes the matrix based on a translation, rotation, scale, orientation for scale, and center. More...
 
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: More...
 
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 &center) const
 Decomposes the matrix into a translation, rotation, scale, and scale orientation. More...
 
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: More...
 
const SbMatdgetValue () 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). More...
 
double det3 () const
 Returns determinant of upper-left 3x3 submatrix. More...
 
double det4 () const
 Returns determinant of entire matrix. More...
 
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. More...
 
SbMatrixd inverse () const
 Returns inverse of matrix. More...
 
bool LUDecomposition (int index[4], double &d)
 Perform in-place LU decomposition of matrix. More...
 
void LUBackSubstitution (int index[4], double b[4]) const
 Perform back-substitution on LU-decomposed matrix. More...
 
SbMatrixd transpose () const
 Returns transpose of matrix. More...
 
SbMatrixdmultRight (const SbMatrixd &m)
 Multiplies matrix by given matrix on right or left. More...
 
SbMatrixdmultLeft (const SbMatrixd &m)
 Multiplies matrix by given matrix on right or left. More...
 
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) More...
 
SbVec4d transformPoint (const SbVec4d &src) const
 Multiplies given row vector by matrix, giving vector result. Takes homogenous coordinate and returns homogenous coordinate. (MEVIS) More...
 
SbVec3d transformDirection (const SbVec3d &src) const
 Multiplies given row vector by matrix, giving vector result. More...
 
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. More...
 
void multMatrixVec (const SbVec3d &src, SbVec3d &dst) const
 Multiplies matrix by given column vector, giving vector result. More...
 
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. More...
 
void multVecMatrix (const SbVec4d &src, SbVec4d &dst) const
 Multiplies given row vector by matrix, giving vector result. Takes homogenous coordinate and returns homogenous coordinate. More...
 
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. More...
 
void multDirMatrix (const SbVec3d &src, SbVec3d &dst) const
 Multiplies given row vector by matrix, giving vector result. More...
 
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. More...
 
void print (FILE *fp) const
 Prints a formatted version of the matrix to the given file pointer. More...
 
 operator double * ()
 Binary multiplication of matrices. More...
 
 operator SbMatd & ()
 Cast: returns reference to 4x4 array. More...
 
double * operator[] (int i)
 Make it look like a usual matrix (so you can do m[3][2]) More...
 
const double * operator[] (int i) const
 
SbMatrixdoperator= (const SbMatd &m)
 Sets value from 4x4 array of elements. More...
 
SbMatrixdoperator= (const SbMatrixd &m)
 Set the matrix from another SbMatrixd. More...
 
SbMatrixdoperator= (const SbRotationd &q)
 Set the matrix from an SbRotationd. More...
 
SbMatrixdoperator*= (const SbMatrixd &m)
 Performs right multiplication with another matrix. More...
 
bool equals (const SbMatrixd &m, double tolerance) const
 Equality comparison within given tolerance, for each component. More...
 

Static Public Member Functions

static SbMatrixd identity ()
 Returns an identity matrix. More...
 

Friends

INVENTOR_API SbMatrixd operator* (const SbMatrixd &m1, const SbMatrixd &m2)
 Binary multiplication of matrices. More...
 
INVENTOR_API bool operator== (const SbMatrixd &m1, const SbMatrixd &m2)
 Equality comparison operator. More...
 
INVENTOR_API bool operator!= (const SbMatrixd &m1, const SbMatrixd &m2)
 

Detailed Description

4x4 matrix class/datatype used by many Inventor node and action classes. The matrices are stored in row-major order. {}

See Also
SbVec3f, SbRotation, SbMatrix, SbVec3d, SbRotationd

Definition at line 616 of file SbLineard.h.

Constructor & Destructor Documentation

◆ SbMatrixd() [1/3]

SbMatrixd::SbMatrixd ( )
inline

Definition at line 620 of file SbLineard.h.

◆ SbMatrixd() [2/3]

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() [3/3]

SbMatrixd::SbMatrixd ( const SbMatd m)

Member Function Documentation

◆ det3() [1/2]

double SbMatrixd::det3 ( ) const
inline

Definition at line 707 of file SbLineard.h.

References det3().

Referenced by det3().

◆ det3() [2/2]

double SbMatrixd::det3 ( int  r1,
int  r2,
int  r3,
int  c1,
int  c2,
int  c3 
) const

◆ det4()

double SbMatrixd::det4 ( ) const

◆ equals()

bool SbMatrixd::equals ( const SbMatrixd m,
double  tolerance 
) const

◆ factor()

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.

◆ getTransform() [1/2]

void SbMatrixd::getTransform ( SbVec3d t,
SbRotationd r,
SbVec3d s,
SbRotationd so 
) const
inline

Definition at line 691 of file SbLineard.h.

◆ getTransform() [2/2]

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.

◆ getValue() [1/2]

const SbMatd& SbMatrixd::getValue ( ) const
inline

Definition at line 700 of file SbLineard.h.

◆ getValue() [2/2]

void SbMatrixd::getValue ( SbMatd m) const

Returns 4x4 array of elements

◆ identity()

static SbMatrixd SbMatrixd::identity ( )
static

◆ inverse()

SbMatrixd SbMatrixd::inverse ( ) const

Results are undefined for singular matrices. Uses LU decomposition.

◆ LUBackSubstitution()

void SbMatrixd::LUBackSubstitution ( int  index[4],
double  b[4] 
) const

Index is permutation of rows from original matrix.

◆ LUDecomposition()

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.

◆ makeIdentity()

void SbMatrixd::makeIdentity ( )

◆ multDirMatrix()

void SbMatrixd::multDirMatrix ( const SbVec3d src,
SbVec3d dst 
) const

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.

◆ multLeft()

SbMatrixd& SbMatrixd::multLeft ( const SbMatrixd m)

◆ multLineMatrix()

void SbMatrixd::multLineMatrix ( const SbLined src,
SbLined dst 
) const

◆ multMatrixVec()

void SbMatrixd::multMatrixVec ( const SbVec3d src,
SbVec3d dst 
) const

NOTE: Typically you should use multVecMatrix() instead, since object/world transforms normally use row vectors.

◆ multRight()

SbMatrixd& SbMatrixd::multRight ( const SbMatrixd m)

◆ multVecMatrix() [1/3]

void SbMatrixd::multVecMatrix ( const SbVec3d src,
SbVec3d dst 
) const

◆ multVecMatrix() [2/3]

void SbMatrixd::multVecMatrix ( const SbVec3d src,
SbVec4d dst 
) const

◆ multVecMatrix() [3/3]

void SbMatrixd::multVecMatrix ( const SbVec4d src,
SbVec4d dst 
) const

◆ operator double *()

SbMatrixd::operator double * ( )
inline

Definition at line 788 of file SbLineard.h.

◆ operator SbMatd &()

SbMatrixd::operator SbMatd & ( )
inline

Definition at line 791 of file SbLineard.h.

◆ operator*=()

SbMatrixd& SbMatrixd::operator*= ( const SbMatrixd m)
inline

Definition at line 807 of file SbLineard.h.

◆ operator=() [1/3]

SbMatrixd& SbMatrixd::operator= ( const SbMatd m)

◆ operator=() [2/3]

SbMatrixd& SbMatrixd::operator= ( const SbMatrixd m)

◆ operator=() [3/3]

SbMatrixd& SbMatrixd::operator= ( const SbRotationd q)
inline

Definition at line 804 of file SbLineard.h.

◆ operator[]() [1/2]

double* SbMatrixd::operator[] ( int  i)
inline

Definition at line 794 of file SbLineard.h.

◆ operator[]() [2/2]

const double* SbMatrixd::operator[] ( int  i) const
inline

Definition at line 795 of file SbLineard.h.

◆ print()

void SbMatrixd::print ( FILE *  fp) const

◆ setRotate()

void SbMatrixd::setRotate ( const SbRotationd q)

◆ setScale() [1/2]

void SbMatrixd::setScale ( const SbVec3d s)

◆ setScale() [2/2]

void SbMatrixd::setScale ( double  s)

◆ setTransform() [1/3]

void SbMatrixd::setTransform ( const SbVec3d t,
const SbRotationd r,
const SbVec3d s 
)
inline

Definition at line 671 of file SbLineard.h.

◆ setTransform() [2/3]

void SbMatrixd::setTransform ( const SbVec3d t,
const SbRotationd r,
const SbVec3d s,
const SbRotationd so 
)
inline

Definition at line 675 of file SbLineard.h.

◆ setTransform() [3/3]

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.

◆ setTranslate()

void SbMatrixd::setTranslate ( const SbVec3d t)

◆ setValue() [1/2]

void SbMatrixd::setValue ( const double *  data)

◆ setValue() [2/2]

void SbMatrixd::setValue ( const SbMatd m)

◆ transformDirection()

SbVec3d SbMatrixd::transformDirection ( const SbVec3d src) const
inline

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.

◆ transformLine()

SbLined SbMatrixd::transformLine ( const SbLined src) const

(MEVIS)

◆ transformPoint() [1/2]

SbVec3d SbMatrixd::transformPoint ( const SbVec3d src) const
inline

Definition at line 741 of file SbLineard.h.

◆ transformPoint() [2/2]

SbVec4d SbMatrixd::transformPoint ( const SbVec4d src) const
inline

Definition at line 743 of file SbLineard.h.

◆ transpose()

SbMatrixd SbMatrixd::transpose ( ) const

Friends And Related Function Documentation

◆ operator!=

INVENTOR_API bool operator!= ( const SbMatrixd m1,
const SbMatrixd m2 
)
friend

Definition at line 832 of file SbLineard.h.

◆ operator*

INVENTOR_API SbMatrixd operator* ( const SbMatrixd m1,
const SbMatrixd m2 
)
friend

◆ operator==

INVENTOR_API bool operator== ( const SbMatrixd m1,
const SbMatrixd m2 
)
friend

The documentation for this class was generated from the following file: