26#include <Inventor/SbBase.h>
27#include <Inventor/STL/iostream>
28#include <Inventor/SbVec.h>
37typedef float SbMat[4][4];
38typedef float SbMat3[3][3];
39typedef double SbMatd[4][4];
320 SbMatrix(
float a11,
float a12,
float a13,
float a14,
321 float a21,
float a22,
float a23,
float a24,
322 float a31,
float a32,
float a33,
float a34,
323 float a41,
float a42,
float a43,
float a44);
341 matrix[0][0] = *pMat++ ;
342 matrix[0][1] = *pMat++ ;
343 matrix[0][2] = *pMat++ ;
344 matrix[0][3] = *pMat++ ;
346 matrix[1][0] = *pMat++ ;
347 matrix[1][1] = *pMat++ ;
348 matrix[1][2] = *pMat++ ;
349 matrix[1][3] = *pMat++ ;
351 matrix[2][0] = *pMat++ ;
352 matrix[2][1] = *pMat++ ;
353 matrix[2][2] = *pMat++ ;
354 matrix[2][3] = *pMat++ ;
356 matrix[3][0] = *pMat++ ;
357 matrix[3][1] = *pMat++ ;
358 matrix[3][2] = *pMat++ ;
359 matrix[3][3] = *pMat++ ;
458 SbMat &
getValue() { SbMat &rMat = matrix;
return rMat; }
470 float det3(
int r1,
int r2,
int r3,
int c1,
int c2,
int c3)
const;
475 float det3()
const {
return det3(0, 1, 2, 0, 1, 2); }
560 x = src[0]*matrix[0][0] + src[1]*matrix[1][0] +
561 src[2]*matrix[2][0] + matrix[3][0];
562 y = src[0]*matrix[0][1] + src[1]*matrix[1][1] +
563 src[2]*matrix[2][1] + matrix[3][1];
564 z = src[0]*matrix[0][2] + src[1]*matrix[1][2] +
565 src[2]*matrix[2][2] + matrix[3][2];
566 w = src[0]*matrix[0][3] + src[1]*matrix[1][3] +
567 src[2]*matrix[2][3] + matrix[3][3];
621 operator float *() {
return &matrix[0][0]; }
626 operator SbMat &() {
return matrix; }
684 {
return !(m1 == m2); }
700 void jacobi3(
float evalues[3],
SbVec3f evectors[3],
int &rots)
const;
767 SbMatrixd(
double a11,
double a12,
double a13,
double a14,
768 double a21,
double a22,
double a23,
double a24,
769 double a31,
double a32,
double a33,
double a34,
770 double a41,
double a42,
double a43,
double a44);
788 matrix[0][0] = *pMat++ ;
789 matrix[0][1] = *pMat++ ;
790 matrix[0][2] = *pMat++ ;
791 matrix[0][3] = *pMat++ ;
793 matrix[1][0] = *pMat++ ;
794 matrix[1][1] = *pMat++ ;
795 matrix[1][2] = *pMat++ ;
796 matrix[1][3] = *pMat++ ;
798 matrix[2][0] = *pMat++ ;
799 matrix[2][1] = *pMat++ ;
800 matrix[2][2] = *pMat++ ;
801 matrix[2][3] = *pMat++ ;
803 matrix[3][0] = *pMat++ ;
804 matrix[3][1] = *pMat++ ;
805 matrix[3][2] = *pMat++ ;
806 matrix[3][3] = *pMat++ ;
907 SbMatd &
getValue() { SbMatd &rMat = matrix;
return rMat; }
919 double det3(
int r1,
int r2,
int r3,
int c1,
int c2,
int c3)
const;
924 double det3()
const {
return det3(0, 1, 2, 0, 1, 2); }
1057 operator double *() {
return &matrix[0][0]; }
1062 operator SbMatd &() {
return matrix; }
1114 {
return !(m1 == m2); }
1131 void jacobi3(
double evalues[3],
SbVec3d evectors[3],
int &rots)
const;
1198 float a21,
float a22,
float a23,
1199 float a31,
float a32,
float a33);
1217 matrix[0][0] = *pMat++ ;
1218 matrix[0][1] = *pMat++ ;
1219 matrix[0][2] = *pMat++ ;
1221 matrix[1][0] = *pMat++ ;
1222 matrix[1][1] = *pMat++ ;
1223 matrix[1][2] = *pMat++ ;
1225 matrix[2][0] = *pMat++ ;
1226 matrix[2][1] = *pMat++ ;
1227 matrix[2][2] = *pMat++ ;
1308 operator float *() {
return &matrix[0][0]; }
1313 operator SbMat3 &() {
return matrix; }
1371 {
return !(m1 == m2); }
1377inline std::ostream& operator << (std::ostream& os,
const SbMatrix& mat)
1379 for (
int j = 0; j < 4; j++ )
1382 for (
int i = 0; i < 4; i++ )
1383 os << mat[j][i] <<
" ";
1384 os <<
"]" << std::endl;
1389inline std::ostream& operator << (std::ostream& os,
const SbMatrix3& mat)
1391 for (
int j = 0; j < 3; j++ )
1394 for (
int i = 0; i < 3; i++ )
1395 os << mat[j][i] <<
" ";
1396 os <<
"]" << std::endl;
Directed line in 3D (double precision).
float det() const
Returns the determinant of the matrix.
SbMatrix3 & operator=(const SbMat3 &m)
Sets value from 3x3 array of elements.
void multMatrixVec(const SbVec3f &src, SbVec3f &dst) const
Post-multiplies matrix by the given column vector, giving a 3D vector result.
SbMatrix3 & operator*=(const SbMatrix3 &m)
Post-multiplies the matrix by the given matrix (equivalent to multRight() method).
float * operator[](int i)
Make it look like a usual matrix (so you can do m[2][2]).
SbMatrix3()
Default constructor.
friend int operator!=(const SbMatrix3 &m1, const SbMatrix3 &m2)
Inequality comparison operator.
SbMatrix3(float a11, float a12, float a13, float a21, float a22, float a23, float a31, float a32, float a33)
Constructor.
void multVecMatrix(const SbVec3f &src, SbVec3f &dst) const
Pre-multiplies matrix by the given row vector, giving a 3D vector result.
void setScale(float s)
Sets matrix to scale by given uniform factor.
friend SbVec3f operator*(const SbVec3f &v, const SbMatrix3 &m)
Multiplies matrices by vector, returning a vector result.
const SbMat3 & getValue() const
Returns 3x3 array of elements.
SbMatrix3(const SbMat3 &m)
Constructor.
void print(FILE *fp) const
Prints a formatted version of the matrix to the given file pointer.
static SbMatrix3 identity()
Returns an identity matrix.
SbMatrix3 & multLeft(const SbMatrix3 &m)
Pre-multiplies matrix by the given matrix.
void makeIdentity()
Sets matrix to be identity.
SbMatrix3 & multRight(const SbMatrix3 &m)
Post-multiplies the matrix by the given matrix.
void setRotate(const SbRotation &q)
Sets matrix to rotate by given rotation.
void setScale(const SbVec3f &s)
Sets matrix to scale by given vector.
void getValue(SbMat3 &m) const
Returns 3x3 array of elements.
void setValue(const float *pMat)
Sets value from a 9 value float array.
SbMatrix3 inverse() const
Returns the inverse of the matrix.
void setValue(const SbMat3 &m)
Sets value from 3x3 array of elements.
friend int operator==(const SbMatrix3 &m1, const SbMatrix3 &m2)
Equality comparison operator.
friend int operator!=(const SbMatrix &m1, const SbMatrix &m2)
Inequality comparison operator.
SbBool equals(const SbMatrix &m, float tolerance) const
Equality comparison within given tolerance, for each component.
SbMatrix(float a11, float a12, float a13, float a14, float a21, float a22, float a23, float a24, float a31, float a32, float a33, float a34, float a41, float a42, float a43, float a44)
Constructor.
void LUBackSubstitution(int index[4], float b[4]) const
Perform back-substitution on LU-decomposed matrix.
void setScale(const SbVec3f &s)
Sets matrix to scale by given vector.
void multLineMatrix(const SbLine &src, SbLine &dst) const
Multiplies the given line's origin by the matrix, and the line's direction by the rotation portion of...
SbMatrix & operator*=(const SbMatrix &m)
Post-multiplies the matrix by the given matrix (equivalent to multRight() method).
friend SbVec4f operator*(const SbVec4f &v, const SbMatrix &m)
Multiplies matrices by vector, returning a vector result.
void multVecMatrix(const SbVec3f &src, SbVec4f &dst) const
Pre-multiplies matrix by the given row vector, giving vector result in homogeneous coordinates.
SbBool factor(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 rota...
void setTransform(const SbVec3f &t, const SbRotation &r, const SbVec3f &s, const SbRotation &so)
Composes the matrix based on a translation, rotation, scale, and orientation for scale.
SbBool LUDecomposition(int index[4], float &d)
Perform in-place LU decomposition of matrix.
float det4() const
Returns determinant of entire matrix.
float det3() const
Returns determinant of upper-left 3x3 submatrix.
SbMatrix()
Default constructor.
void getTransform(SbVec3f &translation, SbRotation &rotation, SbVec3f &scaleFactor, SbRotation &scaleOrientation, const SbVec3f ¢er) const
Decomposes the matrix into a translation, rotation, scale, and scale orientation.
void getTransform(SbVec3f &t, SbRotation &r, SbVec3f &s, SbRotation &so) const
Returns the translation, rotation, scale, and scale orientation components of the matrix.
void setValue(const float *pMat)
Sets matrix from a 16 value float array.
void setValue(const SbMatrixd &md)
Sets value from a double precision matrix.
void scale(const SbVec3f &scaleFactor)
Scales this matrice by the given vector.
void print(FILE *fp) const
Prints a formatted version of the matrix to the given file pointer.
static SbMatrix identity()
Returns an identity matrix.
void setValue(const SbMat &m)
Sets matrix from a 4x4 array of elements.
void setScale(float s)
Sets matrix to scale by given uniform factor.
void multDirMatrix(const SbVec3f &src, SbVec3f &dst) const
Pre-multiplies the matrix by the given row vector, giving vector result.
const SbMat & getValue() const
Returns matrix as a 4x4 array of elements.
bool isInvertible() const
Returns true if the matrix is invertible.
SbMatrix & multRight(const SbMatrix &m)
Post-multiplies the matrix by the given matrix.
void setTranslate(const SbVec3f &t)
Sets matrix to translate by given vector.
SbMatrix & multLeft(const SbMatrix &m)
Pre-multiplies matrix by the given matrix.
void setTransform(const SbVec3f &translation, const SbRotation &rotation, const SbVec3f &scaleFactor, const SbRotation &scaleOrientation, const SbVec3f ¢er)
Composes the matrix based on a translation, rotation, scale, orientation for scale,...
float 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).
void makeIdentity()
Sets matrix to be identity.
void setTransform(const SbVec3f &t, const SbRotation &r, const SbVec3f &s)
Composes the matrix based on a translation, rotation, and scale.
SbMatrix & operator=(const SbMat &m)
Sets value from 4x4 array of elements.
friend int operator==(const SbMatrix &m1, const SbMatrix &m2)
Equality comparison operator.
SbMatrix transpose() const
Returns transpose of matrix.
void multVecMatrix(const SbVec3f &src, SbVec3f &dst) const
Pre-multiplies matrix by the given row vector, giving a 3D vector result.
float * operator[](int i)
Make it look like a usual matrix (so you can do m[3][2]).
void setRotate(const SbRotation &q)
Sets matrix to rotate by given rotation.
SbMatrix(const SbMat &m)
Constructor.
void multMatrixVec(const SbVec3f &src, SbVec3f &dst) const
Post-multiplies matrix by the given column vector, giving a 3D vector result.
void multMatrixVec(const SbVec3f &src, SbVec4f &dst) const
Posts-multiplies matrix by the given column vector, giving vector result in homogeneous coordinates.
SbMatrix inverse() const
Returns inverse of matrix.
void getValue(SbMat &m) const
Returns matrix as a 4x4 array of elements.
void translate(const SbVec3f &translation)
Translates this matrice by the given vector.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 4x4 matrix class...
void multDirMatrix(const SbVec3d &src, SbVec3d &dst) const
Pre-multiplies the matrix by the given row vector, giving vector result.
SbMatrixd & operator=(const SbMatd &m)
Sets value from 4x4 array of elements.
void LUBackSubstitution(int index[4], double b[4]) const
Perform back-substitution on LU-decomposed matrix.
SbMatrixd(const SbMatd &m)
Constructor.
double * operator[](int i)
Make it look like a usual matrix (so you can do m[3][2]).
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.
SbBool 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 rota...
SbMatrixd & multLeft(const SbMatrixd &m)
Pre-multiplies the matrix by given matrix.
SbMatrixd & operator*=(const SbMatrixd &m)
Post-multiplies the matrix by the given matrix (equivalent to multRight() method).
void scale(const SbVec3d &scaleFactor)
Scales this matrice by the given vector.
SbMatrixd transpose() const
Returns transpose of matrix.
double det3() const
Returns determinant of upper-left 3x3 submatrix.
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,...
void setValue(const SbMatrix &m)
Sets values from a single precision matrix.
void getValue(SbMatd &m) const
Returns matrix as a 4x4 array of elements.
SbBool equals(const SbMatrixd &m, double tolerance) const
Equality comparison within given tolerance, for each component.
friend SbVec4d operator*(const SbVec4d &v, const SbMatrixd &m)
Multiplies matrices by vector, returning a vector result.
void setRotate(const SbRotationd &q)
Sets matrix to rotate by given rotation.
void multVecMatrix(const SbVec3d &src, SbVec3d &dst) const
Pre-multiplies matrix by the given row vector, giving a 3D vector result.
const SbMatd & getValue() const
Returns matrix as a 4x4 array of elements.
void makeIdentity()
Sets matrix to be identity.
SbBool LUDecomposition(int index[4], double &d)
Perform in-place LU decomposition of matrix.
void setScale(const SbVec3d &s)
Sets matrix to scale by given vector.
friend int operator!=(const SbMatrixd &m1, const SbMatrixd &m2)
Inequality comparison operator.
void setTransform(const SbVec3d &t, const SbRotationd &r, const SbVec3d &s)
Composes the matrix based on a translation, rotation, and scale.
void multVecMatrix(const SbVec3d &src, SbVec4d &dst) const
Pre-multiplies matrix by the given row vector, giving vector result in homogeneous coordinates.
static SbMatrixd identity()
Returns an identity matrix.
SbMatrixd()
Default constructor.
void translate(const SbVec3d &translation)
Translates this matrice by the given vector.
void setValue(const SbMatd &m)
Sets value from 4x4 array of elements.
bool isInvertible() const
Returns true if the matrix is invertible.
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...
friend int operator==(const SbMatrixd &m1, const SbMatrixd &m2)
Equality comparison operator.
void print(FILE *fp) const
Prints a formatted version of the matrix to the given file pointer.
void setScale(double s)
Sets matrix to scale by given uniform factor.
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.
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).
SbMatrixd inverse() const
Returns inverse of matrix.
double det4() const
Returns determinant of entire matrix.
void getTransform(SbVec3d &t, SbRotationd &r, SbVec3d &s, SbRotationd &so) const
Return translation, rotation, scale, and scale orientation components of the matrix.
void setTranslate(const SbVec3d &t)
Sets matrix to translate by given vector.
void 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.
SbMatrixd & multRight(const SbMatrixd &m)
Post-multiplies the matrix by given matrix.
void multMatrixVec(const SbVec3d &src, SbVec3d &dst) const
Post-multiplies matrix by given column vector, giving a 3D vector result.
void setValue(const double *pMat)
Sets value from a 16 value double array.
Class for representing a rotation.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Class for repres...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 3D vector class ...
SbVec3f & setValue(const float v[3])
Sets the vector components.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 4D vector class ...