SbMatrixd Class Reference
[Basics]

VSG extension 4x4 matrix class (double precision). More...

#include <Inventor/SbMatrix.h>

List of all members.

Public Member Functions

 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 (const SbMatd &m)
void setValue (const SbMatd &m)
void setValue (const double *pMat)
void setValue (const SbMatrix &m)
void makeIdentity ()
void setRotate (const SbRotationd &q)
void setScale (double s)
void setScale (const SbVec3d &s)
void setTranslate (const SbVec3d &t)
void setTransform (const SbVec3d &translation, const SbRotationd &rotation, const SbVec3d &scaleFactor, const SbRotationd &scaleOrientation, const SbVec3d &center)
void setTransform (const SbVec3d &t, const SbRotationd &r, const SbVec3d &s)
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
void getTransform (SbVec3d &t, SbRotationd &r, SbVec3d &s, SbRotationd &so) const
void getValue (SbMatd &m) const
const SbMatdgetValue () const
double det3 (int r1, int r2, int r3, int c1, int c2, int c3) const
double det3 () const
double det4 () const
SbBool factor (SbMatrixd &r, SbVec3d &s, SbMatrixd &u, SbVec3d &t, SbMatrixd &proj) const
SbMatrixd inverse () const
void translate (const SbVec3d &translation)
void scale (const SbVec3d &scaleFactor)
SbBool LUDecomposition (int index[4], double &d)
void LUBackSubstitution (int index[4], double b[4]) const
SbMatrixd transpose () const
SbMatrixdmultRight (const SbMatrixd &m)
SbMatrixdmultLeft (const SbMatrixd &m)
void multMatrixVec (const SbVec3d &src, SbVec3d &dst) const
void multVecMatrix (const SbVec3d &src, SbVec3d &dst) const
void multDirMatrix (const SbVec3d &src, SbVec3d &dst) const
void multLineMatrix (const SbLined &src, SbLined &dst) const
SbVec4d operator* (const SbVec4d &v)
void print (FILE *fp) const
 operator double * ()
 operator SbMatd & ()
double * operator[] (int i)
const double * operator[] (int i) const
SbMatrixdoperator= (const SbMatd &m)
SbMatrixdoperator= (const SbMatrixd &m)
SbMatrixdoperator= (const SbRotationd &q)
SbMatrixdoperator*= (const SbMatrixd &m)
SbBool equals (const SbMatrixd &m, double tolerance) const
bool isInvertible () const

Static Public Member Functions

static SbMatrixd identity ()

Friends

SbVec4d operator* (const SbVec4d &v, const SbMatrixd &m)
SbMatrixd operator* (const SbMatrixd &m1, const SbMatrixd &m2)
int operator== (const SbMatrixd &m1, const SbMatrixd &m2)
int operator!= (const SbMatrixd &m1, const SbMatrixd &m2)

Detailed Description

VSG extension 4x4 matrix class (double precision).

4x4 double precision matrix class/datatype. Although Open Inventor fields store only single precision values, for certain applications it is useful and convenient to be able to store and manipulate double precision values, for example, double precision coordinate data or values that will be used for further computation.

See SbMatrix for discussion of storage layout and usage of matrices.

SEE ALSO

SbMatrix, SbMatrix3, SbRotation, SbRotationd, SbVec2d, SbVec2f, SbVec2i32, SbVec2s, SbVec3d, SbVec3f, SbVec3i32, SbVec3s, SbVec4b, SbVec4d, SbVec4f, SbVec4i32, SbVec4s, SbVec4ub, SbVec4ui32, SbVec4us


Constructor & Destructor Documentation

SbMatrixd::SbMatrixd (  )  [inline]

Default constructor.

The matrix is initialized with zeros.

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 
)

Constructor.

SbMatrixd::SbMatrixd ( const SbMatd m  ) 

Constructor.


Member Function Documentation

double SbMatrixd::det3 (  )  const [inline]

Returns determinant of upper-left 3x3 submatrix.

double SbMatrixd::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 SbMatrixd::det4 (  )  const

Returns determinant of entire matrix.

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

Equality comparison within given tolerance, for each component.

SbBool SbMatrixd::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.

Any projection information is returned in proj.

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

Return translation, rotation, scale, and scale orientation components of the matrix.

void SbMatrixd::getTransform ( SbVec3d translation,
SbRotationd rotation,
SbVec3d scaleFactor,
SbRotationd scaleOrientation,
const SbVec3d center 
) const

Decomposes the matrix into a translation, rotation, scale, and scale orientation.

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 scaleOrientation.

const SbMatd& SbMatrixd::getValue (  )  const [inline]

Returns matrix as a 4x4 array of elements.

void SbMatrixd::getValue ( SbMatd m  )  const

Returns matrix as a 4x4 array of elements.

static SbMatrixd SbMatrixd::identity (  )  [static]

Returns an identity matrix.

SbMatrixd SbMatrixd::inverse (  )  const

Returns inverse of matrix.

Results are undefined for singular matrices. Uses LU decomposition.
Matrix is not modified.

bool SbMatrixd::isInvertible (  )  const

Returns true if the matrix is invertible.

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

Perform back-substitution on LU-decomposed matrix.

Index is permutation of rows from original matrix.

SbBool SbMatrixd::LUDecomposition ( int  index[4],
double &  d 
)

Perform in-place LU decomposition of matrix.

index is index of rows in matrix. d is the parity of row swaps. Returns FALSE if singular.

void SbMatrixd::makeIdentity (  ) 

Sets matrix to be identity.

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

Pre-multiplies the matrix by the given row vector, giving vector result.

src is assumed to be a direction vector, so translation part of matrix is ignored.

Note: If you need to transform surface points and normal vectors by a matrix, call multVecMatrix() for the points and call multDirMatrix() for the normals. Generally normals should be transformed by the inverse transpose of the matrix. However note that the inverse transpose is equal to the original matrix if the matrix is orthonormal, i.e. purely rotational with no scaling or shearing.

It is safe to let src and dst be the same instance of SbVec3f.

SbMatrixd& SbMatrixd::multLeft ( const SbMatrixd m  ) 

Pre-multiplies the matrix by given matrix.

Matrix is replaced by the result.

void SbMatrixd::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.

It is safe to let src and dst be the same instance of SbLine.

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

Post-multiplies matrix by given column vector, giving a 3D vector result.

The intermediate homogeneous (vec4) value is converted to 3D by dividing the X, Y and Z components by W.

It is safe to let src and dst be the same instance of SbVec3f.

SbMatrixd& SbMatrixd::multRight ( const SbMatrixd m  ) 

Post-multiplies the matrix by given matrix.

Matrix is replaced by the result.

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

Pre-multiplies matrix by the given row vector, giving a 3D vector result.

The intermediate homogeneous (vec4) value is converted to 3D by dividing the X, Y and Z components by W.

Use this method to transform a point (position vector).
Use multDirMatrix() to transform a normal (direction vector).

It is safe to let src and dst be the same instance of SbVec3f.

SbMatrixd::operator double * (  )  [inline]

Cast: returns pointer to storage of first element.

SbMatrixd::operator SbMatd & (  )  [inline]

Cast: returns reference to 4x4 array.

SbVec4d SbMatrixd::operator* ( const SbVec4d v  ) 

Multiply matrix by given vector.

Return m * v

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

Post-multiplies the matrix by the given matrix (equivalent to multRight() method).

Matrix is replaced by the resulting matrix.

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

Set the matrix from an SbRotationd.

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

Set the matrix from another SbMatrixd.

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

Sets value from 4x4 array of elements.

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

Make it look like a usual matrix (so you can do m[3][2]).

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

Make it look like a usual matrix (so you can do m[3][2]).

void SbMatrixd::print ( FILE *  fp  )  const

Prints a formatted version of the matrix to the given file pointer.

void SbMatrixd::scale ( const SbVec3d scaleFactor  ) 

Scales this matrice by the given vector.

void SbMatrixd::setRotate ( const SbRotationd q  ) 

Sets matrix to rotate by given rotation.

void SbMatrixd::setScale ( const SbVec3d s  ) 

Sets matrix to scale by given vector.

void SbMatrixd::setScale ( double  s  ) 

Sets matrix to scale by given uniform factor.

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

Composes the matrix based on a translation, rotation, scale, and orientation for scale.

The scaleOrientation chooses the primary axes for the scale. The center point for scaling and rotation is (0,0,0).

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

Composes the matrix based on a translation, rotation, and scale.

A scale orientation value of (0,0,0,1) is used. The center point for scaling and rotation is (0,0,0).

void SbMatrixd::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.

The scaleOrientation chooses the primary axes for the scale. The center is the center point for scaling and rotation.

void SbMatrixd::setTranslate ( const SbVec3d t  ) 

Sets matrix to translate by given vector.

void SbMatrixd::setValue ( const SbMatrix m  ) 

Sets values from a single precision matrix.

void SbMatrixd::setValue ( const double *  pMat  )  [inline]

Sets value from a 16 value double array.

void SbMatrixd::setValue ( const SbMatd m  ) 

Sets value from 4x4 array of elements.

void SbMatrixd::translate ( const SbVec3d translation  ) 

Translates this matrice by the given vector.

SbMatrixd SbMatrixd::transpose (  )  const

Returns transpose of matrix.

Matrix is not modified.


Friends And Related Function Documentation

int operator!= ( const SbMatrixd m1,
const SbMatrixd m2 
) [friend]

Inequality comparison operator.

SbMatrixd operator* ( const SbMatrixd m1,
const SbMatrixd m2 
) [friend]

Multiplies two matrices, returning a matrix result.

SbVec4d operator* ( const SbVec4d v,
const SbMatrixd m 
) [friend]

Multiplies matrices by vector, returning a vector result.

Return v*m.

int operator== ( const SbMatrixd m1,
const SbMatrixd m2 
) [friend]

Equality comparison operator.


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

Open Inventor Toolkit reference manual, generated on 4 Sep 2023
Copyright © Thermo Fisher Scientific All rights reserved.
https://www.openinventor.com/