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

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

Public Types

typedef float ScalarType
 

Public Member Functions

 GfMatrix4f ()=default
 Default constructor. Leaves the matrix component values undefined. More...
 
 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. More...
 
 GfMatrix4f (const float m[4][4])
 Constructor. More...
 
 GfMatrix4f (float s)
 Constructor. More...
 
 GfMatrix4f (const GfVec4f &v)
 Constructor. More...
 
GF_API GfMatrix4f (const std::vector< std::vector< double > > &v)
 Constructor. More...
 
GF_API GfMatrix4f (const std::vector< std::vector< float > > &v)
 Constructor. More...
 
GF_API GfMatrix4f (const std::vector< double > &r0, const std::vector< double > &r1, const std::vector< double > &r2, const std::vector< double > &r3)
 Constructor. More...
 
GF_API GfMatrix4f (const std::vector< float > &r0, const std::vector< float > &r1, const std::vector< float > &r2, const std::vector< float > &r3)
 Constructor. More...
 
GF_API GfMatrix4f (const GfRotation &rotate, const GfVec3f &translate)
 Constructor. More...
 
GF_API GfMatrix4f (const GfMatrix3f &rotmx, const GfVec3f &translate)
 Constructor. More...
 
GF_API GfMatrix4f (const class GfMatrix4d &m)
 This explicit constructor converts a "double" matrix to a "float" matrix. More...
 
void SetRow (int i, const GfVec4f &v)
 Sets a row of the matrix from a Vec4. More...
 
void SetColumn (int i, const GfVec4f &v)
 Sets a column of the matrix from a Vec4. More...
 
GfVec4f GetRow (int i) const
 Gets a row of the matrix as a Vec4. More...
 
GfVec4f GetColumn (int i) const
 Gets a column of the matrix as a Vec4. More...
 
GfMatrix4fSet (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. More...
 
GfMatrix4fSet (const float m[4][4])
 Sets the matrix from a 4x4 array of float values, specified in row-major order. More...
 
GfMatrix4fSetIdentity ()
 Sets the matrix to the identity matrix. More...
 
GfMatrix4fSetZero ()
 Sets the matrix to zero. More...
 
GF_API GfMatrix4fSetDiagonal (float s)
 Sets the matrix to s times the identity matrix. More...
 
GF_API GfMatrix4fSetDiagonal (const GfVec4f &)
 Sets the matrix to have diagonal (v[0], v[1], v[2], v[3]). More...
 
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. More...
 
float * data ()
 Returns raw access to components of matrix as an array of float values. More...
 
const float * data () const
 Returns const raw access to components of matrix as an array of float values. More...
 
float * GetArray ()
 Returns vector components as an array of float values. More...
 
const float * GetArray () const
 Returns vector components as a const array of float values. More...
 
float * operator[] (int i)
 Accesses an indexed row i of the matrix as an array of 4 float values so that standard indexing (such as m[0][1]) works correctly. More...
 
const float * operator[] (int i) const
 Accesses an indexed row i of the matrix as an array of 4 float 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 GfMatrix4f GetTranspose () const
 Returns the transpose of the matrix. More...
 
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. More...
 
GF_API double GetDeterminant () const
 Returns the determinant of the matrix. More...
 
void SetRow3 (int i, const GfVec3f &v)
 Sets a row of the matrix from a Vec3. More...
 
GfVec3f 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 GfMatrix4f 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 GfMatrix4foperator*= (const GfMatrix4f &m)
 Post-multiplies matrix m into this matrix. More...
 
GF_API GfMatrix4foperator*= (double)
 Multiplies the matrix by a float. More...
 
GF_API GfMatrix4foperator+= (const GfMatrix4f &m)
 Adds matrix m to this matrix. More...
 
GF_API GfMatrix4foperator-= (const GfMatrix4f &m)
 Subtracts matrix m from this matrix. More...
 
GF_API GfMatrix4fSetScale (float scaleFactor)
 Sets matrix to specify a uniform scaling by scaleFactor. More...
 
GF_API GfMatrix4f RemoveScaleShear () const
 Returns the matrix with any scaling or shearing removed, leaving only the rotation and translation. More...
 
3D Transformation Utilities
GF_API GfMatrix4fSetRotate (const GfQuatf &rot)
 Sets the matrix to specify a rotation equivalent to rot, and clears the translation. More...
 
GF_API GfMatrix4fSetRotateOnly (const GfQuatf &rot)
 Sets the matrix to specify a rotation equivalent to rot, without clearing the translation. More...
 
GF_API GfMatrix4fSetRotate (const GfRotation &rot)
 Sets the matrix to specify a rotation equivalent to rot, and clears the translation. More...
 
GF_API GfMatrix4fSetRotateOnly (const GfRotation &rot)
 Sets the matrix to specify a rotation equivalent to rot, without clearing the translation. More...
 
GF_API GfMatrix4fSetRotate (const GfMatrix3f &mx)
 Sets the matrix to specify a rotation equivalent to mx, and clears the translation. More...
 
GF_API GfMatrix4fSetRotateOnly (const GfMatrix3f &mx)
 Sets the matrix to specify a rotation equivalent to mx, without clearing the translation. More...
 
GF_API GfMatrix4fSetScale (const GfVec3f &scaleFactors)
 Sets the matrix to specify a nonuniform scaling in x, y, and z by the factors in vector scaleFactors. More...
 
GF_API GfMatrix4fSetTranslate (const GfVec3f &trans)
 Sets matrix to specify a translation by the vector trans, and clears the rotation. More...
 
GF_API GfMatrix4fSetTranslateOnly (const GfVec3f &t)
 Sets matrix to specify a translation by the vector trans, without clearing the rotation. More...
 
GF_API GfMatrix4fSetTransform (const GfRotation &rotate, const GfVec3f &translate)
 Sets matrix to specify a rotation by rotate and a translation by translate. More...
 
GF_API GfMatrix4fSetTransform (const GfMatrix3f &rotmx, const GfVec3f &translate)
 Sets matrix to specify a rotation by rotmx and a translation by translate. More...
 
GF_API GfMatrix4fSetLookAt (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). More...
 
GF_API GfMatrix4fSetLookAt (const GfVec3f &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 (GfMatrix4f *r, GfVec3f *s, GfMatrix4f *u, GfVec3f *t, GfMatrix4f *p, float eps=1e-5) const
 Factors the matrix into 5 components: More...
 
GfVec3f 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 GfVec3f DecomposeRotation (const GfVec3f &axis0, const GfVec3f &axis1, const GfVec3f &axis2) const
 Decompose the rotation corresponding to this matrix about 3 orthogonal axes. More...
 
GF_API GfMatrix3f 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 GfMatrix4d
 
size_t hash_value (GfMatrix4f const &m)
 Hash. More...
 
GfMatrix4f operator* (const GfMatrix4f &m1, double d)
 Returns the product of a matrix and a float. More...
 
GfMatrix4f operator* (double d, const GfMatrix4f &m)
 
GF_API friend GfMatrix4f operator- (const GfMatrix4f &m)
 Returns the unary negation of matrix m. More...
 
GfMatrix4f operator+ (const GfMatrix4f &m1, const GfMatrix4f &m2)
 Adds matrix m2 to m1. More...
 
GfMatrix4f operator- (const GfMatrix4f &m1, const GfMatrix4f &m2)
 Subtracts matrix m2 from m1. More...
 
GfMatrix4f operator* (const GfMatrix4f &m1, const GfMatrix4f &m2)
 Multiplies matrix m1 by m2. More...
 
GfMatrix4f operator/ (const GfMatrix4f &m1, const GfMatrix4f &m2)
 Divides matrix m1 by m2 (that is, m1 * inv(m2)). More...
 
GfVec4f operator* (const GfMatrix4f &m, const GfVec4f &vec)
 Returns the product of a matrix m and a column vector vec. More...
 
GfVec4f operator* (const GfVec4f &vec, const GfMatrix4f &m)
 Returns the product of row vector vec and a matrix m. More...
 

Detailed Description

Stores a 4x4 matrix of float 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 GfMatrix4f 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 matrix4f.h.

Constructor & Destructor Documentation

GfMatrix4f ( )
default

Default constructor. Leaves the matrix component values undefined.

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

Constructor.

Initializes the matrix from 16 independent float 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 matrix4f.h.

GfMatrix4f ( const float  m[4][4])
inline

Constructor.

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

Definition at line 114 of file matrix4f.h.

GfMatrix4f ( float  s)
inlineexplicit

Constructor.

Explicitly initializes the matrix to s times the identity matrix.

Definition at line 120 of file matrix4f.h.

GfMatrix4f ( const GfVec4f 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 matrix4f.h.

GF_API GfMatrix4f ( 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 GfMatrix4f ( 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 GfMatrix4f ( 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 GfMatrix4f ( 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 GfMatrix4f ( const GfRotation rotate,
const GfVec3f translate 
)

Constructor.

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

GF_API GfMatrix4f ( const GfMatrix3f rotmx,
const GfVec3f translate 
)

Constructor.

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

GF_API GfMatrix4f ( const class GfMatrix4d m)
explicit

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

Member Function Documentation

float* data ( )
inline

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

Components are in row-major order.

Definition at line 274 of file matrix4f.h.

const float* data ( ) const
inline

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

Components are in row-major order.

Definition at line 280 of file matrix4f.h.

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.

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

GfVec3f ExtractTranslation ( ) const
inline

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

Definition at line 607 of file matrix4f.h.

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:

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

float* GetArray ( )
inline

Returns vector components as an array of float values.

Definition at line 285 of file matrix4f.h.

const float* GetArray ( ) const
inline

Returns vector components as a const array of float values.

Definition at line 290 of file matrix4f.h.

GfVec4f GetColumn ( int  i) const
inline

Gets a column of the matrix as a Vec4.

Definition at line 209 of file matrix4f.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 matrix4f.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 GfMatrix4f 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 GfMatrix4f GetOrthonormalized ( bool  issueWarning = true) const

Returns an orthonormalized copy of the matrix.

GfVec4f GetRow ( int  i) const
inline

Gets a row of the matrix as a Vec4.

Definition at line 204 of file matrix4f.h.

GfVec3f GetRow3 ( int  i) const
inline

Gets a row of the matrix as a Vec3.

Definition at line 361 of file matrix4f.h.

GF_API GfMatrix4f 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 matrix4f.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 matrix4f.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 matrix4f.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 matrix4f.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 matrix4f.h.

GF_API GfMatrix4f& operator*= ( const GfMatrix4f m)

Post-multiplies matrix m into this matrix.

GF_API GfMatrix4f& operator*= ( double  )

Multiplies the matrix by a float.

GF_API GfMatrix4f& operator+= ( const GfMatrix4f m)

Adds matrix m to this matrix.

GF_API GfMatrix4f& operator-= ( const GfMatrix4f 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.

float* operator[] ( int  i)
inline

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

Definition at line 297 of file matrix4f.h.

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

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

Definition at line 302 of file matrix4f.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 GfMatrix4f 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.

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

Sets the matrix from 16 independent float 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 matrix4f.h.

GfMatrix4f& Set ( const float  m[4][4])
inline

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

Definition at line 229 of file matrix4f.h.

void SetColumn ( int  i,
const GfVec4f v 
)
inline

Sets a column of the matrix from a Vec4.

Definition at line 196 of file matrix4f.h.

GF_API GfMatrix4f& SetDiagonal ( float  s)

Sets the matrix to s times the identity matrix.

GF_API GfMatrix4f& SetDiagonal ( const GfVec4f )

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

GfMatrix4f& SetIdentity ( )
inline

Sets the matrix to the identity matrix.

Definition at line 250 of file matrix4f.h.

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

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 GfMatrix4f& SetLookAt ( const GfVec3f 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 GfMatrix4f& SetRotate ( const GfQuatf rot)

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

GF_API GfMatrix4f& SetRotate ( const GfRotation rot)

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

GF_API GfMatrix4f& SetRotate ( const GfMatrix3f mx)

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

GF_API GfMatrix4f& SetRotateOnly ( const GfQuatf rot)

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

GF_API GfMatrix4f& SetRotateOnly ( const GfRotation rot)

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

GF_API GfMatrix4f& SetRotateOnly ( const GfMatrix3f mx)

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

void SetRow ( int  i,
const GfVec4f v 
)
inline

Sets a row of the matrix from a Vec4.

Definition at line 188 of file matrix4f.h.

void SetRow3 ( int  i,
const GfVec3f 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 matrix4f.h.

GF_API GfMatrix4f& SetScale ( float  scaleFactor)

Sets matrix to specify a uniform scaling by scaleFactor.

GF_API GfMatrix4f& SetScale ( const GfVec3f scaleFactors)

Sets the matrix to specify a nonuniform scaling in x, y, and z by the factors in vector scaleFactors.

GF_API GfMatrix4f& SetTransform ( const GfRotation rotate,
const GfVec3f translate 
)

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

GF_API GfMatrix4f& SetTransform ( const GfMatrix3f rotmx,
const GfVec3f translate 
)

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

GF_API GfMatrix4f& SetTranslate ( const GfVec3f trans)

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

GF_API GfMatrix4f& SetTranslateOnly ( const GfVec3f t)

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

GfMatrix4f& SetZero ( )
inline

Sets the matrix to zero.

Definition at line 255 of file matrix4f.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 640 of file matrix4f.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 652 of file matrix4f.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 688 of file matrix4f.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 699 of file matrix4f.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 664 of file matrix4f.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 677 of file matrix4f.h.

Friends And Related Function Documentation

size_t hash_value ( GfMatrix4f const &  m)
friend

Hash.

Definition at line 305 of file matrix4f.h.

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

Returns the product of a matrix and a float.

Definition at line 426 of file matrix4f.h.

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

Multiplies matrix m1 by m2.

Definition at line 468 of file matrix4f.h.

GfVec4f operator* ( const GfMatrix4f m,
const GfVec4f vec 
)
friend

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

Definition at line 482 of file matrix4f.h.

GfVec4f operator* ( const GfVec4f vec,
const GfMatrix4f m 
)
friend

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

Definition at line 490 of file matrix4f.h.

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

Adds matrix m2 to m1.

Definition at line 452 of file matrix4f.h.

GF_API friend GfMatrix4f operator- ( const GfMatrix4f m)
friend

Returns the unary negation of matrix m.

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

Subtracts matrix m2 from m1.

Definition at line 460 of file matrix4f.h.

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

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

Definition at line 476 of file matrix4f.h.


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