Loading...
Searching...
No Matches
matrix4f.h
Go to the documentation of this file.
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
8// This file is generated by a script. Do not edit directly. Edit the
9// matrix4.template.h file to make changes.
10
11#ifndef PXR_BASE_GF_MATRIX4F_H
12#define PXR_BASE_GF_MATRIX4F_H
13
16
17#include "pxr/pxr.h"
18#include "pxr/base/gf/api.h"
19#include "pxr/base/gf/declare.h"
20#include "pxr/base/gf/matrixData.h"
21#include "pxr/base/gf/vec4f.h"
22#include "pxr/base/gf/traits.h"
24#include "pxr/base/gf/limits.h"
25#include "pxr/base/gf/math.h"
26#include "pxr/base/gf/vec3f.h"
27#include "pxr/base/tf/hash.h"
28
29#include <iosfwd>
30#include <vector>
31
32PXR_NAMESPACE_OPEN_SCOPE
33
34template <>
35struct GfIsGfMatrix<class GfMatrix4f> { static const bool value = true; };
36
37class GfMatrix4d;
38class GfMatrix4f;
39class GfQuatf;
40class GfRotation;
41class GfMatrix3f;
42
71{
72public:
73 typedef float ScalarType;
74
75 static const size_t numRows = 4;
76 static const size_t numColumns = 4;
77
80 GfMatrix4f() = default;
81
85 GfMatrix4f(float m00, float m01, float m02, float m03,
86 float m10, float m11, float m12, float m13,
87 float m20, float m21, float m22, float m23,
88 float m30, float m31, float m32, float m33) {
89 Set(m00, m01, m02, m03,
90 m10, m11, m12, m13,
91 m20, m21, m22, m23,
92 m30, m31, m32, m33);
93 }
94
97 GfMatrix4f(const float m[4][4]) {
98 Set(m);
99 }
100
103 explicit GfMatrix4f(float s) {
104 SetDiagonal(s);
105 }
106
109 explicit GfMatrix4f(const GfVec4f& v) {
110 SetDiagonal(v);
111 }
112
119 GF_API
120 explicit GfMatrix4f(const std::vector< std::vector<double> >& v);
121
128 GF_API
129 explicit GfMatrix4f(const std::vector< std::vector<float> >& v);
130
137 GF_API
138 explicit GfMatrix4f(const std::vector<double>& r0,
139 const std::vector<double>& r1,
140 const std::vector<double>& r2,
141 const std::vector<double>& r3);
142
149 GF_API
150 explicit GfMatrix4f(const std::vector<float>& r0,
151 const std::vector<float>& r1,
152 const std::vector<float>& r2,
153 const std::vector<float>& r3);
154
157 GF_API
158 GfMatrix4f(const GfRotation& rotate,
159 const GfVec3f& translate);
160
163 GF_API
164 GfMatrix4f(const GfMatrix3f& rotmx,
165 const GfVec3f& translate);
167 GF_API
168 explicit GfMatrix4f(const class GfMatrix4d& m);
169
171 void SetRow(int i, const GfVec4f & v) {
172 _mtx[i][0] = v[0];
173 _mtx[i][1] = v[1];
174 _mtx[i][2] = v[2];
175 _mtx[i][3] = v[3];
176 }
177
179 void SetColumn(int i, const GfVec4f & v) {
180 _mtx[0][i] = v[0];
181 _mtx[1][i] = v[1];
182 _mtx[2][i] = v[2];
183 _mtx[3][i] = v[3];
184 }
185
187 GfVec4f GetRow(int i) const {
188 return GfVec4f(_mtx[i][0], _mtx[i][1], _mtx[i][2], _mtx[i][3]);
189 }
190
192 GfVec4f GetColumn(int i) const {
193 return GfVec4f(_mtx[0][i], _mtx[1][i], _mtx[2][i], _mtx[3][i]);
194 }
195
199 GfMatrix4f& Set(float m00, float m01, float m02, float m03,
200 float m10, float m11, float m12, float m13,
201 float m20, float m21, float m22, float m23,
202 float m30, float m31, float m32, float m33) {
203 _mtx[0][0] = m00; _mtx[0][1] = m01; _mtx[0][2] = m02; _mtx[0][3] = m03;
204 _mtx[1][0] = m10; _mtx[1][1] = m11; _mtx[1][2] = m12; _mtx[1][3] = m13;
205 _mtx[2][0] = m20; _mtx[2][1] = m21; _mtx[2][2] = m22; _mtx[2][3] = m23;
206 _mtx[3][0] = m30; _mtx[3][1] = m31; _mtx[3][2] = m32; _mtx[3][3] = m33;
207 return *this;
208 }
209
212 GfMatrix4f& Set(const float m[4][4]) {
213 _mtx[0][0] = m[0][0];
214 _mtx[0][1] = m[0][1];
215 _mtx[0][2] = m[0][2];
216 _mtx[0][3] = m[0][3];
217 _mtx[1][0] = m[1][0];
218 _mtx[1][1] = m[1][1];
219 _mtx[1][2] = m[1][2];
220 _mtx[1][3] = m[1][3];
221 _mtx[2][0] = m[2][0];
222 _mtx[2][1] = m[2][1];
223 _mtx[2][2] = m[2][2];
224 _mtx[2][3] = m[2][3];
225 _mtx[3][0] = m[3][0];
226 _mtx[3][1] = m[3][1];
227 _mtx[3][2] = m[3][2];
228 _mtx[3][3] = m[3][3];
229 return *this;
230 }
231
234 return SetDiagonal(1);
235 }
236
239 return SetDiagonal(0);
240 }
241
243 GF_API
245
247 GF_API
249
252 GF_API
253 float* Get(float m[4][4]) const;
254
257 float* data() {
258 return _mtx.GetData();
259 }
260
263 const float* data() const {
264 return _mtx.GetData();
265 }
266
268 float* GetArray() {
269 return _mtx.GetData();
270 }
271
273 const float* GetArray() const {
274 return _mtx.GetData();
275 }
276
280 float* operator [](int i) { return _mtx[i]; }
281
285 const float* operator [](int i) const { return _mtx[i]; }
286
288 friend inline size_t hash_value(GfMatrix4f const &m) {
289 return TfHash::Combine(
290 m._mtx[0][0],
291 m._mtx[0][1],
292 m._mtx[0][2],
293 m._mtx[0][3],
294 m._mtx[1][0],
295 m._mtx[1][1],
296 m._mtx[1][2],
297 m._mtx[1][3],
298 m._mtx[2][0],
299 m._mtx[2][1],
300 m._mtx[2][2],
301 m._mtx[2][3],
302 m._mtx[3][0],
303 m._mtx[3][1],
304 m._mtx[3][2],
305 m._mtx[3][3]
306 );
307 }
308
311 GF_API
312 bool operator ==(const GfMatrix4d& m) const;
313
316 GF_API
317 bool operator ==(const GfMatrix4f& m) const;
318
321 bool operator !=(const GfMatrix4d& m) const {
322 return !(*this == m);
323 }
324
327 bool operator !=(const GfMatrix4f& m) const {
328 return !(*this == m);
329 }
330
332 GF_API
334
340 GF_API
341 GfMatrix4f GetInverse(double* det = NULL, double eps = 0) const;
342
344 GF_API
345 double GetDeterminant() const;
346
349 void SetRow3(int i, const GfVec3f & v) {
350 _mtx[i][0] = v[0];
351 _mtx[i][1] = v[1];
352 _mtx[i][2] = v[2];
353 }
354
356 GfVec3f GetRow3(int i) const {
357 return GfVec3f(_mtx[i][0], _mtx[i][1], _mtx[i][2]);
358 }
359
363 double GetDeterminant3() const {
364 return _GetDeterminant3(0, 1, 2, 0, 1, 2);
365 }
366
370 bool HasOrthogonalRows3() const {
371 // XXX Should add GfAreOrthogonal(v0, v1, v2) (which also
372 // GfRotation::Decompose() could use).
373 GfVec3f axis0(GetRow3(0)), axis1(GetRow3(1)), axis2(GetRow3(2));
374 return (GfAbs(GfDot(axis0, axis1)) < GF_MIN_ORTHO_TOLERANCE &&
375 GfAbs(GfDot(axis0, axis2)) < GF_MIN_ORTHO_TOLERANCE &&
376 GfAbs(GfDot(axis1, axis2)) < GF_MIN_ORTHO_TOLERANCE);
377 }
378
387 GF_API
388 bool Orthonormalize(bool issueWarning=true);
389
391 GF_API
392 GfMatrix4f GetOrthonormalized(bool issueWarning=true) const;
393
397 GF_API
398 double GetHandedness() const;
399
402 bool IsRightHanded() const {
403 return GetHandedness() == 1.0;
404 }
405
408 bool IsLeftHanded() const {
409 return GetHandedness() == -1.0;
410 }
411
413 GF_API
415
417 GF_API
419
421 friend GfMatrix4f operator *(const GfMatrix4f& m1, double d)
422 {
423 GfMatrix4f m = m1;
424 return m *= d;
425 }
426
428 // Returns the product of a matrix and a float.
429 friend GfMatrix4f operator *(double d, const GfMatrix4f& m)
430 {
431 return m * d;
432 }
433
435 GF_API
437
439 GF_API
441
443 GF_API
445
447 friend GfMatrix4f operator +(const GfMatrix4f& m1, const GfMatrix4f& m2)
448 {
449 GfMatrix4f tmp(m1);
450 tmp += m2;
451 return tmp;
452 }
453
455 friend GfMatrix4f operator -(const GfMatrix4f& m1, const GfMatrix4f& m2)
456 {
457 GfMatrix4f tmp(m1);
458 tmp -= m2;
459 return tmp;
460 }
461
463 friend GfMatrix4f operator *(const GfMatrix4f& m1, const GfMatrix4f& m2)
464 {
465 GfMatrix4f tmp(m1);
466 tmp *= m2;
467 return tmp;
468 }
469
471 friend GfMatrix4f operator /(const GfMatrix4f& m1, const GfMatrix4f& m2)
472 {
473 return(m1 * m2.GetInverse());
474 }
475
477 friend inline GfVec4f operator *(const GfMatrix4f& m, const GfVec4f& vec) {
478 return GfVec4f(vec[0] * m._mtx[0][0] + vec[1] * m._mtx[0][1] + vec[2] * m._mtx[0][2] + vec[3] * m._mtx[0][3],
479 vec[0] * m._mtx[1][0] + vec[1] * m._mtx[1][1] + vec[2] * m._mtx[1][2] + vec[3] * m._mtx[1][3],
480 vec[0] * m._mtx[2][0] + vec[1] * m._mtx[2][1] + vec[2] * m._mtx[2][2] + vec[3] * m._mtx[2][3],
481 vec[0] * m._mtx[3][0] + vec[1] * m._mtx[3][1] + vec[2] * m._mtx[3][2] + vec[3] * m._mtx[3][3]);
482 }
483
485 friend inline GfVec4f operator *(const GfVec4f &vec, const GfMatrix4f& m) {
486 return GfVec4f(vec[0] * m._mtx[0][0] + vec[1] * m._mtx[1][0] + vec[2] * m._mtx[2][0] + vec[3] * m._mtx[3][0],
487 vec[0] * m._mtx[0][1] + vec[1] * m._mtx[1][1] + vec[2] * m._mtx[2][1] + vec[3] * m._mtx[3][1],
488 vec[0] * m._mtx[0][2] + vec[1] * m._mtx[1][2] + vec[2] * m._mtx[2][2] + vec[3] * m._mtx[3][2],
489 vec[0] * m._mtx[0][3] + vec[1] * m._mtx[1][3] + vec[2] * m._mtx[2][3] + vec[3] * m._mtx[3][3]);
490 }
491
493 GF_API
494 GfMatrix4f& SetScale(float scaleFactor);
495
499 GF_API
501
504
507 GF_API
509
512 GF_API
514
517 GF_API
519
522 GF_API
524
527 GF_API
529
532 GF_API
534
537 GF_API
538 GfMatrix4f& SetScale(const GfVec3f &scaleFactors);
539
542 GF_API
544
547 GF_API
549
552 GF_API
554 const GfVec3f& translate);
555
558 GF_API
560 const GfVec3f& translate);
561
567 GF_API
568 GfMatrix4f& SetLookAt(const GfVec3f &eyePoint,
569 const GfVec3f &centerPoint,
570 const GfVec3f &upDirection);
571
577 GF_API
578 GfMatrix4f& SetLookAt(const GfVec3f &eyePoint,
579 const GfRotation &orientation);
580
595 GF_API
597 GfVec3f* t, GfMatrix4f* p,
598 float eps = 1e-5) const;
599
603 return GfVec3f(_mtx[3][0], _mtx[3][1], _mtx[3][2]);
604 }
605
611 GF_API
613
619 GF_API
621
627 GF_API
629 const GfVec3f &axis1,
630 const GfVec3f &axis2) const;
631
637 GF_API
639
643 GfVec3d Transform(const GfVec3d &vec) const {
644 return GfProject(GfVec4d(
645 vec[0] * _mtx[0][0] + vec[1] * _mtx[1][0] + vec[2] * _mtx[2][0] + _mtx[3][0],
646 vec[0] * _mtx[0][1] + vec[1] * _mtx[1][1] + vec[2] * _mtx[2][1] + _mtx[3][1],
647 vec[0] * _mtx[0][2] + vec[1] * _mtx[1][2] + vec[2] * _mtx[2][2] + _mtx[3][2],
648 vec[0] * _mtx[0][3] + vec[1] * _mtx[1][3] + vec[2] * _mtx[2][3] + _mtx[3][3]));
649 }
650
655 GfVec3f Transform(const GfVec3f &vec) const {
656 return (GfProject(GfVec4f(
657 vec[0] * _mtx[0][0] + vec[1] * _mtx[1][0] + vec[2] * _mtx[2][0] + _mtx[3][0],
658 vec[0] * _mtx[0][1] + vec[1] * _mtx[1][1] + vec[2] * _mtx[2][1] + _mtx[3][1],
659 vec[0] * _mtx[0][2] + vec[1] * _mtx[1][2] + vec[2] * _mtx[2][2] + _mtx[3][2],
660 vec[0] * _mtx[0][3] + vec[1] * _mtx[1][3] + vec[2] * _mtx[2][3] + _mtx[3][3])));
661 }
662
667 GfVec3d TransformDir(const GfVec3d &vec) const {
668 return GfVec3d(
669 vec[0] * _mtx[0][0] + vec[1] * _mtx[1][0] + vec[2] * _mtx[2][0],
670 vec[0] * _mtx[0][1] + vec[1] * _mtx[1][1] + vec[2] * _mtx[2][1],
671 vec[0] * _mtx[0][2] + vec[1] * _mtx[1][2] + vec[2] * _mtx[2][2]);
672 }
673
680 GfVec3f TransformDir(const GfVec3f &vec) const {
681 return GfVec3f(
682 vec[0] * _mtx[0][0] + vec[1] * _mtx[1][0] + vec[2] * _mtx[2][0],
683 vec[0] * _mtx[0][1] + vec[1] * _mtx[1][1] + vec[2] * _mtx[2][1],
684 vec[0] * _mtx[0][2] + vec[1] * _mtx[1][2] + vec[2] * _mtx[2][2]);
685 }
686
691 GfVec3d TransformAffine(const GfVec3d &vec) const {
692 return GfVec3d(
693 vec[0] * _mtx[0][0] + vec[1] * _mtx[1][0] + vec[2] * _mtx[2][0] + _mtx[3][0],
694 vec[0] * _mtx[0][1] + vec[1] * _mtx[1][1] + vec[2] * _mtx[2][1] + _mtx[3][1],
695 vec[0] * _mtx[0][2] + vec[1] * _mtx[1][2] + vec[2] * _mtx[2][2] + _mtx[3][2]);
696 }
697
702 GfVec3f TransformAffine(const GfVec3f &vec) const {
703 return GfVec3f(
704 vec[0] * _mtx[0][0] + vec[1] * _mtx[1][0] + vec[2] * _mtx[2][0] + _mtx[3][0],
705 vec[0] * _mtx[0][1] + vec[1] * _mtx[1][1] + vec[2] * _mtx[2][1] + _mtx[3][1],
706 vec[0] * _mtx[0][2] + vec[1] * _mtx[1][2] + vec[2] * _mtx[2][2] + _mtx[3][2]);
707 }
709
710private:
713 GF_API
714 double _GetDeterminant3(size_t row1, size_t row2, size_t row3,
715 size_t col1, size_t col2, size_t col3) const;
716
718 void _Jacobi3(GfVec3d *eigenvalues, GfVec3d eigenvectors[3]) const;
719
722 void _SetRotateFromQuat(float r, const GfVec3f& i);
723
724
725private:
728
729 // Friend declarations
730 friend class GfMatrix4d;
731};
732
733
737GF_API
738bool GfIsClose(GfMatrix4f const &m1, GfMatrix4f const &m2, double tolerance);
739
742GF_API std::ostream& operator<<(std::ostream &, GfMatrix4f const &);
743
744PXR_NAMESPACE_CLOSE_SCOPE
745
746#endif // PXR_BASE_GF_MATRIX4F_H
Declares Gf types.
Stores a 3x3 matrix of float elements.
Definition: matrix3f.h:65
Stores a 4x4 matrix of double elements.
Definition: matrix4d.h:71
Stores a 4x4 matrix of float elements.
Definition: matrix4f.h:71
GF_API GfMatrix4f & SetLookAt(const GfVec3f &eyePoint, const GfRotation &orientation)
Sets the matrix to specify a viewing matrix from a world-space eyePoint and a world-space rotation th...
const float * GetArray() const
Returns vector components as a const array of float values.
Definition: matrix4f.h:273
GF_API GfQuatf ExtractRotationQuat() const
Return the rotation corresponding to this matrix as a quaternion.
GF_API GfMatrix4f(const std::vector< float > &r0, const std::vector< float > &r1, const std::vector< float > &r2, const std::vector< float > &r3)
Constructor.
GfMatrix4f & Set(const float m[4][4])
Sets the matrix from a 4x4 array of float values, specified in row-major order.
Definition: matrix4f.h:212
bool HasOrthogonalRows3() const
Returns true, if the row vectors of the upper 3x3 matrix form an orthogonal basis.
Definition: matrix4f.h:370
float * data()
Returns raw access to components of matrix as an array of float values.
Definition: matrix4f.h:257
GF_API GfMatrix4f & SetTranslateOnly(const GfVec3f &t)
Sets matrix to specify a translation by the vector trans, without clearing the rotation.
GfVec3d Transform(const GfVec3d &vec) const
Transforms the row vector vec by the matrix, returning the result.
Definition: matrix4f.h:643
GF_API GfMatrix4f GetOrthonormalized(bool issueWarning=true) const
Returns an orthonormalized copy of the matrix.
GF_API GfMatrix4f & operator*=(const GfMatrix4f &m)
Post-multiplies matrix m into this matrix.
GfMatrix4f & SetIdentity()
Sets the matrix to the identity matrix.
Definition: matrix4f.h:233
GF_API GfMatrix4f & SetTranslate(const GfVec3f &trans)
Sets matrix to specify a translation by the vector trans, and clears the rotation.
GF_API GfMatrix4f & SetRotate(const GfRotation &rot)
Sets the matrix to specify a rotation equivalent to rot, and clears the translation.
GF_API GfMatrix4f & SetTransform(const GfRotation &rotate, const GfVec3f &translate)
Sets matrix to specify a rotation by rotate and a translation by translate.
friend GfMatrix4f operator*(const GfMatrix4f &m1, double d)
Returns the product of a matrix and a float.
Definition: matrix4f.h:421
GF_API GfMatrix4f GetTranspose() const
Returns the transpose of the matrix.
GfVec3f ExtractTranslation() const
Returns the translation part of the matrix, defined as the first three elements of the last row.
Definition: matrix4f.h:602
GfVec3d TransformDir(const GfVec3d &vec) const
Transforms row vector vec by the matrix, returning the result.
Definition: matrix4f.h:667
GF_API GfMatrix4f & operator-=(const GfMatrix4f &m)
Subtracts matrix m from this matrix.
GfMatrix4f & Set(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33)
Sets the matrix from 16 independent float values, specified in row-major order.
Definition: matrix4f.h:199
GF_API GfMatrix4f(const std::vector< double > &r0, const std::vector< double > &r1, const std::vector< double > &r2, const std::vector< double > &r3)
Constructor.
GF_API GfMatrix4f & SetScale(float scaleFactor)
Sets matrix to specify a uniform scaling by scaleFactor.
GF_API GfMatrix4f & SetDiagonal(const GfVec4f &)
Sets the matrix to have diagonal (v[0], v[1], v[2], v[3]).
GF_API GfMatrix4f & SetRotateOnly(const GfQuatf &rot)
Sets the matrix to specify a rotation equivalent to rot, without clearing the translation.
void SetRow3(int i, const GfVec3f &v)
Sets a row of the matrix from a Vec3.
Definition: matrix4f.h:349
const float * data() const
Returns const raw access to components of matrix as an array of float values.
Definition: matrix4f.h:263
GF_API GfMatrix4f & SetRotateOnly(const GfRotation &rot)
Sets the matrix to specify a rotation equivalent to rot, without clearing the translation.
GF_API GfMatrix4f & operator+=(const GfMatrix4f &m)
Adds matrix m to this matrix.
GfMatrix4f & SetZero()
Sets the matrix to zero.
Definition: matrix4f.h:238
friend GfMatrix4f operator/(const GfMatrix4f &m1, const GfMatrix4f &m2)
Divides matrix m1 by m2 (that is, m1 * inv(m2)).
Definition: matrix4f.h:471
GF_API double GetDeterminant() const
Returns the determinant of the matrix.
GF_API GfVec3f DecomposeRotation(const GfVec3f &axis0, const GfVec3f &axis1, const GfVec3f &axis2) const
Decompose the rotation corresponding to this matrix about 3 orthogonal axes.
GfVec3f GetRow3(int i) const
Gets a row of the matrix as a Vec3.
Definition: matrix4f.h:356
GF_API GfMatrix4f GetInverse(double *det=NULL, double eps=0) const
Returns the inverse of the matrix, or FLT_MAX * SetIdentity() if the matrix is singular.
friend size_t hash_value(GfMatrix4f const &m)
Hash.
Definition: matrix4f.h:288
GF_API GfMatrix4f & SetRotateOnly(const GfMatrix3f &mx)
Sets the matrix to specify a rotation equivalent to mx, without clearing the translation.
GF_API bool Factor(GfMatrix4f *r, GfVec3f *s, GfMatrix4f *u, GfVec3f *t, GfMatrix4f *p, float eps=1e-5) const
Factors the matrix into 5 components:
GF_API GfMatrix4f(const std::vector< std::vector< double > > &v)
Constructor.
GF_API float * Get(float m[4][4]) const
Fills a 4x4 array of float values with the values in the matrix, specified in row-major order.
GF_API GfMatrix4f(const std::vector< std::vector< float > > &v)
Constructor.
bool operator!=(const GfMatrix4d &m) const
Tests for element-wise matrix inequality.
Definition: matrix4f.h:321
friend GfMatrix4f operator+(const GfMatrix4f &m1, const GfMatrix4f &m2)
Adds matrix m2 to m1.
Definition: matrix4f.h:447
GF_API GfMatrix4f & SetRotate(const GfQuatf &rot)
Sets the matrix to specify a rotation equivalent to rot, and clears the translation.
GF_API GfMatrix4f(const GfRotation &rotate, const GfVec3f &translate)
Constructor.
GF_API friend GfMatrix4f operator-(const GfMatrix4f &m)
Returns the unary negation of matrix m.
float * operator[](int i)
Accesses an indexed row i of the matrix as an array of 4 float values so that standard indexing (such...
Definition: matrix4f.h:280
GF_API bool operator==(const GfMatrix4d &m) const
Tests for element-wise matrix equality.
GfMatrix4f(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33)
Constructor.
Definition: matrix4f.h:85
GF_API GfMatrix3f ExtractRotationMatrix() const
Returns the rotation corresponding to this matrix.
GF_API double GetHandedness() const
Returns the sign of the determinant of the upper 3x3 matrix, i.e.
GfVec3f TransformDir(const GfVec3f &vec) const
Transforms row vector vec by the matrix, returning the result.
Definition: matrix4f.h:680
void SetRow(int i, const GfVec4f &v)
Sets a row of the matrix from a Vec4.
Definition: matrix4f.h:171
float * GetArray()
Returns vector components as an array of float values.
Definition: matrix4f.h:268
GF_API GfMatrix4f & SetScale(const GfVec3f &scaleFactors)
Sets the matrix to specify a nonuniform scaling in x, y, and z by the factors in vector scaleFactors.
GfMatrix4f(const float m[4][4])
Constructor.
Definition: matrix4f.h:97
GF_API GfMatrix4f(const GfMatrix3f &rotmx, const GfVec3f &translate)
Constructor.
GF_API GfMatrix4f & SetLookAt(const GfVec3f &eyePoint, const GfVec3f &centerPoint, const GfVec3f &upDirection)
Sets the matrix to specify a viewing matrix from parameters similar to those used by gluLookAt(3G).
GfVec3d TransformAffine(const GfVec3d &vec) const
Transforms the row vector vec by the matrix, returning the result.
Definition: matrix4f.h:691
GF_API bool Orthonormalize(bool issueWarning=true)
Makes the matrix orthonormal in place.
bool IsLeftHanded() const
Returns true if the vectors in the upper 3x3 matrix form a left-handed coordinate system.
Definition: matrix4f.h:408
GfMatrix4f(float s)
Constructor.
Definition: matrix4f.h:103
GF_API GfMatrix4f(const class GfMatrix4d &m)
This explicit constructor converts a "double" matrix to a "float" matrix.
GfMatrix4f()=default
GfMatrix4f value-initializes to zero and performs no default initialization, like float or double.
double GetDeterminant3() const
Returns the determinant of the upper 3x3 matrix.
Definition: matrix4f.h:363
GF_API GfMatrix4f & SetTransform(const GfMatrix3f &rotmx, const GfVec3f &translate)
Sets matrix to specify a rotation by rotmx and a translation by translate.
GfVec3f Transform(const GfVec3f &vec) const
Transforms the row vector vec by the matrix, returning the result.
Definition: matrix4f.h:655
GfMatrix4f(const GfVec4f &v)
Constructor.
Definition: matrix4f.h:109
bool IsRightHanded() const
Returns true if the vectors in the upper 3x3 matrix form a right-handed coordinate system.
Definition: matrix4f.h:402
void SetColumn(int i, const GfVec4f &v)
Sets a column of the matrix from a Vec4.
Definition: matrix4f.h:179
GF_API GfMatrix4f & SetRotate(const GfMatrix3f &mx)
Sets the matrix to specify a rotation equivalent to mx, and clears the translation.
GfVec4f GetColumn(int i) const
Gets a column of the matrix as a Vec4.
Definition: matrix4f.h:192
GfVec4f GetRow(int i) const
Gets a row of the matrix as a Vec4.
Definition: matrix4f.h:187
GfVec3f TransformAffine(const GfVec3f &vec) const
Transforms the row vector vec by the matrix, returning the result.
Definition: matrix4f.h:702
GF_API GfRotation ExtractRotation() const
Returns the rotation corresponding to this matrix.
GF_API GfMatrix4f RemoveScaleShear() const
Returns the matrix with any scaling or shearing removed, leaving only the rotation and translation.
GF_API GfMatrix4f & SetDiagonal(float s)
Sets the matrix to s times the identity matrix.
A class template used by GfMatrixXX to store values.
Definition: matrixData.h:19
T * GetData()
Return a pointer to the start of all the data.
Definition: matrixData.h:33
Basic type: a quaternion, a complex number with a real coefficient and three imaginary coefficients,...
Definition: quatf.h:43
Basic type: 3-space rotation specification.
Definition: rotation.h:37
Basic type for a vector of 3 double components.
Definition: vec3d.h:46
Basic type for a vector of 3 float components.
Definition: vec3f.h:46
Basic type for a vector of 4 double components.
Definition: vec4d.h:46
Basic type for a vector of 4 float components.
Definition: vec4f.h:46
static size_t Combine(Args &&... args)
Produce a hash code by combining the hash codes of several objects.
Definition: hash.h:487
double GfDot(const GfDualQuatd &dq1, const GfDualQuatd &dq2)
Return the dot (inner) product of two dual quaternions.
Definition: dualQuatd.h:261
Assorted mathematical utility functions.
double GfAbs(double f)
Return abs(f).
Definition: math.h:222
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
#define GF_MIN_ORTHO_TOLERANCE
This constant is used to determine when a set of basis vectors is close to orthogonal.
Definition: limits.h:22
Utility functions for GfVec4f and GfVec4d as homogeneous vectors.
GfVec3f GfProject(const GfVec4f &v)
Projects homogeneous v into Euclidean space and returns the result as a Vec3f.
Definition: homogeneous.h:48
Defines useful mathematical limits.
GF_API bool GfIsClose(GfMatrix4f const &m1, GfMatrix4f const &m2, double tolerance)
Tests for equality within a given tolerance, returning true if the difference between each component ...
A metafunction with a static const bool member 'value' that is true for GfMatrix types,...
Definition: traits.h:25