logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

SbMatrix — 4x4 matrix class

Description

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

Inherits From

       SbMatrix

Methods

SbMatrix()SbMatrix(floata11,floata12,floata13,floata14,floata21,floata22,floata23,floata24,floata31,floata32,floata33,floata34,floata41,floata42,floata43,floata44)SbMatrix(constSbMat&m)
          Constructors.

     voidsetValue(constSbMat&m)
          Sets value from 4x4 array of elements.

     voidgetValue(SbMat&m)constconstSbMat&getValue()const
          Returns 4x4 array of elements.

     voidmakeIdentity()
          Sets matrix to be identity.

     staticSbMatrixidentity()
          Returns an identity matrix.

     voidsetRotate(constSbRotation&q)
          Sets matrix to rotate by given rotation.

     voidsetScale(floats)
          Sets matrix to scale by given uniform factor.

     voidsetScale(constSbVec3f&s)
          Sets matrix to scale by given vector.

     voidsetTranslate(constSbVec3f&t)
          Sets matrix to translate by given vector.

     voidsetTransform(constSbVec3f&t,constSbRotation&r,constSbVec3f&s)voidsetTransform(constSbVec3f&t,constSbRotation&r,constSbVec3f&s,constSbRotation&so)voidsetTransform(constSbVec3f&translation,constSbRotation&rotation,constSbVec3f&scaleFactor,constSbRotation&scaleOrientation,constSbVec3f&center)
          Composes  the  matrix  based on a translation, rotation, scale, orientation for scale, and center. The
          center is the center point for scaling and rotation. The scaleOrientation chooses the primary axes for
          the scale.

     voidgetTransform(SbVec3f&t,SbRotation&r,SbVec3f&s,SbRotation&so)const
          Return translation, rotation, scale, and scale orientation components of the matrix.

     voidgetTransform(SbVec3f&translation,SbRotation&rotation,SbVec3f&scaleFactor,SbRotation&scaleOrientation,constSbVec3f&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.

     floatdet3(intr1,intr2,intr3,intc1,intc2,intc3)const
          Returns determinant of 3x3 submatrix composed of given row and column indices (0-3 for each).

     floatdet3()const
          Returns determinant of upper-left 3x3 submatrix.

     floatdet4()const
          Returns determinant of entire matrix.

     SbBoolfactor(SbMatrix&r,SbVec3f&s,SbMatrix&u,SbVec3f&t,SbMatrix&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. NOTE:
          the projection matrix is always set to identity.

     SbMatrixinverse()const
          Returns inverse of matrix. Results are undefined for singular matrices. Uses LU decomposition.

     SbBoolLUDecomposition(intindex[4],float&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.

     voidLUBackSubstitution(intindex[4],floatb[4])const
          Perform back-substitution on LU-decomposed matrix. Index is permutation of rows from original matrix.

     SbMatrixtranspose()const
          Returns transpose of matrix.

     SbMatrix&multRight(constSbMatrix&m)SbMatrix&multLeft(constSbMatrix&m)
          Multiplies matrix by given matrix on right or left.

     voidmultMatrixVec(constSbVec3f&src,SbVec3f&dst)const
          Multiplies matrix by given column vector, giving vector result.

     voidmultVecMatrix(constSbVec3f&src,SbVec3f&dst)const
          Multiplies given row vector by matrix, giving vector result.

     voidmultDirMatrix(constSbVec3f&src,SbVec3f&dst)const
          Multiplies given row vector by matrix, giving vector result. 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.

     voidmultLineMatrix(constSbLine&src,SbLine&dst)const
          Multiplies the given line's origin by the matrix, and the line's direction by the rotation portion  of
          the matrix.

     voidprint(FILE*fp)const
          Prints a formatted version of the matrix to the given file pointer.

     float*operatorfloat*()
          Cast: returns pointer to storage of first element.

     SbMatoperatorSbMat&()
          Cast: returns reference to 4x4 array.

     float*operator[](inti)constfloat*operator[](inti)const
          Make it look like a usual matrix (so you can do m[3][2]).

     SbMatrix&operator=(constSbMat&m)
          Sets value from 4x4 array of elements.

     SbMatrix&operator=(constSbMatrix&m)
          Set the matrix from another SbMatrix.

     SbMatrix&operator=(constSbRotation&q)
          Set the matrix from an SbRotation.

     SbMatrix&operator*=(constSbMatrix&m)
          Performs right multiplication with another matrix.

     SbMatrixoperator*(constSbMatrix&m1,constSbMatrix&m2)
          Binary multiplication of matrices.

     intoperator==(constSbMatrix&m1,constSbMatrix&m2)intoperator!=(constSbMatrix&m1,constSbMatrix&m2)
          Equality comparison operators.

     SbBoolequals(constSbMatrix&m,floattolerance)const
          Equality comparison within given tolerance, for each component.

Name

       SbMatrix — 4x4 matrix class

See Also

SbVec3f,SbRotationSbMatrix(3IV)()

Synopsis

#include<Inventor/SbLinear.h>

          Methods from class SbMatrix:

                         SbMatrix()SbMatrix(floata11,floata12,floata13,floata14,floata21,floata22,floata23,floata24,floata31,floata32,floata33,floata34,floata41,floata42,floata43,floata44)SbMatrix(constSbMat&m)voidsetValue(constSbMat&m)voidgetValue(SbMat&m)constconstSbMat&getValue()constvoidmakeIdentity()staticSbMatrixidentity()voidsetRotate(constSbRotation&q)voidsetScale(floats)voidsetScale(constSbVec3f&s)voidsetTranslate(constSbVec3f&t)voidsetTransform(constSbVec3f&t,constSbRotation&r,constSbVec3f&s)voidsetTransform(constSbVec3f&t,constSbRotation&r,constSbVec3f&s,constSbRotation&so)voidsetTransform(constSbVec3f&translation,constSbRotation&rotation,constSbVec3f&scaleFactor,constSbRotation&scaleOrientation,constSbVec3f&center)voidgetTransform(SbVec3f&t,SbRotation&r,SbVec3f&s,SbRotation&so)constvoidgetTransform(SbVec3f&translation,SbRotation&rotation,SbVec3f&scaleFactor,SbRotation&scaleOrientation,constSbVec3f&center)constfloatdet3(intr1,intr2,intr3,intc1,intc2,intc3)constfloatdet3()constfloatdet4()constSbBoolfactor(SbMatrix&r,SbVec3f&s,SbMatrix&u,SbVec3f&t,SbMatrix&proj)constSbMatrixinverse()constSbBoolLUDecomposition(intindex[4],float&d)voidLUBackSubstitution(intindex[4],floatb[4])constSbMatrixtranspose()constSbMatrix&multRight(constSbMatrix&m)SbMatrix&multLeft(constSbMatrix&m)voidmultMatrixVec(constSbVec3f&src,SbVec3f&dst)constvoidmultVecMatrix(constSbVec3f&src,SbVec3f&dst)constvoidmultDirMatrix(constSbVec3f&src,SbVec3f&dst)constvoidmultLineMatrix(constSbLine&src,SbLine&dst)constvoidprint(FILE*fp)constfloat*operatorfloat*()SbMatoperatorSbMat&()float*operator[](inti)constfloat*operator[](inti)constSbMatrix&operator=(constSbMat&m)SbMatrix&operator=(constSbMatrix&m)SbMatrix&operator=(constSbRotation&q)SbMatrix&operator*=(constSbMatrix&m)SbMatrixoperator*(constSbMatrix&m1,constSbMatrix&m2)intoperator==(constSbMatrix&m1,constSbMatrix&m2)intoperator!=(constSbMatrix&m1,constSbMatrix&m2)SbBoolequals(constSbMatrix&m,floattolerance)const

See Also