SbMatrix(3IV)

SbMatrix (SbMx) - 4x4 matrix class

Showing IRIX 6.5.30 (default release). Added in IRIX 6.5.22.

NAME
     SbMatrix (SbMx) - 4x4 matrix class

INHERITS FROM
     SbMatrix

SYNOPSIS
     #include <Inventor_c/SbLinear.h>

     typedef SbMatrix    SbMx

          Functions from class SbMatrix:

     void                SbMxMakeIdent(SbMx *this)
     SbMatrix            SbMxIdent()
     void                SbMxSetRot(SbMx *this, const SbRotation *q)
     void                SbMxSetScale(SbMx *this, float s)
     void                SbMxScaleVec(SbMx *this, const SbVec3f *s)
     void                SbMxSetXlate(SbMx *this, const SbVec3f *t)
     void                SbMxSetXform(SbMx *this, const SbVec3f *translation,
                              const SbRotation *rotation, const SbVec3f
                              *scaleFactor, const SbRotation
                              *scaleOrientation, const SbVec3f *center)
     void                SbMxGetXform(const SbMx *this, SbVec3f *translation,
                              SbRotation *rotation, SbVec3f *scaleFactor,
                              SbRotation *scaleOrientation, const SbVec3f
                              *center)
     float               SbMxDet3Mx(const SbMx *this, int r1, int r2, int r3,
                              int c1, int c2, int c3)
     float               SbMxDet3(const SbMx *this)
     float               SbMxDet4(const SbMx *this)
     SbBool              SbMxFactor(const SbMx *this, SbMatrix *r, SbVec3f *s,
                              SbMatrix *u, SbVec3f *t, SbMatrix *proj)
     SbMatrix            SbMxInverse(const SbMx *this)
     SbBool              SbMxLUDecomp(SbMx *this, int index[4], float *d)
     void                SbMxLUBackSub(const SbMx *this, int index[4], float
                              b[4])
     SbMatrix            SbMxTranspose(const SbMx *this)
     SbMatrix *          SbMxMultRight(SbMx *this, const SbMatrix *m)
     SbMatrix *          SbMxMultLeft(SbMx *this, const SbMatrix *m)
     void                SbMxMultMxVec(const SbMx *this, const SbVec3f *src,
                              SbVec3f *dst)
     void                SbMxMultVecMx(const SbMx *this, const SbVec3f *src,
                              SbVec3f *dst)
     void                SbMxMultDirMx(const SbMx *this, const SbVec3f *src,
                              SbVec3f *dst)
     void                SbMxMultLineMx(const SbMx *this, const SbLine *src,
                              SbLine *dst)
     void                SbMxPrint(const SbMx *this, FILE *fp)
     SbMatrix *          SbMxCopy(SbMx *this, const SbMatrix *m)
     SbMatrix *          SbMxMultBy(SbMx *this, const SbMatrix *m)

     SbMatrix            SbMxMult(SbMx *this, const SbMatrix *m1, const
                              SbMatrix *m2)
     int                 SbMxIsEq(SbMx *this, const SbMatrix *m1, const
                              SbMatrix *m2)
     int                 SbMxIsNEq(SbMx *this, const SbMatrix *m1, const
                              SbMatrix *m2)
     SbBool              SbMxEquals(const SbMx *this, const SbMatrix *m, float
                              tolerance)


DESCRIPTION
     4x4 matrix class/datatype used by many Inventor node and action classes.
     The matrices are stored in row-major order.  Note that this class should
     be declared and/or malloc'd as an standard C struct:

               /* This is defined in Inventor_c/SbMatrix.h: */
               struct SbMatrix {
                    float mx[4][4];
               };
               typedef SbMatrix SbMx

               /* Your code should look like this: */
               SbMx  mx, mx_t;

               mx = SbMxIdent();
               mx.mx[0][0] = mx.mx[1][1] = mx.mx[2][2] = 3.0;
               mx_t = SbMxTranspose( &mx );




FUNCTIONS
     void                SbMxMakeIdent(SbMx *this)
          Sets matrix to be identity.

     SbMatrix            SbMxIdent()
          Returns an identity matrix.

     void                SbMxSetRot(SbMx *this, const SbRotation *q)
          Sets matrix to rotate by given rotation.

     void                SbMxSetScale(SbMx *this, float s)
          Sets matrix to scale by given uniform factor.

     void                SbMxScaleVec(SbMx *this, const SbVec3f *s)
          Sets matrix to scale by given vector.

     void                SbMxSetXlate(SbMx *this, const SbVec3f *t)
          Sets matrix to translate by given vector.

     void                SbMxSetXform(SbMx *this, const SbVec3f *translation,
                              const SbRotation *rotation, const SbVec3f
                              *scaleFactor, const SbRotation
                              *scaleOrientation, const SbVec3f *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.

     void                SbMxGetXform(const SbMx *this, SbVec3f *translation,
                              SbRotation *rotation, SbVec3f *scaleFactor,
                              SbRotation *scaleOrientation, const SbVec3f
                              *center)
          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.

     float               SbMxDet3Mx(const SbMx *this, int r1, int r2, int r3,
                              int c1, int c2, int c3)
          Returns determinant of 3x3 submatrix composed of given row and
          column indices (0-3 for each).

     float               SbMxDet3(const SbMx *this)
          Returns determinant of upper-left 3x3 submatrix.

     float               SbMxDet4(const SbMx *this)
          Returns determinant of entire matrix.

     SbBool              SbMxFactor(const SbMx *this, SbMatrix *r, SbVec3f *s,
                              SbMatrix *u, SbVec3f *t, SbMatrix *proj)
          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.

     SbMatrix            SbMxInverse(const SbMx *this)
          Returns inverse of matrix. Results are undefined for singular
          matrices. Uses LU decomposition.

     SbBool              SbMxLUDecomp(SbMx *this, int index[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.

     void                SbMxLUBackSub(const SbMx *this, int index[4], float
                              b[4])
          Perform back-substitution on LU-decomposed matrix. Index is
          permutation of rows from original matrix.

     SbMatrix            SbMxTranspose(const SbMx *this)
          Returns transpose of matrix.
     SbMatrix *          SbMxMultRight(SbMx *this, const SbMatrix *m)
     SbMatrix *          SbMxMultLeft(SbMx *this, const SbMatrix *m)
          Multiplies matrix by given matrix on right or left.

     void                SbMxMultMxVec(const SbMx *this, const SbVec3f *src,
                              SbVec3f *dst)
          Multiplies matrix by given column vector, giving vector result.

     void                SbMxMultVecMx(const SbMx *this, const SbVec3f *src,
                              SbVec3f *dst)
          Multiplies given row vector by matrix, giving vector result.

     void                SbMxMultDirMx(const SbMx *this, const SbVec3f *src,
                              SbVec3f *dst)
          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  SbMxMultVecMatrix() for the points and call
          SbMxMultDirMatrix() on the inverse transpose of the matrix for the
          normals.

     void                SbMxMultLineMx(const SbMx *this, const SbLine *src,
                              SbLine *dst)
          Multiplies the given line's origin by the matrix, and the line's
          direction by the rotation portion of the matrix.

     void                SbMxPrint(const SbMx *this, FILE *fp)
          Prints a formatted version of the matrix to the given file pointer.

     SbMatrix *          SbMxCopy(SbMx *this, const SbMatrix *m)
          Set the matrix from another SbMatrix.

     SbMatrix *          SbMxMultBy(SbMx *this, const SbMatrix *m)
          Performs right multiplication with another matrix.

     SbMatrix            SbMxMult(SbMx *this, const SbMatrix *m1, const
                              SbMatrix *m2)
          Binary multiplication of matrices.

     int                 SbMxIsEq(SbMx *this, const SbMatrix *m1, const
                              SbMatrix *m2)
     int                 SbMxIsNEq(SbMx *this, const SbMatrix *m1, const
                              SbMatrix *m2)
          Equality comparison operators.

     SbBool              SbMxEquals(const SbMx *this, const SbMatrix *m, float
                              tolerance)
          Equality comparison within given tolerance, for each component.

FILE FORMAT/DEFAULTS
     Matrix {
     }

SEE ALSO
     SbVec3f, SbRotation