All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
matrix4f.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
25 // This file is generated by a script. Do not edit directly. Edit the
26 // matrix4.template.h file to make changes.
27 
28 #ifndef GF_MATRIX4F_H
29 #define GF_MATRIX4F_H
30 
33 
34 #include "pxr/pxr.h"
35 #include "pxr/base/gf/api.h"
36 #include "pxr/base/gf/declare.h"
37 #include "pxr/base/gf/matrixData.h"
38 #include "pxr/base/gf/vec4f.h"
39 #include "pxr/base/gf/traits.h"
40 #include "pxr/base/gf/homogeneous.h"
41 #include "pxr/base/gf/limits.h"
42 #include "pxr/base/gf/math.h"
43 #include "pxr/base/gf/vec3f.h"
44 
45 #include <boost/functional/hash.hpp>
46 
47 #include <iosfwd>
48 #include <vector>
49 
50 PXR_NAMESPACE_OPEN_SCOPE
51 
52 template <>
53 struct GfIsGfMatrix<class GfMatrix4f> { static const bool value = true; };
54 
55 class GfMatrix4d;
56 class GfMatrix4f;
57 class GfQuatf;
58 class GfRotation;
59 class GfMatrix3f;
60 
89 {
90 public:
91  typedef float ScalarType;
92 
93  static const size_t numRows = 4;
94  static const size_t numColumns = 4;
95 
97  GfMatrix4f() = default;
98 
102  GfMatrix4f(float m00, float m01, float m02, float m03,
103  float m10, float m11, float m12, float m13,
104  float m20, float m21, float m22, float m23,
105  float m30, float m31, float m32, float m33) {
106  Set(m00, m01, m02, m03,
107  m10, m11, m12, m13,
108  m20, m21, m22, m23,
109  m30, m31, m32, m33);
110  }
111 
114  GfMatrix4f(const float m[4][4]) {
115  Set(m);
116  }
117 
120  explicit GfMatrix4f(float s) {
121  SetDiagonal(s);
122  }
123 
126  explicit GfMatrix4f(const GfVec4f& v) {
127  SetDiagonal(v);
128  }
129 
136  GF_API
137  explicit GfMatrix4f(const std::vector< std::vector<double> >& v);
138 
145  GF_API
146  explicit GfMatrix4f(const std::vector< std::vector<float> >& v);
147 
154  GF_API
155  explicit GfMatrix4f(const std::vector<double>& r0,
156  const std::vector<double>& r1,
157  const std::vector<double>& r2,
158  const std::vector<double>& r3);
159 
166  GF_API
167  explicit GfMatrix4f(const std::vector<float>& r0,
168  const std::vector<float>& r1,
169  const std::vector<float>& r2,
170  const std::vector<float>& r3);
171 
174  GF_API
175  GfMatrix4f(const GfRotation& rotate,
176  const GfVec3f& translate);
177 
180  GF_API
181  GfMatrix4f(const GfMatrix3f& rotmx,
182  const GfVec3f& translate);
184  GF_API
185  explicit GfMatrix4f(const class GfMatrix4d& m);
186 
188  void SetRow(int i, const GfVec4f & v) {
189  _mtx[i][0] = v[0];
190  _mtx[i][1] = v[1];
191  _mtx[i][2] = v[2];
192  _mtx[i][3] = v[3];
193  }
194 
196  void SetColumn(int i, const GfVec4f & v) {
197  _mtx[0][i] = v[0];
198  _mtx[1][i] = v[1];
199  _mtx[2][i] = v[2];
200  _mtx[3][i] = v[3];
201  }
202 
204  GfVec4f GetRow(int i) const {
205  return GfVec4f(_mtx[i][0], _mtx[i][1], _mtx[i][2], _mtx[i][3]);
206  }
207 
209  GfVec4f GetColumn(int i) const {
210  return GfVec4f(_mtx[0][i], _mtx[1][i], _mtx[2][i], _mtx[3][i]);
211  }
212 
216  GfMatrix4f& Set(float m00, float m01, float m02, float m03,
217  float m10, float m11, float m12, float m13,
218  float m20, float m21, float m22, float m23,
219  float m30, float m31, float m32, float m33) {
220  _mtx[0][0] = m00; _mtx[0][1] = m01; _mtx[0][2] = m02; _mtx[0][3] = m03;
221  _mtx[1][0] = m10; _mtx[1][1] = m11; _mtx[1][2] = m12; _mtx[1][3] = m13;
222  _mtx[2][0] = m20; _mtx[2][1] = m21; _mtx[2][2] = m22; _mtx[2][3] = m23;
223  _mtx[3][0] = m30; _mtx[3][1] = m31; _mtx[3][2] = m32; _mtx[3][3] = m33;
224  return *this;
225  }
226 
229  GfMatrix4f& Set(const float m[4][4]) {
230  _mtx[0][0] = m[0][0];
231  _mtx[0][1] = m[0][1];
232  _mtx[0][2] = m[0][2];
233  _mtx[0][3] = m[0][3];
234  _mtx[1][0] = m[1][0];
235  _mtx[1][1] = m[1][1];
236  _mtx[1][2] = m[1][2];
237  _mtx[1][3] = m[1][3];
238  _mtx[2][0] = m[2][0];
239  _mtx[2][1] = m[2][1];
240  _mtx[2][2] = m[2][2];
241  _mtx[2][3] = m[2][3];
242  _mtx[3][0] = m[3][0];
243  _mtx[3][1] = m[3][1];
244  _mtx[3][2] = m[3][2];
245  _mtx[3][3] = m[3][3];
246  return *this;
247  }
248 
251  return SetDiagonal(1);
252  }
253 
256  return SetDiagonal(0);
257  }
258 
260  GF_API
261  GfMatrix4f& SetDiagonal(float s);
262 
264  GF_API
265  GfMatrix4f& SetDiagonal(const GfVec4f&);
266 
269  GF_API
270  float* Get(float m[4][4]) const;
271 
274  float* data() {
275  return _mtx.GetData();
276  }
277 
280  const float* data() const {
281  return _mtx.GetData();
282  }
283 
285  float* GetArray() {
286  return _mtx.GetData();
287  }
288 
290  const float* GetArray() const {
291  return _mtx.GetData();
292  }
293 
297  float* operator [](int i) { return _mtx[i]; }
298 
302  const float* operator [](int i) const { return _mtx[i]; }
303 
305  friend inline size_t hash_value(GfMatrix4f const &m) {
306  int nElems = 4 * 4;
307  size_t h = 0;
308  const float *p = m.GetArray();
309  while (nElems--)
310  boost::hash_combine(h, *p++);
311  return h;
312  }
313 
316  GF_API
317  bool operator ==(const GfMatrix4d& m) const;
318 
321  GF_API
322  bool operator ==(const GfMatrix4f& m) const;
323 
326  bool operator !=(const GfMatrix4d& m) const {
327  return !(*this == m);
328  }
329 
332  bool operator !=(const GfMatrix4f& m) const {
333  return !(*this == m);
334  }
335 
337  GF_API
338  GfMatrix4f GetTranspose() const;
339 
345  GF_API
346  GfMatrix4f GetInverse(double* det = NULL, double eps = 0) const;
347 
349  GF_API
350  double GetDeterminant() const;
351 
354  void SetRow3(int i, const GfVec3f & v) {
355  _mtx[i][0] = v[0];
356  _mtx[i][1] = v[1];
357  _mtx[i][2] = v[2];
358  }
359 
361  GfVec3f GetRow3(int i) const {
362  return GfVec3f(_mtx[i][0], _mtx[i][1], _mtx[i][2]);
363  }
364 
368  double GetDeterminant3() const {
369  return _GetDeterminant3(0, 1, 2, 0, 1, 2);
370  }
371 
375  bool HasOrthogonalRows3() const {
376  // XXX Should add GfAreOrthogonal(v0, v1, v2) (which also
377  // GfRotation::Decompose() could use).
378  GfVec3f axis0(GetRow3(0)), axis1(GetRow3(1)), axis2(GetRow3(2));
379  return (GfAbs(GfDot(axis0, axis1)) < GF_MIN_ORTHO_TOLERANCE &&
380  GfAbs(GfDot(axis0, axis2)) < GF_MIN_ORTHO_TOLERANCE &&
381  GfAbs(GfDot(axis1, axis2)) < GF_MIN_ORTHO_TOLERANCE);
382  }
383 
392  GF_API
393  bool Orthonormalize(bool issueWarning=true);
394 
396  GF_API
397  GfMatrix4f GetOrthonormalized(bool issueWarning=true) const;
398 
402  GF_API
403  double GetHandedness() const;
404 
407  bool IsRightHanded() const {
408  return GetHandedness() == 1.0;
409  }
410 
413  bool IsLeftHanded() const {
414  return GetHandedness() == -1.0;
415  }
416 
418  GF_API
419  GfMatrix4f& operator *=(const GfMatrix4f& m);
420 
422  GF_API
423  GfMatrix4f& operator *=(double);
424 
426  friend GfMatrix4f operator *(const GfMatrix4f& m1, double d)
427  {
428  GfMatrix4f m = m1;
429  return m *= d;
430  }
431 
433  // Returns the product of a matrix and a float.
434  friend GfMatrix4f operator *(double d, const GfMatrix4f& m)
435  {
436  return m * d;
437  }
438 
440  GF_API
441  GfMatrix4f& operator +=(const GfMatrix4f& m);
442 
444  GF_API
445  GfMatrix4f& operator -=(const GfMatrix4f& m);
446 
448  GF_API
449  friend GfMatrix4f operator -(const GfMatrix4f& m);
450 
452  friend GfMatrix4f operator +(const GfMatrix4f& m1, const GfMatrix4f& m2)
453  {
454  GfMatrix4f tmp(m1);
455  tmp += m2;
456  return tmp;
457  }
458 
460  friend GfMatrix4f operator -(const GfMatrix4f& m1, const GfMatrix4f& m2)
461  {
462  GfMatrix4f tmp(m1);
463  tmp -= m2;
464  return tmp;
465  }
466 
468  friend GfMatrix4f operator *(const GfMatrix4f& m1, const GfMatrix4f& m2)
469  {
470  GfMatrix4f tmp(m1);
471  tmp *= m2;
472  return tmp;
473  }
474 
476  friend GfMatrix4f operator /(const GfMatrix4f& m1, const GfMatrix4f& m2)
477  {
478  return(m1 * m2.GetInverse());
479  }
480 
482  friend inline GfVec4f operator *(const GfMatrix4f& m, const GfVec4f& vec) {
483  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],
484  vec[0] * m._mtx[1][0] + vec[1] * m._mtx[1][1] + vec[2] * m._mtx[1][2] + vec[3] * m._mtx[1][3],
485  vec[0] * m._mtx[2][0] + vec[1] * m._mtx[2][1] + vec[2] * m._mtx[2][2] + vec[3] * m._mtx[2][3],
486  vec[0] * m._mtx[3][0] + vec[1] * m._mtx[3][1] + vec[2] * m._mtx[3][2] + vec[3] * m._mtx[3][3]);
487  }
488 
490  friend inline GfVec4f operator *(const GfVec4f &vec, const GfMatrix4f& m) {
491  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],
492  vec[0] * m._mtx[0][1] + vec[1] * m._mtx[1][1] + vec[2] * m._mtx[2][1] + vec[3] * m._mtx[3][1],
493  vec[0] * m._mtx[0][2] + vec[1] * m._mtx[1][2] + vec[2] * m._mtx[2][2] + vec[3] * m._mtx[3][2],
494  vec[0] * m._mtx[0][3] + vec[1] * m._mtx[1][3] + vec[2] * m._mtx[2][3] + vec[3] * m._mtx[3][3]);
495  }
496 
498  GF_API
499  GfMatrix4f& SetScale(float scaleFactor);
500 
504  GF_API
506 
509 
512  GF_API
513  GfMatrix4f& SetRotate(const GfQuatf &rot);
514 
517  GF_API
518  GfMatrix4f& SetRotateOnly(const GfQuatf &rot);
519 
522  GF_API
523  GfMatrix4f& SetRotate(const GfRotation &rot);
524 
527  GF_API
528  GfMatrix4f& SetRotateOnly(const GfRotation &rot);
529 
532  GF_API
533  GfMatrix4f& SetRotate(const GfMatrix3f &mx);
534 
537  GF_API
538  GfMatrix4f& SetRotateOnly(const GfMatrix3f &mx);
539 
542  GF_API
543  GfMatrix4f& SetScale(const GfVec3f &scaleFactors);
544 
547  GF_API
548  GfMatrix4f& SetTranslate(const GfVec3f &trans);
549 
552  GF_API
554 
557  GF_API
558  GfMatrix4f& SetTransform(const GfRotation& rotate,
559  const GfVec3f& translate);
560 
563  GF_API
564  GfMatrix4f& SetTransform(const GfMatrix3f& rotmx,
565  const GfVec3f& translate);
566 
572  GF_API
573  GfMatrix4f& SetLookAt(const GfVec3f &eyePoint,
574  const GfVec3f &centerPoint,
575  const GfVec3f &upDirection);
576 
582  GF_API
583  GfMatrix4f& SetLookAt(const GfVec3f &eyePoint,
584  const GfRotation &orientation);
585 
600  GF_API
601  bool Factor(GfMatrix4f* r, GfVec3f* s, GfMatrix4f* u,
602  GfVec3f* t, GfMatrix4f* p,
603  float eps = 1e-5) const;
604 
608  return GfVec3f(_mtx[3][0], _mtx[3][1], _mtx[3][2]);
609  }
610 
616  GF_API
617  GfRotation ExtractRotation() const;
618 
624  GF_API
625  GfVec3f DecomposeRotation(const GfVec3f &axis0,
626  const GfVec3f &axis1,
627  const GfVec3f &axis2) const;
628 
634  GF_API
636 
640  GfVec3d Transform(const GfVec3d &vec) const {
641  return GfProject(GfVec4d(
642  vec[0] * _mtx[0][0] + vec[1] * _mtx[1][0] + vec[2] * _mtx[2][0] + _mtx[3][0],
643  vec[0] * _mtx[0][1] + vec[1] * _mtx[1][1] + vec[2] * _mtx[2][1] + _mtx[3][1],
644  vec[0] * _mtx[0][2] + vec[1] * _mtx[1][2] + vec[2] * _mtx[2][2] + _mtx[3][2],
645  vec[0] * _mtx[0][3] + vec[1] * _mtx[1][3] + vec[2] * _mtx[2][3] + _mtx[3][3]));
646  }
647 
652  GfVec3f Transform(const GfVec3f &vec) const {
653  return (GfProject(GfVec4f(
654  vec[0] * _mtx[0][0] + vec[1] * _mtx[1][0] + vec[2] * _mtx[2][0] + _mtx[3][0],
655  vec[0] * _mtx[0][1] + vec[1] * _mtx[1][1] + vec[2] * _mtx[2][1] + _mtx[3][1],
656  vec[0] * _mtx[0][2] + vec[1] * _mtx[1][2] + vec[2] * _mtx[2][2] + _mtx[3][2],
657  vec[0] * _mtx[0][3] + vec[1] * _mtx[1][3] + vec[2] * _mtx[2][3] + _mtx[3][3])));
658  }
659 
664  GfVec3d TransformDir(const GfVec3d &vec) const {
665  return GfVec3d(
666  vec[0] * _mtx[0][0] + vec[1] * _mtx[1][0] + vec[2] * _mtx[2][0],
667  vec[0] * _mtx[0][1] + vec[1] * _mtx[1][1] + vec[2] * _mtx[2][1],
668  vec[0] * _mtx[0][2] + vec[1] * _mtx[1][2] + vec[2] * _mtx[2][2]);
669  }
670 
677  GfVec3f TransformDir(const GfVec3f &vec) const {
678  return GfVec3f(
679  vec[0] * _mtx[0][0] + vec[1] * _mtx[1][0] + vec[2] * _mtx[2][0],
680  vec[0] * _mtx[0][1] + vec[1] * _mtx[1][1] + vec[2] * _mtx[2][1],
681  vec[0] * _mtx[0][2] + vec[1] * _mtx[1][2] + vec[2] * _mtx[2][2]);
682  }
683 
688  GfVec3d TransformAffine(const GfVec3d &vec) const {
689  return GfVec3d(
690  vec[0] * _mtx[0][0] + vec[1] * _mtx[1][0] + vec[2] * _mtx[2][0] + _mtx[3][0],
691  vec[0] * _mtx[0][1] + vec[1] * _mtx[1][1] + vec[2] * _mtx[2][1] + _mtx[3][1],
692  vec[0] * _mtx[0][2] + vec[1] * _mtx[1][2] + vec[2] * _mtx[2][2] + _mtx[3][2]);
693  }
694 
699  GfVec3f TransformAffine(const GfVec3f &vec) const {
700  return GfVec3f(
701  vec[0] * _mtx[0][0] + vec[1] * _mtx[1][0] + vec[2] * _mtx[2][0] + _mtx[3][0],
702  vec[0] * _mtx[0][1] + vec[1] * _mtx[1][1] + vec[2] * _mtx[2][1] + _mtx[3][1],
703  vec[0] * _mtx[0][2] + vec[1] * _mtx[1][2] + vec[2] * _mtx[2][2] + _mtx[3][2]);
704  }
706 
707 private:
710  GF_API
711  double _GetDeterminant3(size_t row1, size_t row2, size_t row3,
712  size_t col1, size_t col2, size_t col3) const;
713 
715  void _Jacobi3(GfVec3d *eigenvalues, GfVec3d eigenvectors[3]) const;
716 
719  void _SetRotateFromQuat(float r, const GfVec3f& i);
720 
721 
722 private:
724  GfMatrixData<float, 4, 4> _mtx;
725 
726  // Friend declarations
727  friend class GfMatrix4d;
728 };
729 
730 
734 GF_API
735 bool GfIsClose(GfMatrix4f const &m1, GfMatrix4f const &m2, double tolerance);
736 
739 GF_API std::ostream& operator<<(std::ostream &, GfMatrix4f const &);
740 
741 PXR_NAMESPACE_CLOSE_SCOPE
742 
743 #endif // GF_MATRIX4F_H
GfVec3f GfProject(const GfVec4f &v)
Projects homogeneous v into Euclidean space and returns the result as a Vec3f.
Definition: homogeneous.h:65
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.
GF_API GfMatrix4f & SetTranslateOnly(const GfVec3f &t)
Sets matrix to specify a translation by the vector trans, without clearing the rotation.
Stores a 4x4 matrix of float elements.
Definition: matrix4f.h:88
GF_API GfMatrix4f GetTranspose() const
Returns the transpose of the matrix.
GF_API friend GfMatrix4f operator-(const GfMatrix4f &m)
Returns the unary negation of matrix m.
GF_API bool operator==(const GfMatrix4d &m) const
Tests for element-wise matrix equality.
bool GfIsClose(double a, double b, double epsilon)
Returns true if a and b are with epsilon of each other.
Definition: math.h:39
friend GfMatrix4f operator+(const GfMatrix4f &m1, const GfMatrix4f &m2)
Adds matrix m2 to m1.
Definition: matrix4f.h:452
GF_API GfMatrix4f & SetTranslate(const GfVec3f &trans)
Sets matrix to specify a translation by the vector trans, and clears the rotation.
GF_API double GetDeterminant() const
Returns the determinant of the matrix.
GF_API double GetHandedness() const
Returns the sign of the determinant of the upper 3x3 matrix, i.e.
float * data()
Returns raw access to components of matrix as an array of float values.
Definition: matrix4f.h:274
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...
GfVec3f ExtractTranslation() const
Returns the translation part of the matrix, defined as the first three elements of the last row...
Definition: matrix4f.h:607
Basic type for a vector of 3 float components.
Definition: vec3f.h:63
Basic type for a vector of 4 double components.
Definition: vec4d.h:63
GfVec3f Transform(const GfVec3f &vec) const
Transforms the row vector vec by the matrix, returning the result.
Definition: matrix4f.h:652
double GfAbs(double f)
Return abs(f).
Definition: math.h:112
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)...
Basic type: a quaternion, a complex number with a real coefficient and three imaginary coefficients...
Definition: quatf.h:60
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:297
void SetColumn(int i, const GfVec4f &v)
Sets a column of the matrix from a Vec4.
Definition: matrix4f.h:196
GF_API GfMatrix3f ExtractRotationMatrix() const
Returns the rotation corresponding to this matrix.
#define GF_MIN_ORTHO_TOLERANCE
This constant is used to determine when a set of basis vectors is close to orthogonal.
Definition: limits.h:39
GF_API GfMatrix4f & SetRotate(const GfQuatf &rot)
Sets the matrix to specify a rotation equivalent to rot, and clears 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:
Stores a 3x3 matrix of float elements.
Definition: matrix3f.h:82
GF_API GfMatrix4f & operator-=(const GfMatrix4f &m)
Subtracts matrix m from this matrix.
GfMatrix4f(const float m[4][4])
Constructor.
Definition: matrix4f.h:114
GfVec3d Transform(const GfVec3d &vec) const
Transforms the row vector vec by the matrix, returning the result.
Definition: matrix4f.h:640
friend GfMatrix4f operator*(const GfMatrix4f &m1, double d)
Returns the product of a matrix and a float.
Definition: matrix4f.h:426
GF_API GfMatrix4f & SetDiagonal(float s)
Sets the matrix to s times the identity matrix.
GfMatrix4f()=default
Default constructor. Leaves the matrix component values undefined.
Stores a 4x4 matrix of double elements.
Definition: matrix4d.h:88
A metafunction with a static const bool member &#39;value&#39; that is true for GfMatrix types, like GfMatrix3d, GfMatrix4f, etc and false for all other types.
Definition: traits.h:40
friend size_t hash_value(GfMatrix4f const &m)
Hash.
Definition: matrix4f.h:305
const float * GetArray() const
Returns vector components as a const array of float values.
Definition: matrix4f.h:290
bool HasOrthogonalRows3() const
Returns true, if the row vectors of the upper 3x3 matrix form an orthogonal basis.
Definition: matrix4f.h:375
GF_API GfMatrix4f & SetScale(float scaleFactor)
Sets matrix to specify a uniform scaling by scaleFactor.
const float * data() const
Returns const raw access to components of matrix as an array of float values.
Definition: matrix4f.h:280
GF_API GfMatrix4f & operator+=(const GfMatrix4f &m)
Adds matrix m to this 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.
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:229
GF_API GfMatrix4f GetOrthonormalized(bool issueWarning=true) const
Returns an orthonormalized copy of the matrix.
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:102
Basic type for a vector of 4 float components.
Definition: vec4f.h:63
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
float * GetArray()
Returns vector components as an array of float values.
Definition: matrix4f.h:285
GfVec3d TransformDir(const GfVec3d &vec) const
Transforms row vector vec by the matrix, returning the result.
Definition: matrix4f.h:664
GfMatrix4f(float s)
Constructor.
Definition: matrix4f.h:120
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...
bool IsLeftHanded() const
Returns true if the vectors in the upper 3x3 matrix form a left-handed coordinate system...
Definition: matrix4f.h:413
GfMatrix4f & SetIdentity()
Sets the matrix to the identity matrix.
Definition: matrix4f.h:250
double GetDeterminant3() const
Returns the determinant of the upper 3x3 matrix.
Definition: matrix4f.h:368
GF_API bool Orthonormalize(bool issueWarning=true)
Makes the matrix orthonormal in place.
friend GfMatrix4f operator/(const GfMatrix4f &m1, const GfMatrix4f &m2)
Divides matrix m1 by m2 (that is, m1 * inv(m2)).
Definition: matrix4f.h:476
void SetRow(int i, const GfVec4f &v)
Sets a row of the matrix from a Vec4.
Definition: matrix4f.h:188
GfVec4f GetColumn(int i) const
Gets a column of the matrix as a Vec4.
Definition: matrix4f.h:209
Basic type for a vector of 3 double components.
Definition: vec3d.h:63
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:216
GF_API GfMatrix4f & SetRotateOnly(const GfQuatf &rot)
Sets the matrix to specify a rotation equivalent to rot, without clearing the translation.
GfVec3f TransformAffine(const GfVec3f &vec) const
Transforms the row vector vec by the matrix, returning the result.
Definition: matrix4f.h:699
GfVec3d TransformAffine(const GfVec3d &vec) const
Transforms the row vector vec by the matrix, returning the result.
Definition: matrix4f.h:688
GF_API GfMatrix4f & SetTransform(const GfRotation &rotate, const GfVec3f &translate)
Sets matrix to specify a rotation by rotate and a translation by translate.
GfMatrix4f(const GfVec4f &v)
Constructor.
Definition: matrix4f.h:126
bool operator!=(const GfMatrix4d &m) const
Tests for element-wise matrix inequality.
Definition: matrix4f.h:326
GF_API GfMatrix4f & operator*=(const GfMatrix4f &m)
Post-multiplies matrix m into this matrix.
Basic type: 3-space rotation specification.
Definition: rotation.h:55
bool IsRightHanded() const
Returns true if the vectors in the upper 3x3 matrix form a right-handed coordinate system...
Definition: matrix4f.h:407
void SetRow3(int i, const GfVec3f &v)
Sets a row of the matrix from a Vec3.
Definition: matrix4f.h:354
GfVec3f GetRow3(int i) const
Gets a row of the matrix as a Vec3.
Definition: matrix4f.h:361
GfVec3f TransformDir(const GfVec3f &vec) const
Transforms row vector vec by the matrix, returning the result.
Definition: matrix4f.h:677
GfHalf GfDot(GfHalf a, GfHalf b)
Returns the dot (inner) product of two vectors.
Definition: half.h:55
GfMatrix4f & SetZero()
Sets the matrix to zero.
Definition: matrix4f.h:255
GfVec4f GetRow(int i) const
Gets a row of the matrix as a Vec4.
Definition: matrix4f.h:204