11 #ifndef PXR_BASE_GF_MATRIX4F_H
12 #define PXR_BASE_GF_MATRIX4F_H
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,
120 explicit GfMatrix4f(
const std::vector< std::vector<double> >&
v);
129 explicit GfMatrix4f(
const std::vector< std::vector<float> >&
v);
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);
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);
188 return GfVec4f(_mtx[i][0], _mtx[i][1], _mtx[i][2], _mtx[i][3]);
193 return GfVec4f(_mtx[0][i], _mtx[1][i], _mtx[2][i], _mtx[3][i]);
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;
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];
253 float*
Get(
float m[4][4])
const;
322 return !(*
this == m);
328 return !(*
this == m);
357 return GfVec3f(_mtx[i][0], _mtx[i][1], _mtx[i][2]);
364 return _GetDeterminant3(0, 1, 2, 0, 1, 2);
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]);
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]);
598 float eps = 1e-5)
const;
603 return GfVec3f(_mtx[3][0], _mtx[3][1], _mtx[3][2]);
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]));
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])));
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]);
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]);
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]);
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]);
714 double _GetDeterminant3(
size_t row1,
size_t row2,
size_t row3,
715 size_t col1,
size_t col2,
size_t col3)
const;
718 void _Jacobi3(
GfVec3d *eigenvalues,
GfVec3d eigenvectors[3])
const;
722 void _SetRotateFromQuat(
float r,
const GfVec3f& i);
746 #endif // PXR_BASE_GF_MATRIX4F_H
bool HasOrthogonalRows3() const
GfVec3f GfProject(const GfVec4f &v)
GF_API GfVec3f DecomposeRotation(const GfVec3f &axis0, const GfVec3f &axis1, const GfVec3f &axis2) const
GfVec4f GetRow(int i) const
Gets a row of the matrix as a Vec4.
GF_API std::ostream & operator<<(std::ostream &, GfMatrix4f const &)
GfVec3f TransformDir(const GfVec3f &vec) const
GF_API friend GfMatrix4f operator-(const GfMatrix4f &m)
Returns the unary negation of matrix m.
static const size_t numRows
GF_API GfMatrix4f & operator*=(const GfMatrix4f &m)
Post-multiplies matrix m into this matrix.
GF_API GfMatrix4f & SetDiagonal(float s)
Sets the matrix to s times the identity matrix.
friend GfMatrix4f operator+(const GfMatrix4f &m1, const GfMatrix4f &m2)
Adds matrix m2 to m1.
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the and then *wait for them to all complete We provide a helper class
bool IsLeftHanded() const
GF_API GfMatrix4f & operator+=(const GfMatrix4f &m)
Adds matrix m to this matrix.
#define PXR_NAMESPACE_OPEN_SCOPE
GLsizei const GLfloat * value
GF_API GfMatrix4f & SetRotate(const GfQuatf &rot)
GA_API const UT_StringHolder rot
GF_API GfMatrix4f & SetRotateOnly(const GfQuatf &rot)
GfVec3d TransformDir(const GfVec3d &vec) const
GfVec4f GetColumn(int i) const
Gets a column of the matrix as a Vec4.
GF_API GfQuatf ExtractRotationQuat() const
GF_API GfMatrix3f ExtractRotationMatrix() const
GF_API GfMatrix4f & SetTranslateOnly(const GfVec3f &t)
void SetRow3(int i, const GfVec3f &v)
GF_API GfMatrix4f GetInverse(double *det=NULL, double eps=0) const
GF_API GfMatrix4f RemoveScaleShear() const
GF_API bool Orthonormalize(bool issueWarning=true)
void SetColumn(int i, const GfVec4f &v)
Sets a column of the matrix from a Vec4.
bool IsRightHanded() const
friend GfMatrix4f operator*(const GfMatrix4f &m1, double d)
Returns the product of a matrix and a float.
GF_API float * Get(float m[4][4]) const
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)
GF_API GfMatrix4f & SetScale(float scaleFactor)
Sets matrix to specify a uniform scaling by scaleFactor.
GF_API GfMatrix4f & SetTransform(const GfRotation &rotate, const GfVec3f &translate)
GfVec3d Transform(const GfVec3d &vec) const
double GetDeterminant3() const
T * GetData()
Return a pointer to the start of all the data.
GA_API const UT_StringHolder trans
GfVec3f GetRow3(int i) const
Gets a row of the matrix as a Vec3.
friend size_t hash_value(GfMatrix4f const &m)
Hash.
GF_API double GetHandedness() const
GF_API bool Factor(GfMatrix4f *r, GfVec3f *s, GfMatrix4f *u, GfVec3f *t, GfMatrix4f *p, float eps=1e-5) const
float * operator[](int i)
GfMatrix4f & SetZero()
Sets the matrix to zero.
GF_API bool operator==(const GfMatrix4d &m) const
double GfDot(const GfDualQuatd &dq1, const GfDualQuatd &dq2)
Return the dot (inner) product of two dual quaternions.
ImageBuf OIIO_API rotate(const ImageBuf &src, float angle, string_view filtername=string_view(), float filterwidth=0.0f, bool recompute_roi=false, ROI roi={}, int nthreads=0)
GfMatrix4f(const GfVec4f &v)
GfMatrix4f & SetIdentity()
Sets the matrix to the identity matrix.
GF_API GfMatrix4f GetTranspose() const
Returns the transpose of the matrix.
GF_API GfMatrix4f & SetTranslate(const GfVec3f &trans)
GF_API GfMatrix4f & SetLookAt(const GfVec3f &eyePoint, const GfVec3f ¢erPoint, const GfVec3f &upDirection)
static size_t Combine(Args &&...args)
Produce a hash code by combining the hash codes of several objects.
GfMatrix4f & Set(const float m[4][4])
GfMatrix4f(const float m[4][4])
friend GfMatrix4f operator/(const GfMatrix4f &m1, const GfMatrix4f &m2)
Divides matrix m1 by m2 (that is, m1 * inv(m2)).
GF_API double GetDeterminant() const
Returns the determinant of the matrix.
GF_API bool GfIsClose(GfMatrix4f const &m1, GfMatrix4f const &m2, double tolerance)
GfVec3f ExtractTranslation() const
#define PXR_NAMESPACE_CLOSE_SCOPE
GfVec3f TransformAffine(const GfVec3f &vec) const
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)
GF_API GfRotation ExtractRotation() const
GfVec3f Transform(const GfVec3f &vec) const
PUGI__FN char_t * translate(char_t *buffer, const char_t *from, const char_t *to, size_t to_length)
static const size_t numColumns
GF_API GfMatrix4f & operator-=(const GfMatrix4f &m)
Subtracts matrix m from this matrix.
GfVec3d TransformAffine(const GfVec3d &vec) const
void SetRow(int i, const GfVec4f &v)
Sets a row of the matrix from a Vec4.
GF_API GfMatrix4f GetOrthonormalized(bool issueWarning=true) const
Returns an orthonormalized copy of the matrix.
#define GF_MIN_ORTHO_TOLERANCE
const float * data() const
float * GetArray()
Returns vector components as an array of float values.
bool operator!=(const GfMatrix4d &m) const
const float * GetArray() const
Returns vector components as a const array of float values.