All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GfMatrix4d Class Reference

Stores a 4x4 matrix of double elements. More...

Public Types

typedef double ScalarType
 

Public Member Functions

 GfMatrix4d ()=default
 Default constructor. Leaves the matrix component values undefined. More...
 
 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. More...
 
 GfMatrix4d (const double m[4][4])
 Constructor. More...
 
 GfMatrix4d (double s)
 Constructor. More...
 
 GfMatrix4d (const GfVec4d &v)
 Constructor. More...
 
GF_API GfMatrix4d (const std::vector< std::vector< double > > &v)
 Constructor. More...
 
GF_API GfMatrix4d (const std::vector< std::vector< float > > &v)
 Constructor. More...
 
GF_API GfMatrix4d (const std::vector< double > &r0, const std::vector< double > &r1, const std::vector< double > &r2, const std::vector< double > &r3)
 Constructor. More...
 
GF_API GfMatrix4d (const std::vector< float > &r0, const std::vector< float > &r1, const std::vector< float > &r2, const std::vector< float > &r3)
 Constructor. More...
 
GF_API GfMatrix4d (const GfRotation &rotate, const GfVec3d &translate)
 Constructor. More...
 
GF_API GfMatrix4d (const GfMatrix3d &rotmx, const GfVec3d &translate)
 Constructor. More...
 
GF_API GfMatrix4d (const class GfMatrix4f &m)
 This explicit constructor converts a "float" matrix to a "double" matrix. More...
 
void SetRow (int i, const GfVec4d &v)
 Sets a row of the matrix from a Vec4. More...
 
void SetColumn (int i, const GfVec4d &v)
 Sets a column of the matrix from a Vec4. More...
 
GfVec4d GetRow (int i) const
 Gets a row of the matrix as a Vec4. More...
 
GfVec4d GetColumn (int i) const
 Gets a column of the matrix as a Vec4. More...
 
GfMatrix4dSet (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. More...
 
GfMatrix4dSet (const double m[4][4])
 Sets the matrix from a 4x4 array of double values, specified in row-major order. More...
 
GfMatrix4dSetIdentity ()
 Sets the matrix to the identity matrix. More...
 
GfMatrix4dSetZero ()
 Sets the matrix to zero. More...
 
GF_API GfMatrix4dSetDiagonal (double s)
 Sets the matrix to s times the identity matrix. More...
 
GF_API GfMatrix4dSetDiagonal (const GfVec4d &)
 Sets the matrix to have diagonal (v[0], v[1], v[2], v[3]). More...
 
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. More...
 
double * data ()
 Returns raw access to components of matrix as an array of double values. More...
 
const double * data () const
 Returns const raw access to components of matrix as an array of double values. More...
 
double * GetArray ()
 Returns vector components as an array of double values. More...
 
const double * GetArray () const
 Returns vector components as a const array of double values. More...
 
double * operator[] (int i)
 Accesses an indexed row i of the matrix as an array of 4 double values so that standard indexing (such as m[0][1]) works correctly. More...
 
const double * operator[] (int i) const
 Accesses an indexed row i of the matrix as an array of 4 double values so that standard indexing (such as m[0][1]) works correctly. More...
 
GF_API bool operator== (const GfMatrix4d &m) const
 Tests for element-wise matrix equality. More...
 
GF_API bool operator== (const GfMatrix4f &m) const
 Tests for element-wise matrix equality. More...
 
bool operator!= (const GfMatrix4d &m) const
 Tests for element-wise matrix inequality. More...
 
bool operator!= (const GfMatrix4f &m) const
 Tests for element-wise matrix inequality. More...
 
GF_API GfMatrix4d GetTranspose () const
 Returns the transpose of the matrix. More...
 
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. More...
 
GF_API double GetDeterminant () const
 Returns the determinant of the matrix. More...
 
void SetRow3 (int i, const GfVec3d &v)
 Sets a row of the matrix from a Vec3. More...
 
GfVec3d GetRow3 (int i) const
 Gets a row of the matrix as a Vec3. More...
 
double GetDeterminant3 () const
 Returns the determinant of the upper 3x3 matrix. More...
 
bool HasOrthogonalRows3 () const
 Returns true, if the row vectors of the upper 3x3 matrix form an orthogonal basis. More...
 
GF_API bool Orthonormalize (bool issueWarning=true)
 Makes the matrix orthonormal in place. More...
 
GF_API GfMatrix4d GetOrthonormalized (bool issueWarning=true) const
 Returns an orthonormalized copy of the matrix. More...
 
GF_API double GetHandedness () const
 Returns the sign of the determinant of the upper 3x3 matrix, i.e. More...
 
bool IsRightHanded () const
 Returns true if the vectors in the upper 3x3 matrix form a right-handed coordinate system. More...
 
bool IsLeftHanded () const
 Returns true if the vectors in the upper 3x3 matrix form a left-handed coordinate system. More...
 
GF_API GfMatrix4doperator*= (const GfMatrix4d &m)
 Post-multiplies matrix m into this matrix. More...
 
GF_API GfMatrix4doperator*= (double)
 Multiplies the matrix by a double. More...
 
GF_API GfMatrix4doperator+= (const GfMatrix4d &m)
 Adds matrix m to this matrix. More...
 
GF_API GfMatrix4doperator-= (const GfMatrix4d &m)
 Subtracts matrix m from this matrix. More...
 
GF_API GfMatrix4dSetScale (double scaleFactor)
 Sets matrix to specify a uniform scaling by scaleFactor. More...
 
GF_API GfMatrix4d RemoveScaleShear () const
 Returns the matrix with any scaling or shearing removed, leaving only the rotation and translation. More...
 
3D Transformation Utilities
GF_API GfMatrix4dSetRotate (const GfQuatd &rot)
 Sets the matrix to specify a rotation equivalent to rot, and clears the translation. More...
 
GF_API GfMatrix4dSetRotateOnly (const GfQuatd &rot)
 Sets the matrix to specify a rotation equivalent to rot, without clearing the translation. More...
 
GF_API GfMatrix4dSetRotate (const GfRotation &rot)
 Sets the matrix to specify a rotation equivalent to rot, and clears the translation. More...
 
GF_API GfMatrix4dSetRotateOnly (const GfRotation &rot)
 Sets the matrix to specify a rotation equivalent to rot, without clearing the translation. More...
 
GF_API GfMatrix4dSetRotate (const GfMatrix3d &mx)
 Sets the matrix to specify a rotation equivalent to mx, and clears the translation. More...
 
GF_API GfMatrix4dSetRotateOnly (const GfMatrix3d &mx)
 Sets the matrix to specify a rotation equivalent to mx, without clearing the translation. More...
 
GF_API GfMatrix4dSetScale (const GfVec3d &scaleFactors)
 Sets the matrix to specify a nonuniform scaling in x, y, and z by the factors in vector scaleFactors. More...
 
GF_API GfMatrix4dSetTranslate (const GfVec3d &trans)
 Sets matrix to specify a translation by the vector trans, and clears the rotation. More...
 
GF_API GfMatrix4dSetTranslateOnly (const GfVec3d &t)
 Sets matrix to specify a translation by the vector trans, without clearing the rotation. More...
 
GF_API GfMatrix4dSetTransform (const GfRotation &rotate, const GfVec3d &translate)
 Sets matrix to specify a rotation by rotate and a translation by translate. More...
 
GF_API GfMatrix4dSetTransform (const GfMatrix3d &rotmx, const GfVec3d &translate)
 Sets matrix to specify a rotation by rotmx and a translation by translate. More...
 
GF_API GfMatrix4dSetLookAt (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). More...
 
GF_API GfMatrix4dSetLookAt (const GfVec3d &eyePoint, const GfRotation &orientation)
 Sets the matrix to specify a viewing matrix from a world-space eyePoint and a world-space rotation that rigidly rotates the orientation from its canonical frame, which is defined to be looking along the -z axis with the +y axis as the up direction. More...
 
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: More...
 
GfVec3d ExtractTranslation () const
 Returns the translation part of the matrix, defined as the first three elements of the last row. More...
 
GF_API GfRotation ExtractRotation () const
 Returns the rotation corresponding to this matrix. More...
 
GF_API GfQuatd ExtractRotationQuat () const
 Return the rotation corresponding to this matrix as a quaternion. More...
 
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. More...
 
GF_API GfMatrix3d ExtractRotationMatrix () const
 Returns the rotation corresponding to this matrix. More...
 
GfVec3d Transform (const GfVec3d &vec) const
 Transforms the row vector vec by the matrix, returning the result. More...
 
GfVec3f Transform (const GfVec3f &vec) const
 Transforms the row vector vec by the matrix, returning the result. More...
 
GfVec3d TransformDir (const GfVec3d &vec) const
 Transforms row vector vec by the matrix, returning the result. More...
 
GfVec3f TransformDir (const GfVec3f &vec) const
 Transforms row vector vec by the matrix, returning the result. More...
 
GfVec3d TransformAffine (const GfVec3d &vec) const
 Transforms the row vector vec by the matrix, returning the result. More...
 
GfVec3f TransformAffine (const GfVec3f &vec) const
 Transforms the row vector vec by the matrix, returning the result. More...
 

Static Public Attributes

static const size_t numRows = 4
 
static const size_t numColumns = 4
 

Friends

class GfMatrix4f
 
size_t hash_value (GfMatrix4d const &m)
 Hash. More...
 
GfMatrix4d operator* (const GfMatrix4d &m1, double d)
 Returns the product of a matrix and a double. More...
 
GfMatrix4d operator* (double d, const GfMatrix4d &m)
 
GF_API friend GfMatrix4d operator- (const GfMatrix4d &m)
 Returns the unary negation of matrix m. More...
 
GfMatrix4d operator+ (const GfMatrix4d &m1, const GfMatrix4d &m2)
 Adds matrix m2 to m1. More...
 
GfMatrix4d operator- (const GfMatrix4d &m1, const GfMatrix4d &m2)
 Subtracts matrix m2 from m1. More...
 
GfMatrix4d operator* (const GfMatrix4d &m1, const GfMatrix4d &m2)
 Multiplies matrix m1 by m2. More...
 
GfMatrix4d operator/ (const GfMatrix4d &m1, const GfMatrix4d &m2)
 Divides matrix m1 by m2 (that is, m1 * inv(m2)). More...
 
GfVec4d operator* (const GfMatrix4d &m, const GfVec4d &vec)
 Returns the product of a matrix m and a column vector vec. More...
 
GfVec4d operator* (const GfVec4d &vec, const GfMatrix4d &m)
 Returns the product of row vector vec and a matrix m. More...
 
GF_API friend GfVec4f operator* (const GfMatrix4d &m, const GfVec4f &vec)
 Returns the product of a matrix m and a column vector vec. More...
 
GF_API friend GfVec4f operator* (const GfVec4f &vec, const GfMatrix4d &m)
 Returns the product of row vector vec and a matrix m. More...
 

Detailed Description

Stores a 4x4 matrix of double elements.

A basic type.

Matrices are defined to be in row-major order, so matrix[i][j] indexes the element in the i th row and the j th column.

3D Transformations

The following methods interpret a GfMatrix4d as a 3D transformation: SetRotate(), SetScale(), SetTranslate(), SetLookAt(), Factor(), ExtractTranslation(), ExtractRotation(), Transform(), TransformDir(). By convention, vectors are treated primarily as row vectors, implying the following:

  • Transformation matrices are organized to deal with row vectors, not column vectors. For example, the last row of a matrix contains the translation amounts.
  • Each of the Set() methods below completely rewrites the matrix; for example, SetTranslate() yields a matrix which does nothing but translate.
  • When multiplying two transformation matrices, the matrix on the left applies a more local transformation to a row vector. For example, if R represents a rotation matrix and T represents a translation matrix, the product R*T will rotate a row vector, then translate it.

Definition at line 88 of file matrix4d.h.

Constructor & Destructor Documentation

GfMatrix4d ( )
default

Default constructor. Leaves the matrix component values undefined.

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 
)
inline

Constructor.

Initializes the matrix from 16 independent double values, specified in row-major order. For example, parameter m10 specifies the value in row 1 and column 0.

Definition at line 102 of file matrix4d.h.

GfMatrix4d ( const double  m[4][4])
inline

Constructor.

Initializes the matrix from a 4x4 array of double values, specified in row-major order.

Definition at line 114 of file matrix4d.h.

GfMatrix4d ( double  s)
inlineexplicit

Constructor.

Explicitly initializes the matrix to s times the identity matrix.

Definition at line 120 of file matrix4d.h.

GfMatrix4d ( const GfVec4d v)
inlineexplicit

Constructor.

Explicitly initializes the matrix to diagonal form, with the i th element on the diagonal set to v[i].

Definition at line 126 of file matrix4d.h.

GF_API GfMatrix4d ( const std::vector< std::vector< double > > &  v)
explicit

Constructor.

Initialize the matrix from a vector of vectors of double. The vector is expected to be 4x4. If it is too big, only the first 4 rows and/or columns will be used. If it is too small, uninitialized elements will be filled in with the corresponding elements from an identity matrix.

GF_API GfMatrix4d ( const std::vector< std::vector< float > > &  v)
explicit

Constructor.

Initialize the matrix from a vector of vectors of float. The vector is expected to be 4x4. If it is too big, only the first 4 rows and/or columns will be used. If it is too small, uninitialized elements will be filled in with the corresponding elements from an identity matrix.

GF_API GfMatrix4d ( const std::vector< double > &  r0,
const std::vector< double > &  r1,
const std::vector< double > &  r2,
const std::vector< double > &  r3 
)
explicit

Constructor.

Initialize the matrix from 4 row vectors of double. Each vector is expected to length 4. If it is too big, only the first 4 items will be used. If it is too small, uninitialized elements will be filled in with the corresponding elements from an identity matrix.

GF_API GfMatrix4d ( const std::vector< float > &  r0,
const std::vector< float > &  r1,
const std::vector< float > &  r2,
const std::vector< float > &  r3 
)
explicit

Constructor.

Initialize the matrix from 4 row vectors of float. Each vector is expected to length 4. If it is too big, only the first 4 items will be used. If it is too small, uninitialized elements will be filled in with the corresponding elements from an identity matrix.

GF_API GfMatrix4d ( const GfRotation rotate,
const GfVec3d translate 
)

Constructor.

Initializes a transformation matrix to perform the indicated rotation and translation.

GF_API GfMatrix4d ( const GfMatrix3d rotmx,
const GfVec3d translate 
)

Constructor.

Initializes a transformation matrix to perform the indicated rotation and translation.

GF_API GfMatrix4d ( const class GfMatrix4f m)
explicit

This explicit constructor converts a "float" matrix to a "double" matrix.

Member Function Documentation

double* data ( )
inline

Returns raw access to components of matrix as an array of double values.

Components are in row-major order.

Definition at line 274 of file matrix4d.h.

const double* data ( ) const
inline

Returns const raw access to components of matrix as an array of double values.

Components are in row-major order.

Definition at line 280 of file matrix4d.h.

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.

If the axes are not orthogonal, warnings will be spewed.

This is a convenience method that is equivalent to calling ExtractRotation().Decompose().

GF_API GfRotation ExtractRotation ( ) const

Returns the rotation corresponding to this matrix.

This works well only if the matrix represents a rotation.

For good results, consider calling Orthonormalize() before calling this method.

GF_API GfMatrix3d ExtractRotationMatrix ( ) const

Returns the rotation corresponding to this matrix.

This works well only if the matrix represents a rotation.

For good results, consider calling Orthonormalize() before calling this method.

GF_API GfQuatd ExtractRotationQuat ( ) const

Return the rotation corresponding to this matrix as a quaternion.

This works well only if the matrix represents a rotation.

For good results, consider calling Orthonormalize() before calling this method.

GfVec3d ExtractTranslation ( ) const
inline

Returns the translation part of the matrix, defined as the first three elements of the last row.

Definition at line 617 of file matrix4d.h.

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:

  • M = r * s * -r * u * t where
  • t is a translation.
  • u and r are rotations, and -r is the transpose (inverse) of r. The u matrix may contain shear information.
  • s is a scale. Any projection information could be returned in matrix p, but currently p is never modified.

Returns false if the matrix is singular (as determined by eps). In that case, any zero scales in s are clamped to eps to allow computation of u.

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.

double* GetArray ( )
inline

Returns vector components as an array of double values.

Definition at line 285 of file matrix4d.h.

const double* GetArray ( ) const
inline

Returns vector components as a const array of double values.

Definition at line 290 of file matrix4d.h.

GfVec4d GetColumn ( int  i) const
inline

Gets a column of the matrix as a Vec4.

Definition at line 209 of file matrix4d.h.

GF_API double GetDeterminant ( ) const

Returns the determinant of the matrix.

double GetDeterminant3 ( ) const
inline

Returns the determinant of the upper 3x3 matrix.

This method is useful when the matrix describes a linear transformation such as a rotation or scale because the other values in the 4x4 matrix are not important.

Definition at line 368 of file matrix4d.h.

GF_API double GetHandedness ( ) const

Returns the sign of the determinant of the upper 3x3 matrix, i.e.

1 for a right-handed matrix, -1 for a left-handed matrix, and 0 for a singular 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.

(FLT_MAX is the largest value a float can have, as defined by the system.) The matrix is considered singular if the determinant is less than or equal to the optional parameter eps. If det is non-null, *det is set to the determinant.

GF_API GfMatrix4d GetOrthonormalized ( bool  issueWarning = true) const

Returns an orthonormalized copy of the matrix.

GfVec4d GetRow ( int  i) const
inline

Gets a row of the matrix as a Vec4.

Definition at line 204 of file matrix4d.h.

GfVec3d GetRow3 ( int  i) const
inline

Gets a row of the matrix as a Vec3.

Definition at line 361 of file matrix4d.h.

GF_API GfMatrix4d GetTranspose ( ) const

Returns the transpose of the matrix.

bool HasOrthogonalRows3 ( ) const
inline

Returns true, if the row vectors of the upper 3x3 matrix form an orthogonal basis.

Note they do not have to be unit length for this test to return true.

Definition at line 375 of file matrix4d.h.

bool IsLeftHanded ( ) const
inline

Returns true if the vectors in the upper 3x3 matrix form a left-handed coordinate system.

Definition at line 413 of file matrix4d.h.

bool IsRightHanded ( ) const
inline

Returns true if the vectors in the upper 3x3 matrix form a right-handed coordinate system.

Definition at line 407 of file matrix4d.h.

bool operator!= ( const GfMatrix4d m) const
inline

Tests for element-wise matrix inequality.

All elements must match exactly for matrices to be considered equal.

Definition at line 326 of file matrix4d.h.

bool operator!= ( const GfMatrix4f m) const
inline

Tests for element-wise matrix inequality.

All elements must match exactly for matrices to be considered equal.

Definition at line 332 of file matrix4d.h.

GF_API GfMatrix4d& operator*= ( const GfMatrix4d m)

Post-multiplies matrix m into this matrix.

GF_API GfMatrix4d& operator*= ( double  )

Multiplies the matrix by a double.

GF_API GfMatrix4d& operator+= ( const GfMatrix4d m)

Adds matrix m to this matrix.

GF_API GfMatrix4d& operator-= ( const GfMatrix4d m)

Subtracts matrix m from this matrix.

GF_API bool operator== ( const GfMatrix4d m) const

Tests for element-wise matrix equality.

All elements must match exactly for matrices to be considered equal.

GF_API bool operator== ( const GfMatrix4f m) const

Tests for element-wise matrix equality.

All elements must match exactly for matrices to be considered equal.

double* operator[] ( int  i)
inline

Accesses an indexed row i of the matrix as an array of 4 double values so that standard indexing (such as m[0][1]) works correctly.

Definition at line 297 of file matrix4d.h.

const double* operator[] ( int  i) const
inline

Accesses an indexed row i of the matrix as an array of 4 double values so that standard indexing (such as m[0][1]) works correctly.

Definition at line 302 of file matrix4d.h.

GF_API bool Orthonormalize ( bool  issueWarning = true)

Makes the matrix orthonormal in place.

This is an iterative method that is much more stable than the previous cross/cross method. If the iterative method does not converge, a warning is issued.

Returns true if the iteration converged, false otherwise. Leaves any translation part of the matrix unchanged. If issueWarning is true, this method will issue a warning if the iteration does not converge, otherwise it will be silent.

GF_API GfMatrix4d RemoveScaleShear ( ) const

Returns the matrix with any scaling or shearing removed, leaving only the rotation and translation.

If the matrix cannot be decomposed, returns the original matrix.

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 
)
inline

Sets the matrix from 16 independent double values, specified in row-major order.

For example, parameter m10 specifies the value in row 1 and column 0.

Definition at line 216 of file matrix4d.h.

GfMatrix4d& Set ( const double  m[4][4])
inline

Sets the matrix from a 4x4 array of double values, specified in row-major order.

Definition at line 229 of file matrix4d.h.

void SetColumn ( int  i,
const GfVec4d v 
)
inline

Sets a column of the matrix from a Vec4.

Definition at line 196 of file matrix4d.h.

GF_API GfMatrix4d& SetDiagonal ( double  s)

Sets the matrix to s times the identity matrix.

GF_API GfMatrix4d& SetDiagonal ( const GfVec4d )

Sets the matrix to have diagonal (v[0], v[1], v[2], v[3]).

GfMatrix4d& SetIdentity ( )
inline

Sets the matrix to the identity matrix.

Definition at line 250 of file matrix4d.h.

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).

eyePoint represents the eye point in world space. centerPoint represents the world-space center of attention. upDirection is a vector indicating which way is up.

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 that rigidly rotates the orientation from its canonical frame, which is defined to be looking along the -z axis with the +y axis as the up direction.

GF_API GfMatrix4d& SetRotate ( const GfQuatd rot)

Sets the matrix to specify a rotation equivalent to rot, and clears the translation.

GF_API GfMatrix4d& SetRotate ( const GfRotation rot)

Sets the matrix to specify a rotation equivalent to rot, and clears the translation.

GF_API GfMatrix4d& SetRotate ( const GfMatrix3d mx)

Sets the matrix to specify a rotation equivalent to mx, and clears the translation.

GF_API GfMatrix4d& SetRotateOnly ( const GfQuatd rot)

Sets the matrix to specify a rotation equivalent to rot, without clearing the translation.

GF_API GfMatrix4d& SetRotateOnly ( const GfRotation rot)

Sets the matrix to specify a rotation equivalent to rot, without clearing the translation.

GF_API GfMatrix4d& SetRotateOnly ( const GfMatrix3d mx)

Sets the matrix to specify a rotation equivalent to mx, without clearing the translation.

void SetRow ( int  i,
const GfVec4d v 
)
inline

Sets a row of the matrix from a Vec4.

Definition at line 188 of file matrix4d.h.

void SetRow3 ( int  i,
const GfVec3d v 
)
inline

Sets a row of the matrix from a Vec3.

The fourth element of the row is ignored.

Definition at line 354 of file matrix4d.h.

GF_API GfMatrix4d& SetScale ( double  scaleFactor)

Sets matrix to specify a uniform scaling by scaleFactor.

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.

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& SetTransform ( const GfMatrix3d rotmx,
const GfVec3d translate 
)

Sets matrix to specify a rotation by rotmx and a translation by translate.

GF_API GfMatrix4d& SetTranslate ( const GfVec3d trans)

Sets matrix to specify a translation by the vector trans, and clears the rotation.

GF_API GfMatrix4d& SetTranslateOnly ( const GfVec3d t)

Sets matrix to specify a translation by the vector trans, without clearing the rotation.

GfMatrix4d& SetZero ( )
inline

Sets the matrix to zero.

Definition at line 255 of file matrix4d.h.

GfVec3d Transform ( const GfVec3d vec) const
inline

Transforms the row vector vec by the matrix, returning the result.

This treats the vector as a 4-component vector whose fourth component is 1.

Definition at line 658 of file matrix4d.h.

GfVec3f Transform ( const GfVec3f vec) const
inline

Transforms the row vector vec by the matrix, returning the result.

This treats the vector as a 4-component vector whose fourth component is 1. This is an overloaded method; it differs from the other version in that it returns a different value type.

Definition at line 670 of file matrix4d.h.

GfVec3d TransformAffine ( const GfVec3d vec) const
inline

Transforms the row vector vec by the matrix, returning the result.

This treats the vector as a 4-component vector whose fourth component is 1 and ignores the fourth column of the matrix (i.e. assumes it is (0, 0, 0, 1)).

Definition at line 706 of file matrix4d.h.

GfVec3f TransformAffine ( const GfVec3f vec) const
inline

Transforms the row vector vec by the matrix, returning the result.

This treats the vector as a 4-component vector whose fourth component is 1 and ignores the fourth column of the matrix (i.e. assumes it is (0, 0, 0, 1)).

Definition at line 717 of file matrix4d.h.

GfVec3d TransformDir ( const GfVec3d vec) const
inline

Transforms row vector vec by the matrix, returning the result.

This treats the vector as a direction vector, so the translation information in the matrix is ignored. That is, it treats the vector as a 4-component vector whose fourth component is 0.

Definition at line 682 of file matrix4d.h.

GfVec3f TransformDir ( const GfVec3f vec) const
inline

Transforms row vector vec by the matrix, returning the result.

This treats the vector as a direction vector, so the translation information in the matrix is ignored. That is, it treats the vector as a 4-component vector whose fourth component is 0. This is an overloaded method; it differs from the other version in that it returns a different value type.

Definition at line 695 of file matrix4d.h.

Friends And Related Function Documentation

size_t hash_value ( GfMatrix4d const &  m)
friend

Hash.

Definition at line 305 of file matrix4d.h.

GfMatrix4d operator* ( const GfMatrix4d m1,
double  d 
)
friend

Returns the product of a matrix and a double.

Definition at line 426 of file matrix4d.h.

GfMatrix4d operator* ( const GfMatrix4d m1,
const GfMatrix4d m2 
)
friend

Multiplies matrix m1 by m2.

Definition at line 468 of file matrix4d.h.

GfVec4d operator* ( const GfMatrix4d m,
const GfVec4d vec 
)
friend

Returns the product of a matrix m and a column vector vec.

Definition at line 482 of file matrix4d.h.

GfVec4d operator* ( const GfVec4d vec,
const GfMatrix4d m 
)
friend

Returns the product of row vector vec and a matrix m.

Definition at line 490 of file matrix4d.h.

GF_API friend GfVec4f operator* ( const GfMatrix4d m,
const GfVec4f vec 
)
friend

Returns the product of a matrix m and a column vector vec.

Note that the return type is a GfVec4f.

GF_API friend GfVec4f operator* ( const GfVec4f vec,
const GfMatrix4d m 
)
friend

Returns the product of row vector vec and a matrix m.

Note that the return type is a GfVec4f.

GfMatrix4d operator+ ( const GfMatrix4d m1,
const GfMatrix4d m2 
)
friend

Adds matrix m2 to m1.

Definition at line 452 of file matrix4d.h.

GF_API friend GfMatrix4d operator- ( const GfMatrix4d m)
friend

Returns the unary negation of matrix m.

GfMatrix4d operator- ( const GfMatrix4d m1,
const GfMatrix4d m2 
)
friend

Subtracts matrix m2 from m1.

Definition at line 460 of file matrix4d.h.

GfMatrix4d operator/ ( const GfMatrix4d m1,
const GfMatrix4d m2 
)
friend

Divides matrix m1 by m2 (that is, m1 * inv(m2)).

Definition at line 476 of file matrix4d.h.


The documentation for this class was generated from the following file: