All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
matrix4d.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_MATRIX4D_H
12#define PXR_BASE_GF_MATRIX4D_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/vec4d.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/vec3d.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 GfMatrix4d> { static const bool value = true; };
36
37class GfMatrix4d;
38class GfMatrix4f;
39class GfQuatd;
40class GfRotation;
41class GfMatrix3d;
42
71{
72public:
73 typedef double ScalarType;
74
75 static const size_t numRows = 4;
76 static const size_t numColumns = 4;
77
79 GfMatrix4d() = default;
80
84 GfMatrix4d(double m00, double m01, double m02, double m03,
85 double m10, double m11, double m12, double m13,
86 double m20, double m21, double m22, double m23,
87 double m30, double m31, double m32, double m33) {
88 Set(m00, m01, m02, m03,
89 m10, m11, m12, m13,
90 m20, m21, m22, m23,
91 m30, m31, m32, m33);
92 }
93
96 GfMatrix4d(const double m[4][4]) {
97 Set(m);
98 }
99
102 explicit GfMatrix4d(double s) {
103 SetDiagonal(s);
104 }
105
108 explicit GfMatrix4d(const GfVec4d& v) {
109 SetDiagonal(v);
110 }
111
118 GF_API
119 explicit GfMatrix4d(const std::vector< std::vector<double> >& v);
120
127 GF_API
128 explicit GfMatrix4d(const std::vector< std::vector<float> >& v);
129
136 GF_API
137 explicit GfMatrix4d(const std::vector<double>& r0,
138 const std::vector<double>& r1,
139 const std::vector<double>& r2,
140 const std::vector<double>& r3);
141
148 GF_API
149 explicit GfMatrix4d(const std::vector<float>& r0,
150 const std::vector<float>& r1,
151 const std::vector<float>& r2,
152 const std::vector<float>& r3);
153
156 GF_API
157 GfMatrix4d(const GfRotation& rotate,
158 const GfVec3d& translate);
159
162 GF_API
163 GfMatrix4d(const GfMatrix3d& rotmx,
164 const GfVec3d& translate);
166 GF_API
167 explicit GfMatrix4d(const class GfMatrix4f& m);
168
170 void SetRow(int i, const GfVec4d & v) {
171 _mtx[i][0] = v[0];
172 _mtx[i][1] = v[1];
173 _mtx[i][2] = v[2];
174 _mtx[i][3] = v[3];
175 }
176
178 void SetColumn(int i, const GfVec4d & v) {
179 _mtx[0][i] = v[0];
180 _mtx[1][i] = v[1];
181 _mtx[2][i] = v[2];
182 _mtx[3][i] = v[3];
183 }
184
186 GfVec4d GetRow(int i) const {
187 return GfVec4d(_mtx[i][0], _mtx[i][1], _mtx[i][2], _mtx[i][3]);
188 }
189
191 GfVec4d GetColumn(int i) const {
192 return GfVec4d(_mtx[0][i], _mtx[1][i], _mtx[2][i], _mtx[3][i]);
193 }
194
198 GfMatrix4d& Set(double m00, double m01, double m02, double m03,
199 double m10, double m11, double m12, double m13,
200 double m20, double m21, double m22, double m23,
201 double m30, double m31, double m32, double m33) {
202 _mtx[0][0] = m00; _mtx[0][1] = m01; _mtx[0][2] = m02; _mtx[0][3] = m03;
203 _mtx[1][0] = m10; _mtx[1][1] = m11; _mtx[1][2] = m12; _mtx[1][3] = m13;
204 _mtx[2][0] = m20; _mtx[2][1] = m21; _mtx[2][2] = m22; _mtx[2][3] = m23;
205 _mtx[3][0] = m30; _mtx[3][1] = m31; _mtx[3][2] = m32; _mtx[3][3] = m33;
206 return *this;
207 }
208
211 GfMatrix4d& Set(const double m[4][4]) {
212 _mtx[0][0] = m[0][0];
213 _mtx[0][1] = m[0][1];
214 _mtx[0][2] = m[0][2];
215 _mtx[0][3] = m[0][3];
216 _mtx[1][0] = m[1][0];
217 _mtx[1][1] = m[1][1];
218 _mtx[1][2] = m[1][2];
219 _mtx[1][3] = m[1][3];
220 _mtx[2][0] = m[2][0];
221 _mtx[2][1] = m[2][1];
222 _mtx[2][2] = m[2][2];
223 _mtx[2][3] = m[2][3];
224 _mtx[3][0] = m[3][0];
225 _mtx[3][1] = m[3][1];
226 _mtx[3][2] = m[3][2];
227 _mtx[3][3] = m[3][3];
228 return *this;
229 }
230
233 return SetDiagonal(1);
234 }
235
238 return SetDiagonal(0);
239 }
240
242 GF_API
244
246 GF_API
248
251 GF_API
252 double* Get(double m[4][4]) const;
253
256 double* data() {
257 return _mtx.GetData();
258 }
259
262 const double* data() const {
263 return _mtx.GetData();
264 }
265
267 double* GetArray() {
268 return _mtx.GetData();
269 }
270
272 const double* GetArray() const {
273 return _mtx.GetData();
274 }
275
279 double* operator [](int i) { return _mtx[i]; }
280
284 const double* operator [](int i) const { return _mtx[i]; }
285
287 friend inline size_t hash_value(GfMatrix4d const &m) {
288 return TfHash::Combine(
289 m._mtx[0][0],
290 m._mtx[0][1],
291 m._mtx[0][2],
292 m._mtx[0][3],
293 m._mtx[1][0],
294 m._mtx[1][1],
295 m._mtx[1][2],
296 m._mtx[1][3],
297 m._mtx[2][0],
298 m._mtx[2][1],
299 m._mtx[2][2],
300 m._mtx[2][3],
301 m._mtx[3][0],
302 m._mtx[3][1],
303 m._mtx[3][2],
304 m._mtx[3][3]
305 );
306 }
307
310 GF_API
311 bool operator ==(const GfMatrix4d& m) const;
312
315 GF_API
316 bool operator ==(const GfMatrix4f& m) const;
317
320 bool operator !=(const GfMatrix4d& m) const {
321 return !(*this == m);
322 }
323
326 bool operator !=(const GfMatrix4f& m) const {
327 return !(*this == m);
328 }
329
331 GF_API
333
339 GF_API
340 GfMatrix4d GetInverse(double* det = NULL, double eps = 0) const;
341
343 GF_API
344 double GetDeterminant() const;
345
348 void SetRow3(int i, const GfVec3d & v) {
349 _mtx[i][0] = v[0];
350 _mtx[i][1] = v[1];
351 _mtx[i][2] = v[2];
352 }
353
355 GfVec3d GetRow3(int i) const {
356 return GfVec3d(_mtx[i][0], _mtx[i][1], _mtx[i][2]);
357 }
358
362 double GetDeterminant3() const {
363 return _GetDeterminant3(0, 1, 2, 0, 1, 2);
364 }
365
369 bool HasOrthogonalRows3() const {
370 // XXX Should add GfAreOrthogonal(v0, v1, v2) (which also
371 // GfRotation::Decompose() could use).
372 GfVec3d axis0(GetRow3(0)), axis1(GetRow3(1)), axis2(GetRow3(2));
373 return (GfAbs(GfDot(axis0, axis1)) < GF_MIN_ORTHO_TOLERANCE &&
374 GfAbs(GfDot(axis0, axis2)) < GF_MIN_ORTHO_TOLERANCE &&
375 GfAbs(GfDot(axis1, axis2)) < GF_MIN_ORTHO_TOLERANCE);
376 }
377
386 GF_API
387 bool Orthonormalize(bool issueWarning=true);
388
390 GF_API
391 GfMatrix4d GetOrthonormalized(bool issueWarning=true) const;
392
396 GF_API
397 double GetHandedness() const;
398
401 bool IsRightHanded() const {
402 return GetHandedness() == 1.0;
403 }
404
407 bool IsLeftHanded() const {
408 return GetHandedness() == -1.0;
409 }
410
412 GF_API
414
416 GF_API
418
420 friend GfMatrix4d operator *(const GfMatrix4d& m1, double d)
421 {
422 GfMatrix4d m = m1;
423 return m *= d;
424 }
425
427 // Returns the product of a matrix and a double.
428 friend GfMatrix4d operator *(double d, const GfMatrix4d& m)
429 {
430 return m * d;
431 }
432
434 GF_API
436
438 GF_API
440
442 GF_API
444
446 friend GfMatrix4d operator +(const GfMatrix4d& m1, const GfMatrix4d& m2)
447 {
448 GfMatrix4d tmp(m1);
449 tmp += m2;
450 return tmp;
451 }
452
454 friend GfMatrix4d operator -(const GfMatrix4d& m1, const GfMatrix4d& m2)
455 {
456 GfMatrix4d tmp(m1);
457 tmp -= m2;
458 return tmp;
459 }
460
462 friend GfMatrix4d operator *(const GfMatrix4d& m1, const GfMatrix4d& m2)
463 {
464 GfMatrix4d tmp(m1);
465 tmp *= m2;
466 return tmp;
467 }
468
470 friend GfMatrix4d operator /(const GfMatrix4d& m1, const GfMatrix4d& m2)
471 {
472 return(m1 * m2.GetInverse());
473 }
474
476 friend inline GfVec4d operator *(const GfMatrix4d& m, const GfVec4d& vec) {
477 return GfVec4d(vec[0] * m._mtx[0][0] + vec[1] * m._mtx[0][1] + vec[2] * m._mtx[0][2] + vec[3] * m._mtx[0][3],
478 vec[0] * m._mtx[1][0] + vec[1] * m._mtx[1][1] + vec[2] * m._mtx[1][2] + vec[3] * m._mtx[1][3],
479 vec[0] * m._mtx[2][0] + vec[1] * m._mtx[2][1] + vec[2] * m._mtx[2][2] + vec[3] * m._mtx[2][3],
480 vec[0] * m._mtx[3][0] + vec[1] * m._mtx[3][1] + vec[2] * m._mtx[3][2] + vec[3] * m._mtx[3][3]);
481 }
482
484 friend inline GfVec4d operator *(const GfVec4d &vec, const GfMatrix4d& m) {
485 return GfVec4d(vec[0] * m._mtx[0][0] + vec[1] * m._mtx[1][0] + vec[2] * m._mtx[2][0] + vec[3] * m._mtx[3][0],
486 vec[0] * m._mtx[0][1] + vec[1] * m._mtx[1][1] + vec[2] * m._mtx[2][1] + vec[3] * m._mtx[3][1],
487 vec[0] * m._mtx[0][2] + vec[1] * m._mtx[1][2] + vec[2] * m._mtx[2][2] + vec[3] * m._mtx[3][2],
488 vec[0] * m._mtx[0][3] + vec[1] * m._mtx[1][3] + vec[2] * m._mtx[2][3] + vec[3] * m._mtx[3][3]);
489 }
490
492 GF_API
493 GfMatrix4d& SetScale(double scaleFactor);
494
498 GF_API
500
503
506 GF_API
508
511 GF_API
513
516 GF_API
518
521 GF_API
523
526 GF_API
528
531 GF_API
533
536 GF_API
537 GfMatrix4d& SetScale(const GfVec3d &scaleFactors);
538
541 GF_API
543
546 GF_API
548
551 GF_API
553 const GfVec3d& translate);
554
557 GF_API
559 const GfVec3d& translate);
560
566 GF_API
567 GfMatrix4d& SetLookAt(const GfVec3d &eyePoint,
568 const GfVec3d &centerPoint,
569 const GfVec3d &upDirection);
570
576 GF_API
577 GfMatrix4d& SetLookAt(const GfVec3d &eyePoint,
578 const GfRotation &orientation);
579
594 GF_API
596 GfVec3d* t, GfMatrix4d* p,
597 double eps = 1e-10) const;
598
602 return GfVec3d(_mtx[3][0], _mtx[3][1], _mtx[3][2]);
603 }
604
610 GF_API
612
618 GF_API
620
626 GF_API
628 const GfVec3d &axis1,
629 const GfVec3d &axis2) const;
630
636 GF_API
638
642 GfVec3d Transform(const GfVec3d &vec) const {
643 return GfProject(GfVec4d(
644 vec[0] * _mtx[0][0] + vec[1] * _mtx[1][0] + vec[2] * _mtx[2][0] + _mtx[3][0],
645 vec[0] * _mtx[0][1] + vec[1] * _mtx[1][1] + vec[2] * _mtx[2][1] + _mtx[3][1],
646 vec[0] * _mtx[0][2] + vec[1] * _mtx[1][2] + vec[2] * _mtx[2][2] + _mtx[3][2],
647 vec[0] * _mtx[0][3] + vec[1] * _mtx[1][3] + vec[2] * _mtx[2][3] + _mtx[3][3]));
648 }
649
654 GfVec3d TransformDir(const GfVec3d &vec) const {
655 return GfVec3d(
656 vec[0] * _mtx[0][0] + vec[1] * _mtx[1][0] + vec[2] * _mtx[2][0],
657 vec[0] * _mtx[0][1] + vec[1] * _mtx[1][1] + vec[2] * _mtx[2][1],
658 vec[0] * _mtx[0][2] + vec[1] * _mtx[1][2] + vec[2] * _mtx[2][2]);
659 }
660
665 GfVec3d TransformAffine(const GfVec3d &vec) const {
666 return GfVec3d(
667 vec[0] * _mtx[0][0] + vec[1] * _mtx[1][0] + vec[2] * _mtx[2][0] + _mtx[3][0],
668 vec[0] * _mtx[0][1] + vec[1] * _mtx[1][1] + vec[2] * _mtx[2][1] + _mtx[3][1],
669 vec[0] * _mtx[0][2] + vec[1] * _mtx[1][2] + vec[2] * _mtx[2][2] + _mtx[3][2]);
670 }
672
673private:
676 GF_API
677 double _GetDeterminant3(size_t row1, size_t row2, size_t row3,
678 size_t col1, size_t col2, size_t col3) const;
679
681 void _Jacobi3(GfVec3d *eigenvalues, GfVec3d eigenvectors[3]) const;
682
685 void _SetRotateFromQuat(double r, const GfVec3d& i);
686
687
688private:
691
692 // Friend declarations
693 friend class GfMatrix4f;
694};
695
696
700GF_API
701bool GfIsClose(GfMatrix4d const &m1, GfMatrix4d const &m2, double tolerance);
702
705GF_API std::ostream& operator<<(std::ostream &, GfMatrix4d const &);
706
707PXR_NAMESPACE_CLOSE_SCOPE
708
709#endif // PXR_BASE_GF_MATRIX4D_H
Declares Gf types.
Stores a 3x3 matrix of double elements.
Definition: matrix3d.h:65
Stores a 4x4 matrix of double elements.
Definition: matrix4d.h:71
GF_API GfMatrix4d & operator*=(const GfMatrix4d &m)
Post-multiplies matrix m into this matrix.
GF_API GfMatrix4d GetTranspose() const
Returns the transpose of the matrix.
GF_API GfMatrix4d & SetTranslateOnly(const GfVec3d &t)
Sets matrix to specify a translation by the vector trans, without clearing the rotation.
bool HasOrthogonalRows3() const
Returns true, if the row vectors of the upper 3x3 matrix form an orthogonal basis.
Definition: matrix4d.h:369
GfVec3d Transform(const GfVec3d &vec) const
Transforms the row vector vec by the matrix, returning the result.
Definition: matrix4d.h:642
friend GfMatrix4d operator*(const GfMatrix4d &m1, double d)
Returns the product of a matrix and a double.
Definition: matrix4d.h:420
GF_API GfMatrix4d & operator-=(const GfMatrix4d &m)
Subtracts matrix m from this matrix.
GF_API GfMatrix4d & SetRotate(const GfMatrix3d &mx)
Sets the matrix to specify a rotation equivalent to mx, and clears the translation.
friend GfMatrix4d operator/(const GfMatrix4d &m1, const GfMatrix4d &m2)
Divides matrix m1 by m2 (that is, m1 * inv(m2)).
Definition: matrix4d.h:470
void SetRow3(int i, const GfVec3d &v)
Sets a row of the matrix from a Vec3.
Definition: matrix4d.h:348
GF_API GfMatrix4d & SetDiagonal(double s)
Sets the matrix to s times the identity matrix.
const double * data() const
Returns const raw access to components of matrix as an array of double values.
Definition: matrix4d.h:262
GfMatrix4d(double m00, double m01, double m02, double m03, double m10, double m11, double m12, double m13, double m20, double m21, double m22, double m23, double m30, double m31, double m32, double m33)
Constructor.
Definition: matrix4d.h:84
GF_API GfMatrix4d & SetRotateOnly(const GfMatrix3d &mx)
Sets the matrix to specify a rotation equivalent to mx, without clearing the translation.
GF_API GfMatrix4d & SetScale(double scaleFactor)
Sets matrix to specify a uniform scaling by scaleFactor.
GF_API GfMatrix3d ExtractRotationMatrix() const
Returns the rotation corresponding to this matrix.
friend size_t hash_value(GfMatrix4d const &m)
Hash.
Definition: matrix4d.h:287
GfVec3d TransformDir(const GfVec3d &vec) const
Transforms row vector vec by the matrix, returning the result.
Definition: matrix4d.h:654
GfMatrix4d()=default
Default constructor. Leaves the matrix component values undefined.
GF_API GfMatrix4d & SetRotate(const GfRotation &rot)
Sets the matrix to specify a rotation equivalent to rot, and clears the translation.
GF_API GfMatrix4d(const GfRotation &rotate, const GfVec3d &translate)
Constructor.
GfVec3d GetRow3(int i) const
Gets a row of the matrix as a Vec3.
Definition: matrix4d.h:355
GfMatrix4d & Set(const double m[4][4])
Sets the matrix from a 4x4 array of double values, specified in row-major order.
Definition: matrix4d.h:211
GfVec3d ExtractTranslation() const
Returns the translation part of the matrix, defined as the first three elements of the last row.
Definition: matrix4d.h:601
GF_API GfMatrix4d & SetDiagonal(const GfVec4d &)
Sets the matrix to have diagonal (v[0], v[1], v[2], v[3]).
GF_API GfMatrix4d(const std::vector< float > &r0, const std::vector< float > &r1, const std::vector< float > &r2, const std::vector< float > &r3)
Constructor.
GF_API GfMatrix4d RemoveScaleShear() const
Returns the matrix with any scaling or shearing removed, leaving only the rotation and translation.
GfVec4d GetColumn(int i) const
Gets a column of the matrix as a Vec4.
Definition: matrix4d.h:191
GF_API GfMatrix4d & SetRotateOnly(const GfQuatd &rot)
Sets the matrix to specify a rotation equivalent to rot, without clearing the translation.
GF_API double GetDeterminant() const
Returns the determinant of the matrix.
void SetColumn(int i, const GfVec4d &v)
Sets a column of the matrix from a Vec4.
Definition: matrix4d.h:178
GF_API GfMatrix4d & SetScale(const GfVec3d &scaleFactors)
Sets the matrix to specify a nonuniform scaling in x, y, and z by the factors in vector scaleFactors.
double * operator[](int i)
Accesses an indexed row i of the matrix as an array of 4 double values so that standard indexing (suc...
Definition: matrix4d.h:279
GfMatrix4d & SetIdentity()
Sets the matrix to the identity matrix.
Definition: matrix4d.h:232
bool operator!=(const GfMatrix4d &m) const
Tests for element-wise matrix inequality.
Definition: matrix4d.h:320
GF_API GfMatrix4d(const std::vector< double > &r0, const std::vector< double > &r1, const std::vector< double > &r2, const std::vector< double > &r3)
Constructor.
GF_API GfMatrix4d(const std::vector< std::vector< double > > &v)
Constructor.
GfMatrix4d & Set(double m00, double m01, double m02, double m03, double m10, double m11, double m12, double m13, double m20, double m21, double m22, double m23, double m30, double m31, double m32, double m33)
Sets the matrix from 16 independent double values, specified in row-major order.
Definition: matrix4d.h:198
GF_API bool operator==(const GfMatrix4d &m) const
Tests for element-wise matrix equality.
GF_API double GetHandedness() const
Returns the sign of the determinant of the upper 3x3 matrix, i.e.
GF_API GfMatrix4d & SetTranslate(const GfVec3d &trans)
Sets matrix to specify a translation by the vector trans, and clears the rotation.
double * GetArray()
Returns vector components as an array of double values.
Definition: matrix4d.h:267
friend GfMatrix4d operator+(const GfMatrix4d &m1, const GfMatrix4d &m2)
Adds matrix m2 to m1.
Definition: matrix4d.h:446
GF_API double * Get(double m[4][4]) const
Fills a 4x4 array of double values with the values in the matrix, specified in row-major order.
GF_API GfMatrix4d & operator+=(const GfMatrix4d &m)
Adds matrix m to this matrix.
double * data()
Returns raw access to components of matrix as an array of double values.
Definition: matrix4d.h:256
void SetRow(int i, const GfVec4d &v)
Sets a row of the matrix from a Vec4.
Definition: matrix4d.h:170
GfMatrix4d(const double m[4][4])
Constructor.
Definition: matrix4d.h:96
GF_API GfMatrix4d(const class GfMatrix4f &m)
This explicit constructor converts a "float" matrix to a "double" matrix.
GF_API GfMatrix4d GetInverse(double *det=NULL, double eps=0) const
Returns the inverse of the matrix, or FLT_MAX * SetIdentity() if the matrix is singular.
GfMatrix4d(const GfVec4d &v)
Constructor.
Definition: matrix4d.h:108
GfVec4d GetRow(int i) const
Gets a row of the matrix as a Vec4.
Definition: matrix4d.h:186
GF_API GfMatrix4d(const std::vector< std::vector< float > > &v)
Constructor.
GfMatrix4d(double s)
Constructor.
Definition: matrix4d.h:102
GfVec3d TransformAffine(const GfVec3d &vec) const
Transforms the row vector vec by the matrix, returning the result.
Definition: matrix4d.h:665
GF_API bool Orthonormalize(bool issueWarning=true)
Makes the matrix orthonormal in place.
GF_API GfMatrix4d & SetRotate(const GfQuatd &rot)
Sets the matrix to specify a rotation equivalent to rot, and clears the translation.
GfMatrix4d & SetZero()
Sets the matrix to zero.
Definition: matrix4d.h:237
bool IsLeftHanded() const
Returns true if the vectors in the upper 3x3 matrix form a left-handed coordinate system.
Definition: matrix4d.h:407
GF_API GfMatrix4d GetOrthonormalized(bool issueWarning=true) const
Returns an orthonormalized copy of the matrix.
GF_API GfQuatd ExtractRotationQuat() const
Return the rotation corresponding to this matrix as a quaternion.
double GetDeterminant3() const
Returns the determinant of the upper 3x3 matrix.
Definition: matrix4d.h:362
GF_API friend GfMatrix4d operator-(const GfMatrix4d &m)
Returns the unary negation of matrix m.
GF_API GfVec3d DecomposeRotation(const GfVec3d &axis0, const GfVec3d &axis1, const GfVec3d &axis2) const
Decompose the rotation corresponding to this matrix about 3 orthogonal axes.
bool IsRightHanded() const
Returns true if the vectors in the upper 3x3 matrix form a right-handed coordinate system.
Definition: matrix4d.h:401
GF_API GfMatrix4d & SetTransform(const GfRotation &rotate, const GfVec3d &translate)
Sets matrix to specify a rotation by rotate and a translation by translate.
GF_API GfMatrix4d & SetRotateOnly(const GfRotation &rot)
Sets the matrix to specify a rotation equivalent to rot, without clearing the translation.
GF_API GfMatrix4d & SetTransform(const GfMatrix3d &rotmx, const GfVec3d &translate)
Sets matrix to specify a rotation by rotmx and a translation by translate.
GF_API bool Factor(GfMatrix4d *r, GfVec3d *s, GfMatrix4d *u, GfVec3d *t, GfMatrix4d *p, double eps=1e-10) const
Factors the matrix into 5 components:
GF_API GfMatrix4d(const GfMatrix3d &rotmx, const GfVec3d &translate)
Constructor.
GF_API GfMatrix4d & SetLookAt(const GfVec3d &eyePoint, const GfRotation &orientation)
Sets the matrix to specify a viewing matrix from a world-space eyePoint and a world-space rotation th...
GF_API GfRotation ExtractRotation() const
Returns the rotation corresponding to this matrix.
GF_API GfMatrix4d & SetLookAt(const GfVec3d &eyePoint, const GfVec3d &centerPoint, const GfVec3d &upDirection)
Sets the matrix to specify a viewing matrix from parameters similar to those used by gluLookAt(3G).
const double * GetArray() const
Returns vector components as a const array of double values.
Definition: matrix4d.h:272
Stores a 4x4 matrix of float elements.
Definition: matrix4f.h:71
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: quatd.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 4 double components.
Definition: vec4d.h:46
static size_t Combine(Args &&... args)
Produce a hash code by combining the hash codes of several objects.
Definition: hash.h:475
double GfDot(const GfDualQuatd &dq1, const GfDualQuatd &dq2)
Return the dot (inner) product of two dual quaternions.
Definition: dualQuatd.h:260
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(GfMatrix4d const &m1, GfMatrix4d 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