Open Inventor Release 2024.1.1
 
Loading...
Searching...
No Matches
SbMatrix.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2024 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23#ifndef _SB_MATRIX_
24#define _SB_MATRIX_
25
26#include <Inventor/SbBase.h>
27#include <Inventor/STL/iostream>
28#include <Inventor/SbVec.h>
29#include <string.h>
30
31class SbLine;
32class SbLined;
33class SbRotation;
34class SbRotationd;
35class SbMatrixd;
36
37typedef float SbMat[4][4];
38typedef float SbMat3[3][3];
39typedef double SbMatd[4][4];
40
42//
43// Class: SbMatrix
44//
45// 4x4 matrix of floating-point elements.
46//
48
49
50
309class SbMatrix {
310public:
311
315 SbMatrix() { memset(matrix, 0, sizeof(SbMat)); }
316
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);
324
328 SbMatrix(const SbMat &m);
329
333 void setValue(const SbMat &m);
334
339 void setValue(const float *pMat)
340 {
341 matrix[0][0] = *pMat++ ;
342 matrix[0][1] = *pMat++ ;
343 matrix[0][2] = *pMat++ ;
344 matrix[0][3] = *pMat++ ;
345
346 matrix[1][0] = *pMat++ ;
347 matrix[1][1] = *pMat++ ;
348 matrix[1][2] = *pMat++ ;
349 matrix[1][3] = *pMat++ ;
350
351 matrix[2][0] = *pMat++ ;
352 matrix[2][1] = *pMat++ ;
353 matrix[2][2] = *pMat++ ;
354 matrix[2][3] = *pMat++ ;
355
356 matrix[3][0] = *pMat++ ;
357 matrix[3][1] = *pMat++ ;
358 matrix[3][2] = *pMat++ ;
359 matrix[3][3] = *pMat++ ;
360 } ;
361
365 void setValue(const SbMatrixd &md) ;
366
367public:
368
373
378
382 void setRotate(const SbRotation &q);
383
387 void setScale(float s);
388
392 void setScale(const SbVec3f &s);
393
397 void setTranslate(const SbVec3f &t);
398
404 void setTransform(const SbVec3f &translation,
405 const SbRotation &rotation,
406 const SbVec3f &scaleFactor,
407 const SbRotation &scaleOrientation,
408 const SbVec3f &center);
409
414 void setTransform(const SbVec3f &t, const SbRotation &r, const SbVec3f &s);
415
421 void setTransform(const SbVec3f &t, const SbRotation &r,
422 const SbVec3f &s, const SbRotation &so);
423
433 void getTransform(SbVec3f &translation,
434 SbRotation &rotation,
435 SbVec3f &scaleFactor,
436 SbRotation &scaleOrientation,
437 const SbVec3f &center) const;
438
445 SbVec3f &s, SbRotation &so) const;
446
447 // The following methods return matrix values and other info:
448
452 void getValue(SbMat &m) const;
453
454#ifdef _WIN32
458 SbMat &getValue() { SbMat &rMat = matrix; return rMat; }
459#endif
460
464 const SbMat &getValue() const { return matrix; }
465
470 float det3(int r1, int r2, int r3, int c1, int c2, int c3) const;
471
475 float det3() const { return det3(0, 1, 2, 0, 1, 2); }
476
480 float det4() const;
481
489 SbVec3f &t, SbMatrix &proj) const;
490
497
499 void translate(const SbVec3f& translation);
500
502 void scale(const SbVec3f& scaleFactor);
503
508 SbBool LUDecomposition(int index[4], float &d);
509
514 void LUBackSubstitution(int index[4], float b[4]) const;
515
521
522
523 // The following methods provide Mx/mx and mx/vec arithmetic:
524
530
536
544 void multMatrixVec(const SbVec3f &src, SbVec3f &dst) const;
545
556 inline void multVecMatrix(const SbVec3f &src, SbVec3f &dst) const
557 {
558 float x,y,z,w;
559
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];
568
569 w = 1.f/w;
570 dst.setValue(x*w, y*w, z*w);
571 }
572
578 void multMatrixVec(const SbVec3f &src, SbVec4f &dst) const;
579
586 void multVecMatrix(const SbVec3f &src, SbVec4f &dst) const;
587
600 void multDirMatrix(const SbVec3f &src, SbVec3f &dst) const;
601
607 void multLineMatrix(const SbLine &src, SbLine &dst) const;
608
609
610 // The following methods are miscellaneous Mx functions:
611
615 void print(FILE *fp) const;
616
617
621 operator float *() { return &matrix[0][0]; }
622
626 operator SbMat &() { return matrix; }
627
631 float * operator [](int i) { return &matrix[i][0]; }
632
636 const float * operator [](int i) const { return &matrix[i][0]; }
637
641 SbMatrix & operator =(const SbMat &m);
642
647
651 SbMatrix & operator =(const SbRotation &q) { setRotate(q); return *this; }
652
657 SbMatrix & operator *=(const SbMatrix &m) { return multRight(m); }
658
664
669 friend SbVec4f operator *(const SbVec4f &v, const SbMatrix &m);
670
674 friend SbMatrix operator *(const SbMatrix &m1, const SbMatrix &m2);
675
679 friend int operator ==(const SbMatrix &m1, const SbMatrix &m2);
683 friend int operator !=(const SbMatrix &m1, const SbMatrix &m2)
684 { return !(m1 == m2); }
685
689 SbBool equals(const SbMatrix &m, float tolerance) const;
690
694 bool isInvertible() const;
695
696private:
700 void jacobi3(float evalues[3], SbVec3f evectors[3], int &rots) const;
701
702private:
703 // Storage for 4x4 matrix
704 SbMat matrix;
705
706 SbBool affine_inverse(const SbMatrix &in, SbMatrix &out) const;
707
708
709};
710
712//
713// Class: SbMatrixd
714//
715// 4x4 matrix of double precision floating-point elements.
716//
718
757public:
758
762 SbMatrixd() { memset(matrix, 0, sizeof(SbMatd)); }
763
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);
771
775 SbMatrixd(const SbMatd &m);
776
780 void setValue(const SbMatd &m);
781
786 void setValue(const double *pMat)
787 {
788 matrix[0][0] = *pMat++ ;
789 matrix[0][1] = *pMat++ ;
790 matrix[0][2] = *pMat++ ;
791 matrix[0][3] = *pMat++ ;
792
793 matrix[1][0] = *pMat++ ;
794 matrix[1][1] = *pMat++ ;
795 matrix[1][2] = *pMat++ ;
796 matrix[1][3] = *pMat++ ;
797
798 matrix[2][0] = *pMat++ ;
799 matrix[2][1] = *pMat++ ;
800 matrix[2][2] = *pMat++ ;
801 matrix[2][3] = *pMat++ ;
802
803 matrix[3][0] = *pMat++ ;
804 matrix[3][1] = *pMat++ ;
805 matrix[3][2] = *pMat++ ;
806 matrix[3][3] = *pMat++ ;
807 } ;
808
812 void setValue(const SbMatrix &m) ;
813
814public:
815
820
825
829 void setRotate(const SbRotationd &q);
830
834 void setScale(double s);
835
839 void setScale(const SbVec3d &s);
840
844 void setTranslate(const SbVec3d &t);
845
851 void setTransform(const SbVec3d &translation,
852 const SbRotationd &rotation,
853 const SbVec3d &scaleFactor,
854 const SbRotationd &scaleOrientation,
855 const SbVec3d &center);
856
861 void setTransform(const SbVec3d &t, const SbRotationd &r, const SbVec3d &s);
862
868 void setTransform(const SbVec3d &t, const SbRotationd &r,
869 const SbVec3d &s, const SbRotationd &so);
870
880 void getTransform(SbVec3d &translation,
881 SbRotationd &rotation,
882 SbVec3d &scaleFactor,
883 SbRotationd &scaleOrientation,
884 const SbVec3d &center) const;
885
892 SbVec3d &s, SbRotationd &so) const;
893
894
895 // The following methods return matrix values and other info:
896
900 void getValue(SbMatd &m) const;
901
902#ifdef _WIN32
903
907 SbMatd &getValue() { SbMatd &rMat = matrix; return rMat; }
908#endif
909
913 const SbMatd &getValue() const { return matrix; }
914
919 double det3(int r1, int r2, int r3, int c1, int c2, int c3) const;
920
924 double det3() const { return det3(0, 1, 2, 0, 1, 2); }
925
929 double det4() const;
930
938 SbVec3d &t, SbMatrixd &proj) const;
939
946
948 void translate(const SbVec3d& translation);
949
951 void scale(const SbVec3d& scaleFactor);
952
957 SbBool LUDecomposition(int index[4], double &d);
958
963 void LUBackSubstitution(int index[4], double b[4]) const;
964
970
971
972 // The following methods provide Mx/mx and mx/vec arithmetic:
973
979
985
993 void multMatrixVec(const SbVec3d &src, SbVec3d &dst) const;
994
1005 void multVecMatrix(const SbVec3d &src, SbVec3d &dst) const;
1006
1016 void multVecMatrix( const SbVec3d& src, SbVec4d& dst ) const;
1017
1030 void multDirMatrix(const SbVec3d &src, SbVec3d &dst) const;
1031
1037 void multLineMatrix(const SbLined &src, SbLined &dst) const;
1038
1044
1045
1046 // The following methods are miscellaneous Mx functions:
1047
1051 void print(FILE *fp) const;
1052
1053
1057 operator double *() { return &matrix[0][0]; }
1058
1062 operator SbMatd &() { return matrix; }
1063
1067 double * operator [](int i) { return &matrix[i][0]; }
1068
1072 const double * operator [](int i) const { return &matrix[i][0]; }
1073
1077 SbMatrixd & operator =(const SbMatd &m);
1078
1083
1087 SbMatrixd & operator =(const SbRotationd &q) { setRotate(q); return *this; }
1088
1093 SbMatrixd & operator *=(const SbMatrixd &m) { return multRight(m); }
1094
1099 friend SbVec4d operator *(const SbVec4d &v, const SbMatrixd &m);
1100
1104 friend SbMatrixd operator *(const SbMatrixd &m1, const SbMatrixd &m2);
1105
1109 friend int operator ==(const SbMatrixd &m1, const SbMatrixd &m2);
1113 friend int operator !=(const SbMatrixd &m1, const SbMatrixd &m2)
1114 { return !(m1 == m2); }
1115
1119 SbBool equals(const SbMatrixd &m, double tolerance) const;
1120
1124 bool isInvertible() const;
1125
1126private:
1127
1131 void jacobi3(double evalues[3], SbVec3d evectors[3], int &rots) const;
1132
1133private:
1134 // Storage for 4x4 matrix
1135 SbMatd matrix;
1136
1137 SbBool affine_inverse(const SbMatrixd &in, SbMatrixd &out) const;
1138
1139
1140};
1141
1143//
1144// Class: SbMatrix3
1145//
1146// 3x3 matrix of floating-point elements.
1147//
1149
1150
1151
1187public:
1188
1192 SbMatrix3() { memset(matrix, 0, sizeof(SbMat3)); }
1193
1197 SbMatrix3(float a11, float a12, float a13,
1198 float a21, float a22, float a23,
1199 float a31, float a32, float a33);
1200
1204 SbMatrix3(const SbMat3 &m);
1205
1209 void setValue(const SbMat3 &m);
1210
1215 void setValue(const float *pMat)
1216 {
1217 matrix[0][0] = *pMat++ ;
1218 matrix[0][1] = *pMat++ ;
1219 matrix[0][2] = *pMat++ ;
1220
1221 matrix[1][0] = *pMat++ ;
1222 matrix[1][1] = *pMat++ ;
1223 matrix[1][2] = *pMat++ ;
1224
1225 matrix[2][0] = *pMat++ ;
1226 matrix[2][1] = *pMat++ ;
1227 matrix[2][2] = *pMat++ ;
1228 } ;
1229
1234
1239
1243 void setRotate(const SbRotation &q);
1244
1248 void setScale(float s);
1249
1253 void setScale(const SbVec3f &s);
1254
1258 void getValue(SbMat3 &m) const;
1259
1263 const SbMat3 &getValue() const { return matrix; }
1264
1270
1276
1281 void multMatrixVec(const SbVec3f &src, SbVec3f &dst) const;
1282
1287 void multVecMatrix(const SbVec3f &src, SbVec3f &dst) const;
1288
1292 float det() const;
1293
1299
1303 void print(FILE *fp) const;
1304
1308 operator float *() { return &matrix[0][0]; }
1309
1313 operator SbMat3 &() { return matrix; }
1314
1318 float * operator [](int i) { return &matrix[i][0]; }
1319
1323 const float * operator [](int i) const { return &matrix[i][0]; }
1324
1329 SbVec3f operator *(const SbVec3f &v) const;
1330
1334 SbMatrix3 & operator =(const SbMat3 &m);
1335
1340
1344 SbMatrix3 & operator =(const SbRotation &q) { setRotate(q); return *this; }
1345
1350 SbMatrix3 & operator *=(const SbMatrix3 &m) { return multRight(m); }
1351
1356 friend SbVec3f operator *(const SbVec3f &v, const SbMatrix3 &m);
1357
1361 friend SbMatrix3 operator *(const SbMatrix3 &m1, const SbMatrix3 &m2);
1362
1366 friend int operator ==(const SbMatrix3 &m1, const SbMatrix3 &m2);
1370 friend int operator !=(const SbMatrix3 &m1, const SbMatrix3 &m2)
1371 { return !(m1 == m2); }
1372
1373private:
1374 SbMat3 matrix; // Storage for 3x3 matrix
1375};
1376
1377inline std::ostream& operator << (std::ostream& os, const SbMatrix& mat)
1378{
1379 for ( int j = 0; j < 4; j++ )
1380 {
1381 os << "[ ";
1382 for ( int i = 0; i < 4; i++ )
1383 os << mat[j][i] << " ";
1384 os << "]" << std::endl;
1385 }
1386 return os;
1387}
1388
1389inline std::ostream& operator << (std::ostream& os, const SbMatrix3& mat)
1390{
1391 for ( int j = 0; j < 3; j++ )
1392 {
1393 os << "[ ";
1394 for ( int i = 0; i < 3; i++ )
1395 os << mat[j][i] << " ";
1396 os << "]" << std::endl;
1397 }
1398 return os;
1399}
1400
1401#endif /* _SB_MATRIX_ */
1402
1403
Directed line in 3D.
Definition SbLine.h:57
Directed line in 3D (double precision).
Definition SbLine.h:182
3x3 matrix class.
Definition SbMatrix.h:1186
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).
Definition SbMatrix.h:1350
float * operator[](int i)
Make it look like a usual matrix (so you can do m[2][2]).
Definition SbMatrix.h:1318
SbMatrix3()
Default constructor.
Definition SbMatrix.h:1192
friend int operator!=(const SbMatrix3 &m1, const SbMatrix3 &m2)
Inequality comparison operator.
Definition SbMatrix.h:1370
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.
Definition SbMatrix.h:1263
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.
Definition SbMatrix.h:1215
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.
4x4 matrix class.
Definition SbMatrix.h:309
friend int operator!=(const SbMatrix &m1, const SbMatrix &m2)
Inequality comparison operator.
Definition SbMatrix.h:683
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).
Definition SbMatrix.h:657
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.
Definition SbMatrix.h:475
SbMatrix()
Default constructor.
Definition SbMatrix.h:315
void getTransform(SbVec3f &translation, SbRotation &rotation, SbVec3f &scaleFactor, SbRotation &scaleOrientation, const SbVec3f &center) 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.
Definition SbMatrix.h:339
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.
Definition SbMatrix.h:464
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 &center)
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.
Definition SbMatrix.h:556
float * operator[](int i)
Make it look like a usual matrix (so you can do m[3][2]).
Definition SbMatrix.h:631
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...
Definition SbMatrix.h:756
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]).
Definition SbMatrix.h:1067
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.
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).
Definition SbMatrix.h:1093
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.
Definition SbMatrix.h:924
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,...
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.
Definition SbMatrix.h:913
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.
Definition SbMatrix.h:1113
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.
Definition SbMatrix.h:762
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.
Definition SbMatrix.h:786
Class for representing a rotation.
Definition SbRotation.h:126
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Class for repres...
Definition SbRotation.h:425
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 3D vector class ...
Definition SbVec.h:1214
3D vector class.
Definition SbVec.h:932
SbVec3f & setValue(const float v[3])
Sets the vector components.
Definition SbVec.h:1010
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 4D vector class ...
Definition SbVec.h:2427
4D vector class.
Definition SbVec.h:2214
int SbBool
Boolean type.
Definition SbBase.h:87