1SbMatrix(3IV)() SbMatrix(3IV)()
2
3
4
6 SbMatrix — 4x4 matrix class
7
9 SbMatrix
10
12 #include <Inventor/SbLinear.h>
13
14 Methods from class SbMatrix:
15
16 SbMatrix()
17 SbMatrix(float a11, float a12, float a13, float a14,
18 float a21, float a22, float a23, float a24,
19 float a31, float a32, float a33, float a34,
20 float a41, float a42, float a43, float a44)
21 SbMatrix(const SbMat &m)
22 void setValue(const SbMat &m)
23 void getValue(SbMat &m) const
24 const SbMat & getValue() const
25 void makeIdentity()
26 static SbMatrix identity()
27 void setRotate(const SbRotation &q)
28 void setScale(float s)
29 void setScale(const SbVec3f &s)
30 void setTranslate(const SbVec3f &t)
31 void setTransform(const SbVec3f &t, const SbRotation &r,
32 const SbVec3f &s)
33 void setTransform(const SbVec3f &t, const SbRotation &r,
34 const SbVec3f &s, const SbRotation &so)
35 void setTransform(const SbVec3f &translation, const SbRo‐
36 tation &rotation, const SbVec3f &scaleFactor,
37 const SbRotation &scaleOrientation, const
38 SbVec3f ¢er)
39 void getTransform(SbVec3f &t, SbRotation &r, SbVec3f &s,
40 SbRotation &so) const
41 void getTransform(SbVec3f &translation, SbRotation &rota‐
42 tion, SbVec3f &scaleFactor, SbRotation &scale‐
43 Orientation, const SbVec3f ¢er) const
44 float det3(int r1, int r2, int r3, int c1, int c2, int c3)
45 const
46 float det3() const
47 float det4() const
48 SbBool factor(SbMatrix &r, SbVec3f &s, SbMatrix &u, SbVec3f
49 &t, SbMatrix &proj) const
50 SbMatrix inverse() const
51 SbBool LUDecomposition(int index[4], float &d)
52 void LUBackSubstitution(int index[4], float b[4]) const
53 SbMatrix transpose() const
54 SbMatrix & multRight(const SbMatrix &m)
55 SbMatrix & multLeft(const SbMatrix &m)
56 void multMatrixVec(const SbVec3f &src, SbVec3f &dst) const
57 void multVecMatrix(const SbVec3f &src, SbVec3f &dst) const
58 void multDirMatrix(const SbVec3f &src, SbVec3f &dst) const
59 void multLineMatrix(const SbLine &src, SbLine &dst) const
60 void print(FILE *fp) const
61 float * operator float*()
62 SbMat operator SbMat&()
63 float * operator [](int i)
64 const float * operator [](int i) const
65 SbMatrix & operator =(const SbMat &m)
66 SbMatrix & operator =(const SbMatrix &m)
67 SbMatrix & operator =(const SbRotation &q)
68 SbMatrix & operator *=(const SbMatrix &m)
69 SbMatrix operator *(const SbMatrix &m1, const SbMatrix &m2)
70 int operator ==(const SbMatrix &m1, const SbMatrix &m2)
71 int operator !=(const SbMatrix &m1, const SbMatrix &m2)
72 SbBool equals(const SbMatrix &m, float tolerance) const
73
74
76 4x4 matrix class/datatype used by many Inventor node and action
77 classes. The matrices are stored in row-major order.
78
80 SbMatrix()
81 SbMatrix(float a11, float a12, float a13, float a14,
82 float a21, float a22, float a23, float a24,
83 float a31, float a32, float a33, float a34,
84 float a41, float a42, float a43, float a44)
85 SbMatrix(const SbMat &m)
86 Constructors.
87
88 void setValue(const SbMat &m)
89 Sets value from 4x4 array of elements.
90
91 void getValue(SbMat &m) const
92 const SbMat & getValue() const
93 Returns 4x4 array of elements.
94
95 void makeIdentity()
96 Sets matrix to be identity.
97
98 static SbMatrix identity()
99 Returns an identity matrix.
100
101 void setRotate(const SbRotation &q)
102 Sets matrix to rotate by given rotation.
103
104 void setScale(float s)
105 Sets matrix to scale by given uniform factor.
106
107 void setScale(const SbVec3f &s)
108 Sets matrix to scale by given vector.
109
110 void setTranslate(const SbVec3f &t)
111 Sets matrix to translate by given vector.
112
113 void setTransform(const SbVec3f &t, const SbRotation &r,
114 const SbVec3f &s)
115 void setTransform(const SbVec3f &t, const SbRotation &r,
116 const SbVec3f &s, const SbRotation &so)
117 void setTransform(const SbVec3f &translation, const SbRo‐
118 tation &rotation, const SbVec3f &scaleFactor,
119 const SbRotation &scaleOrientation, const
120 SbVec3f ¢er)
121 Composes the matrix based on a translation, rotation, scale, orien‐
122 tation for scale, and center. The center is the center point for
123 scaling and rotation. The scaleOrientation chooses the primary axes
124 for the scale.
125
126 void getTransform(SbVec3f &t, SbRotation &r, SbVec3f &s,
127 SbRotation &so) const
128 Return translation, rotation, scale, and scale orientation compo‐
129 nents of the matrix.
130
131 void getTransform(SbVec3f &translation, SbRotation &rota‐
132 tion, SbVec3f &scaleFactor, SbRotation &scale‐
133 Orientation, const SbVec3f ¢er) const
134 Decomposes the matrix into a translation, rotation, scale, and scale
135 orientation. Any projection information is discarded. The decomposi‐
136 tion depends upon choice of center point for rotation and scaling,
137 which is optional as the last parameter. Note that if the center is
138 0, decompose() is the same as factor() where t is translation, u is
139 rotation, s is scaleFactor, and r is ScaleOrientation.
140
141 float det3(int r1, int r2, int r3, int c1, int c2, int c3)
142 const
143 Returns determinant of 3x3 submatrix composed of given row and col‐
144 umn indices (0-3 for each).
145
146 float det3() const
147 Returns determinant of upper-left 3x3 submatrix.
148
149 float det4() const
150 Returns determinant of entire matrix.
151
152 SbBool factor(SbMatrix &r, SbVec3f &s, SbMatrix &u, SbVec3f
153 &t, SbMatrix &proj) const
154 Factors a matrix m into 5 pieces: m = r s r^ u t, where r^ means
155 transpose of r, and r and u are rotations, s is a scale, and t is a
156 translation. Any projection information is returned in proj. NOTE:
157 the projection matrix is always set to identity.
158
159 SbMatrix inverse() const
160 Returns inverse of matrix. Results are undefined for singular matri‐
161 ces. Uses LU decomposition.
162
163 SbBool LUDecomposition(int index[4], float &d)
164 Perform in-place LU decomposition of matrix. index is index of rows
165 in matrix. d is the parity of row swaps. Returns FALSE if singular.
166
167 void LUBackSubstitution(int index[4], float b[4]) const
168 Perform back-substitution on LU-decomposed matrix. Index is permuta‐
169 tion of rows from original matrix.
170
171 SbMatrix transpose() const
172 Returns transpose of matrix.
173
174 SbMatrix & multRight(const SbMatrix &m)
175 SbMatrix & multLeft(const SbMatrix &m)
176 Multiplies matrix by given matrix on right or left.
177
178 void multMatrixVec(const SbVec3f &src, SbVec3f &dst) const
179 Multiplies matrix by given column vector, giving vector result.
180
181 void multVecMatrix(const SbVec3f &src, SbVec3f &dst) const
182 Multiplies given row vector by matrix, giving vector result.
183
184 void multDirMatrix(const SbVec3f &src, SbVec3f &dst) const
185 Multiplies given row vector by matrix, giving vector result. src is
186 assumed to be a direction vector, so translation part of matrix is
187 ignored. Note: if you wish to transform surface points and normals
188 by a matrix, call multVecMatrix() for the points and call mult‐
189 DirMatrix() on the inverse transpose of the matrix for the normals.
190
191 void multLineMatrix(const SbLine &src, SbLine &dst) const
192 Multiplies the given line's origin by the matrix, and the line's
193 direction by the rotation portion of the matrix.
194
195 void print(FILE *fp) const
196 Prints a formatted version of the matrix to the given file pointer.
197
198 float * operator float*()
199 Cast: returns pointer to storage of first element.
200
201 SbMat operator SbMat&()
202 Cast: returns reference to 4x4 array.
203
204 float * operator [](int i)
205 const float * operator [](int i) const
206 Make it look like a usual matrix (so you can do m[3][2]).
207
208 SbMatrix & operator =(const SbMat &m)
209 Sets value from 4x4 array of elements.
210
211 SbMatrix & operator =(const SbMatrix &m)
212 Set the matrix from another SbMatrix.
213
214 SbMatrix & operator =(const SbRotation &q)
215 Set the matrix from an SbRotation.
216
217 SbMatrix & operator *=(const SbMatrix &m)
218 Performs right multiplication with another matrix.
219
220 SbMatrix operator *(const SbMatrix &m1, const SbMatrix &m2)
221 Binary multiplication of matrices.
222
223 int operator ==(const SbMatrix &m1, const SbMatrix &m2)
224 int operator !=(const SbMatrix &m1, const SbMatrix &m2)
225 Equality comparison operators.
226
227 SbBool equals(const SbMatrix &m, float tolerance) const
228 Equality comparison within given tolerance, for each component.
229
230
232 SbVec3f, SbRotation
233
234
235
236
237 SbMatrix(3IV)()