28 #ifndef PXR_BASE_GF_MATRIX4D_H
29 #define PXR_BASE_GF_MATRIX4D_H
102 double m10,
double m11,
double m12,
double m13,
103 double m20,
double m21,
double m22,
double m23,
104 double m30,
double m31,
double m32,
double m33) {
105 Set(m00, m01, m02, m03,
136 explicit GfMatrix4d(
const std::vector< std::vector<double> >&
v);
145 explicit GfMatrix4d(
const std::vector< std::vector<float> >&
v);
154 explicit GfMatrix4d(
const std::vector<double>& r0,
155 const std::vector<double>& r1,
156 const std::vector<double>& r2,
157 const std::vector<double>& r3);
166 explicit GfMatrix4d(
const std::vector<float>& r0,
167 const std::vector<float>& r1,
168 const std::vector<float>& r2,
169 const std::vector<float>& r3);
204 return GfVec4d(_mtx[i][0], _mtx[i][1], _mtx[i][2], _mtx[i][3]);
209 return GfVec4d(_mtx[0][i], _mtx[1][i], _mtx[2][i], _mtx[3][i]);
216 double m10,
double m11,
double m12,
double m13,
217 double m20,
double m21,
double m22,
double m23,
218 double m30,
double m31,
double m32,
double m33) {
219 _mtx[0][0] = m00; _mtx[0][1] = m01; _mtx[0][2] = m02; _mtx[0][3] = m03;
220 _mtx[1][0] = m10; _mtx[1][1] = m11; _mtx[1][2] = m12; _mtx[1][3] = m13;
221 _mtx[2][0] = m20; _mtx[2][1] = m21; _mtx[2][2] = m22; _mtx[2][3] = m23;
222 _mtx[3][0] = m30; _mtx[3][1] = m31; _mtx[3][2] = m32; _mtx[3][3] = m33;
229 _mtx[0][0] = m[0][0];
230 _mtx[0][1] = m[0][1];
231 _mtx[0][2] = m[0][2];
232 _mtx[0][3] = m[0][3];
233 _mtx[1][0] = m[1][0];
234 _mtx[1][1] = m[1][1];
235 _mtx[1][2] = m[1][2];
236 _mtx[1][3] = m[1][3];
237 _mtx[2][0] = m[2][0];
238 _mtx[2][1] = m[2][1];
239 _mtx[2][2] = m[2][2];
240 _mtx[2][3] = m[2][3];
241 _mtx[3][0] = m[3][0];
242 _mtx[3][1] = m[3][1];
243 _mtx[3][2] = m[3][2];
244 _mtx[3][3] = m[3][3];
269 double*
Get(
double m[4][4])
const;
338 return !(*
this == m);
344 return !(*
this == m);
373 return GfVec3d(_mtx[i][0], _mtx[i][1], _mtx[i][2]);
380 return _GetDeterminant3(0, 1, 2, 0, 1, 2);
494 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],
495 vec[0] * m._mtx[1][0] + vec[1] * m._mtx[1][1] + vec[2] * m._mtx[1][2] + vec[3] * m._mtx[1][3],
496 vec[0] * m._mtx[2][0] + vec[1] * m._mtx[2][1] + vec[2] * m._mtx[2][2] + vec[3] * m._mtx[2][3],
497 vec[0] * m._mtx[3][0] + vec[1] * m._mtx[3][1] + vec[2] * m._mtx[3][2] + vec[3] * m._mtx[3][3]);
502 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],
503 vec[0] * m._mtx[0][1] + vec[1] * m._mtx[1][1] + vec[2] * m._mtx[2][1] + vec[3] * m._mtx[3][1],
504 vec[0] * m._mtx[0][2] + vec[1] * m._mtx[1][2] + vec[2] * m._mtx[2][2] + vec[3] * m._mtx[3][2],
505 vec[0] * m._mtx[0][3] + vec[1] * m._mtx[1][3] + vec[2] * m._mtx[2][3] + vec[3] * m._mtx[3][3]);
624 double eps = 1e-10)
const;
629 return GfVec3d(_mtx[3][0], _mtx[3][1], _mtx[3][2]);
671 vec[0] * _mtx[0][0] + vec[1] * _mtx[1][0] + vec[2] * _mtx[2][0] + _mtx[3][0],
672 vec[0] * _mtx[0][1] + vec[1] * _mtx[1][1] + vec[2] * _mtx[2][1] + _mtx[3][1],
673 vec[0] * _mtx[0][2] + vec[1] * _mtx[1][2] + vec[2] * _mtx[2][2] + _mtx[3][2],
674 vec[0] * _mtx[0][3] + vec[1] * _mtx[1][3] + vec[2] * _mtx[2][3] + _mtx[3][3]));
683 vec[0] * _mtx[0][0] + vec[1] * _mtx[1][0] + vec[2] * _mtx[2][0] + _mtx[3][0],
684 vec[0] * _mtx[0][1] + vec[1] * _mtx[1][1] + vec[2] * _mtx[2][1] + _mtx[3][1],
685 vec[0] * _mtx[0][2] + vec[1] * _mtx[1][2] + vec[2] * _mtx[2][2] + _mtx[3][2],
686 vec[0] * _mtx[0][3] + vec[1] * _mtx[1][3] + vec[2] * _mtx[2][3] + _mtx[3][3])));
695 vec[0] * _mtx[0][0] + vec[1] * _mtx[1][0] + vec[2] * _mtx[2][0],
696 vec[0] * _mtx[0][1] + vec[1] * _mtx[1][1] + vec[2] * _mtx[2][1],
697 vec[0] * _mtx[0][2] + vec[1] * _mtx[1][2] + vec[2] * _mtx[2][2]);
708 vec[0] * _mtx[0][0] + vec[1] * _mtx[1][0] + vec[2] * _mtx[2][0],
709 vec[0] * _mtx[0][1] + vec[1] * _mtx[1][1] + vec[2] * _mtx[2][1],
710 vec[0] * _mtx[0][2] + vec[1] * _mtx[1][2] + vec[2] * _mtx[2][2]);
719 vec[0] * _mtx[0][0] + vec[1] * _mtx[1][0] + vec[2] * _mtx[2][0] + _mtx[3][0],
720 vec[0] * _mtx[0][1] + vec[1] * _mtx[1][1] + vec[2] * _mtx[2][1] + _mtx[3][1],
721 vec[0] * _mtx[0][2] + vec[1] * _mtx[1][2] + vec[2] * _mtx[2][2] + _mtx[3][2]);
730 vec[0] * _mtx[0][0] + vec[1] * _mtx[1][0] + vec[2] * _mtx[2][0] + _mtx[3][0],
731 vec[0] * _mtx[0][1] + vec[1] * _mtx[1][1] + vec[2] * _mtx[2][1] + _mtx[3][1],
732 vec[0] * _mtx[0][2] + vec[1] * _mtx[1][2] + vec[2] * _mtx[2][2] + _mtx[3][2]);
740 double _GetDeterminant3(
size_t row1,
size_t row2,
size_t row3,
741 size_t col1,
size_t col2,
size_t col3)
const;
744 void _Jacobi3(
GfVec3d *eigenvalues,
GfVec3d eigenvectors[3])
const;
748 void _SetRotateFromQuat(
double r,
const GfVec3d& i);
772 #endif // PXR_BASE_GF_MATRIX4D_H
const double * GetArray() const
Returns vector components as a const array of double values.
GfMatrix4d & SetIdentity()
Sets the matrix to the identity matrix.
GF_API GfMatrix4d & SetRotate(const GfQuatd &rot)
GfVec3f GfProject(const GfVec4f &v)
friend GfMatrix4d operator*(const GfMatrix4d &m1, double d)
Returns the product of a matrix and a double.
GF_API double * Get(double m[4][4]) const
GF_API GfMatrix4d & operator*=(const GfMatrix4d &m)
Post-multiplies matrix m into this matrix.
GF_API bool Orthonormalize(bool issueWarning=true)
GF_API bool operator==(const GfMatrix4d &m) const
bool IsRightHanded() const
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)
bool IsLeftHanded() const
GF_API GfMatrix4d & SetScale(double scaleFactor)
Sets matrix to specify a uniform scaling by scaleFactor.
static const size_t numColumns
*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
GF_API GfMatrix4d GetInverse(double *det=NULL, double eps=0) const
GfVec3f TransformAffine(const GfVec3f &vec) const
friend GfMatrix4d operator+(const GfMatrix4d &m1, const GfMatrix4d &m2)
Adds matrix m2 to m1.
GF_API GfMatrix4d & SetTranslate(const GfVec3d &trans)
GA_API const UT_StringHolder rot
void SetColumn(int i, const GfVec4d &v)
Sets a column of the matrix from a Vec4.
GF_API GfMatrix4d & SetTransform(const GfRotation &rotate, const GfVec3d &translate)
GF_API GfMatrix4d & operator-=(const GfMatrix4d &m)
Subtracts matrix m from this matrix.
GF_API GfMatrix4d GetOrthonormalized(bool issueWarning=true) const
Returns an orthonormalized copy of the matrix.
GF_API GfMatrix4d & SetTranslateOnly(const GfVec3d &t)
GF_API GfMatrix4d & operator+=(const GfMatrix4d &m)
Adds matrix m to this matrix.
GF_API GfVec3d DecomposeRotation(const GfVec3d &axis0, const GfVec3d &axis1, const GfVec3d &axis2) const
GfVec3d Transform(const GfVec3d &vec) const
bool HasOrthogonalRows3() const
GfVec3d TransformDir(const GfVec3d &vec) const
friend GfMatrix4d operator/(const GfMatrix4d &m1, const GfMatrix4d &m2)
Divides matrix m1 by m2 (that is, m1 * inv(m2)).
GfMatrix4d()=default
Default constructor. Leaves the matrix component values undefined.
double * operator[](int i)
GF_API GfMatrix4d GetTranspose() const
Returns the transpose of the matrix.
GF_API GfMatrix4d & SetDiagonal(double s)
Sets the matrix to s times the identity matrix.
GfMatrix4d & Set(const double m[4][4])
GF_API GfQuatd ExtractRotationQuat() const
T * GetData()
Return a pointer to the start of all the data.
GfMatrix4d(const double m[4][4])
GA_API const UT_StringHolder trans
static const size_t numRows
GfMatrix4d(const GfVec4d &v)
double GetDeterminant3() const
GF_API double GetDeterminant() const
Returns the determinant of the matrix.
GfVec4d GetRow(int i) const
Gets a row of the matrix as a Vec4.
GF_API friend GfMatrix4d operator-(const GfMatrix4d &m)
Returns the unary negation of matrix m.
GF_API double GetHandedness() const
double * GetArray()
Returns vector components as an array of double values.
GfVec3d TransformAffine(const GfVec3d &vec) const
GF_API GfRotation ExtractRotation() const
GF_API bool Factor(GfMatrix4d *r, GfVec3d *s, GfMatrix4d *u, GfVec3d *t, GfMatrix4d *p, double eps=1e-10) const
GF_API GfMatrix4d & SetLookAt(const GfVec3d &eyePoint, const GfVec3d ¢erPoint, const GfVec3d &upDirection)
friend size_t hash_value(GfMatrix4d const &m)
Hash.
double GfDot(const GfDualQuatd &dq1, const GfDualQuatd &dq2)
Return the dot (inner) product of two dual quaternions.
GF_API GfMatrix3d ExtractRotationMatrix() const
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)
GF_API bool GfIsClose(GfMatrix4d const &m1, GfMatrix4d const &m2, double tolerance)
GF_API std::ostream & operator<<(std::ostream &, GfMatrix4d const &)
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)
static size_t Combine(Args &&...args)
Produce a hash code by combining the hash codes of several objects.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
GfVec3f Transform(const GfVec3f &vec) const
GfVec3f TransformDir(const GfVec3f &vec) const
GF_API GfMatrix4d & SetRotateOnly(const GfQuatd &rot)
const double * data() const
void SetRow(int i, const GfVec4d &v)
Sets a row of the matrix from a Vec4.
#define PXR_NAMESPACE_CLOSE_SCOPE
GF_API GfMatrix4d RemoveScaleShear() const
void SetRow3(int i, const GfVec3d &v)
PUGI__FN char_t * translate(char_t *buffer, const char_t *from, const char_t *to, size_t to_length)
GfVec3d ExtractTranslation() const
GfVec4d GetColumn(int i) const
Gets a column of the matrix as a Vec4.
GfMatrix4d & SetZero()
Sets the matrix to zero.
bool operator!=(const GfMatrix4d &m) const
GfVec3d GetRow3(int i) const
Gets a row of the matrix as a Vec3.
#define GF_MIN_ORTHO_TOLERANCE