28 #ifndef PXR_BASE_GF_MATRIX2D_H
29 #define PXR_BASE_GF_MATRIX2D_H
76 double m10,
double m11) {
112 explicit GfMatrix2d(
const std::vector< std::vector<double> >&
v);
121 explicit GfMatrix2d(
const std::vector< std::vector<float> >&
v);
141 return GfVec2d(_mtx[i][0], _mtx[i][1]);
146 return GfVec2d(_mtx[0][i], _mtx[1][i]);
153 double m10,
double m11) {
154 _mtx[0][0] = m00; _mtx[0][1] = m01;
155 _mtx[1][0] = m10; _mtx[1][1] = m11;
162 _mtx[0][0] = m[0][0];
163 _mtx[0][1] = m[0][1];
164 _mtx[1][0] = m[1][0];
165 _mtx[1][1] = m[1][1];
190 double*
Get(
double m[2][2])
const;
247 return !(*
this == m);
253 return !(*
this == m);
339 return GfVec2d(vec[0] * m._mtx[0][0] + vec[1] * m._mtx[0][1],
340 vec[0] * m._mtx[1][0] + vec[1] * m._mtx[1][1]);
345 return GfVec2d(vec[0] * m._mtx[0][0] + vec[1] * m._mtx[1][0],
346 vec[0] * m._mtx[0][1] + vec[1] * m._mtx[1][1]);
381 #endif // PXR_BASE_GF_MATRIX2D_H
GfMatrix2d(const GfVec2d &v)
bool operator!=(const GfMatrix2d &m) const
GF_API GfMatrix2d & SetDiagonal(double s)
Sets the matrix to s times the identity matrix.
GfVec2d GetRow(int i) const
Gets a row of the matrix as a Vec2.
double * operator[](int i)
*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 double GetDeterminant() const
Returns the determinant of the matrix.
static const size_t numColumns
GF_API GfMatrix2d & operator+=(const GfMatrix2d &m)
Adds matrix m to this matrix.
GF_API GfMatrix2d & operator*=(const GfMatrix2d &m)
Post-multiplies matrix m into this matrix.
GfMatrix2d(double m00, double m01, double m10, double m11)
friend size_t hash_value(GfMatrix2d const &m)
Hash.
void SetRow(int i, const GfVec2d &v)
Sets a row of the matrix from a Vec2.
GfMatrix2d & Set(double m00, double m01, double m10, double m11)
T * GetData()
Return a pointer to the start of all the data.
GfMatrix2d(const double m[2][2])
GfMatrix2d & Set(const double m[2][2])
GF_API GfMatrix2d & operator-=(const GfMatrix2d &m)
Subtracts matrix m from this matrix.
GF_API double * Get(double m[2][2]) const
GfVec2d GetColumn(int i) const
Gets a column of the matrix as a Vec2.
friend GfMatrix2d operator*(const GfMatrix2d &m1, double d)
Returns the product of a matrix and a double.
const double * GetArray() const
Returns vector components as a const array of double values.
GfMatrix2d & SetIdentity()
Sets the matrix to the identity matrix.
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
GfMatrix2d()=default
Default constructor. Leaves the matrix component values undefined.
GF_API std::ostream & operator<<(std::ostream &, GfMatrix2d const &)
GfMatrix2d & SetZero()
Sets the matrix to zero.
GF_API GfMatrix2d GetInverse(double *det=NULL, double eps=0) const
static const size_t numRows
friend GfMatrix2d operator/(const GfMatrix2d &m1, const GfMatrix2d &m2)
Divides matrix m1 by m2 (that is, m1 * inv(m2)).
GF_API GfMatrix2d GetTranspose() const
Returns the transpose of the matrix.
#define PXR_NAMESPACE_CLOSE_SCOPE
friend GfMatrix2d operator+(const GfMatrix2d &m1, const GfMatrix2d &m2)
Adds matrix m2 to m1.
void SetColumn(int i, const GfVec2d &v)
Sets a column of the matrix from a Vec2.
double * GetArray()
Returns vector components as an array of double values.
GF_API bool GfIsClose(GfMatrix2d const &m1, GfMatrix2d const &m2, double tolerance)
const double * data() const
GF_API bool operator==(const GfMatrix2d &m) const
GF_API friend GfMatrix2d operator-(const GfMatrix2d &m)
Returns the unary negation of matrix m.