Loading...
Searching...
No Matches
GfMatrix4f Class Reference

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

#include <matrix4f.h>

Public Types

typedef float ScalarType
 

Public Member Functions

 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)
 Constructor.
 
 GfMatrix4f (const float m[4][4])
 Constructor.
 
 GfMatrix4f (float s)
 Constructor.
 
 GfMatrix4f (const GfVec4f &v)
 Constructor.
 
GF_API GfMatrix4f (const std::vector< std::vector< double > > &v)
 Constructor.
 
GF_API GfMatrix4f (const std::vector< std::vector< float > > &v)
 Constructor.
 
GF_API GfMatrix4f (const std::vector< double > &r0, const std::vector< double > &r1, const std::vector< double > &r2, const std::vector< double > &r3)
 Constructor.
 
GF_API GfMatrix4f (const std::vector< float > &r0, const std::vector< float > &r1, const std::vector< float > &r2, const std::vector< float > &r3)
 Constructor.
 
GF_API GfMatrix4f (const GfRotation &rotate, const GfVec3f &translate)
 Constructor.
 
GF_API GfMatrix4f (const GfMatrix3f &rotmx, const GfVec3f &translate)
 Constructor.
 
GF_API GfMatrix4f (const class GfMatrix4d &m)
 This explicit constructor converts a "double" matrix to a "float" matrix.
 
void SetRow (int i, const GfVec4f &v)
 Sets a row of the matrix from a Vec4.
 
void SetColumn (int i, const GfVec4f &v)
 Sets a column of the matrix from a Vec4.
 
GfVec4f GetRow (int i) const
 Gets a row of the matrix as a Vec4.
 
GfVec4f GetColumn (int i) const
 Gets a column of the matrix as a Vec4.
 
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.
 
GfMatrix4fSet (const float m[4][4])
 Sets the matrix from a 4x4 array of float values, specified in row-major order.
 
GfMatrix4fSetIdentity ()
 Sets the matrix to the identity matrix.
 
GfMatrix4fSetZero ()
 Sets the matrix to zero.
 
GF_API GfMatrix4fSetDiagonal (float s)
 Sets the matrix to s times the identity matrix.
 
GF_API GfMatrix4fSetDiagonal (const GfVec4f &)
 Sets the matrix to have diagonal (v[0], v[1], v[2], v[3]).
 
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 * data ()
 Returns raw access to components of matrix as an array of float values.
 
const float * data () const
 Returns const raw access to components of matrix as an array of float values.
 
float * GetArray ()
 Returns vector components as an array of float values.
 
const float * GetArray () const
 Returns vector components as a const array of float values.
 
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.
 
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.
 
GF_API bool operator== (const GfMatrix4d &m) const
 Tests for element-wise matrix equality.
 
GF_API bool operator== (const GfMatrix4f &m) const
 Tests for element-wise matrix equality.
 
bool operator!= (const GfMatrix4d &m) const
 Tests for element-wise matrix inequality.
 
bool operator!= (const GfMatrix4f &m) const
 Tests for element-wise matrix inequality.
 
GF_API GfMatrix4f GetTranspose () const
 Returns the transpose of the 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.
 
GF_API double GetDeterminant () const
 Returns the determinant of the matrix.
 
void SetRow3 (int i, const GfVec3f &v)
 Sets a row of the matrix from a Vec3.
 
GfVec3f GetRow3 (int i) const
 Gets a row of the matrix as a Vec3.
 
double GetDeterminant3 () const
 Returns the determinant of the upper 3x3 matrix.
 
bool HasOrthogonalRows3 () const
 Returns true, if the row vectors of the upper 3x3 matrix form an orthogonal basis.
 
GF_API bool Orthonormalize (bool issueWarning=true)
 Makes the matrix orthonormal in place.
 
GF_API GfMatrix4f GetOrthonormalized (bool issueWarning=true) const
 Returns an orthonormalized copy of the matrix.
 
GF_API double GetHandedness () const
 Returns the sign of the determinant of the upper 3x3 matrix, i.e.
 
bool IsRightHanded () const
 Returns true if the vectors in the upper 3x3 matrix form a right-handed coordinate system.
 
bool IsLeftHanded () const
 Returns true if the vectors in the upper 3x3 matrix form a left-handed coordinate system.
 
GF_API GfMatrix4foperator*= (const GfMatrix4f &m)
 Post-multiplies matrix m into this matrix.
 
GF_API GfMatrix4foperator*= (double)
 Multiplies the matrix by a float.
 
GF_API GfMatrix4foperator+= (const GfMatrix4f &m)
 Adds matrix m to this matrix.
 
GF_API GfMatrix4foperator-= (const GfMatrix4f &m)
 Subtracts matrix m from this matrix.
 
GF_API GfMatrix4fSetScale (float scaleFactor)
 Sets matrix to specify a uniform scaling by scaleFactor.
 
GF_API GfMatrix4f RemoveScaleShear () const
 Returns the matrix with any scaling or shearing removed, leaving only the rotation and translation.
 
3D Transformation Utilities
GF_API GfMatrix4fSetRotate (const GfQuatf &rot)
 Sets the matrix to specify a rotation equivalent to rot, and clears the translation.
 
GF_API GfMatrix4fSetRotateOnly (const GfQuatf &rot)
 Sets the matrix to specify a rotation equivalent to rot, without clearing the translation.
 
GF_API GfMatrix4fSetRotate (const GfRotation &rot)
 Sets the matrix to specify a rotation equivalent to rot, and clears the translation.
 
GF_API GfMatrix4fSetRotateOnly (const GfRotation &rot)
 Sets the matrix to specify a rotation equivalent to rot, without clearing the translation.
 
GF_API GfMatrix4fSetRotate (const GfMatrix3f &mx)
 Sets the matrix to specify a rotation equivalent to mx, and clears the translation.
 
GF_API GfMatrix4fSetRotateOnly (const GfMatrix3f &mx)
 Sets the matrix to specify a rotation equivalent to mx, without clearing the translation.
 
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.
 
GF_API GfMatrix4fSetTranslate (const GfVec3f &trans)
 Sets matrix to specify a translation by the vector trans, and clears the rotation.
 
GF_API GfMatrix4fSetTranslateOnly (const GfVec3f &t)
 Sets matrix to specify a translation by the vector trans, without clearing the rotation.
 
GF_API GfMatrix4fSetTransform (const GfRotation &rotate, const GfVec3f &translate)
 Sets matrix to specify a rotation by rotate and a translation by translate.
 
GF_API GfMatrix4fSetTransform (const GfMatrix3f &rotmx, const GfVec3f &translate)
 Sets matrix to specify a rotation by rotmx and a translation by translate.
 
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).
 
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.
 
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:
 
GfVec3f ExtractTranslation () const
 Returns the translation part of the matrix, defined as the first three elements of the last row.
 
GF_API GfRotation ExtractRotation () const
 Returns the rotation corresponding to this matrix.
 
GF_API GfQuatf ExtractRotationQuat () const
 Return the rotation corresponding to this matrix as a quaternion.
 
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.
 
GF_API GfMatrix3f ExtractRotationMatrix () const
 Returns the rotation corresponding to this matrix.
 
GfVec3d Transform (const GfVec3d &vec) const
 Transforms the row vector vec by the matrix, returning the result.
 
GfVec3f Transform (const GfVec3f &vec) const
 Transforms the row vector vec by the matrix, returning the result.
 
GfVec3d TransformDir (const GfVec3d &vec) const
 Transforms row vector vec by the matrix, returning the result.
 
GfVec3f TransformDir (const GfVec3f &vec) const
 Transforms row vector vec by the matrix, returning the result.
 
GfVec3d TransformAffine (const GfVec3d &vec) const
 Transforms the row vector vec by the matrix, returning the result.
 
GfVec3f TransformAffine (const GfVec3f &vec) const
 Transforms the row vector vec by the matrix, returning the result.
 

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.
 
GfMatrix4f operator* (const GfMatrix4f &m1, double d)
 Returns the product of a matrix and a float.
 
GfMatrix4f operator* (double d, const GfMatrix4f &m)
 
GF_API friend GfMatrix4f operator- (const GfMatrix4f &m)
 Returns the unary negation of matrix m.
 
GfMatrix4f operator+ (const GfMatrix4f &m1, const GfMatrix4f &m2)
 Adds matrix m2 to m1.
 
GfMatrix4f operator- (const GfMatrix4f &m1, const GfMatrix4f &m2)
 Subtracts matrix m2 from m1.
 
GfMatrix4f operator* (const GfMatrix4f &m1, const GfMatrix4f &m2)
 Multiplies matrix m1 by m2.
 
GfMatrix4f operator/ (const GfMatrix4f &m1, const GfMatrix4f &m2)
 Divides matrix m1 by m2 (that is, m1 * inv(m2)).
 
GfVec4f operator* (const GfMatrix4f &m, const GfVec4f &vec)
 Returns the product of a matrix m and a column vector vec.
 
GfVec4f operator* (const GfVec4f &vec, const GfMatrix4f &m)
 Returns the product of row vector vec and a matrix m.
 

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 87 of file matrix4f.h.

Member Typedef Documentation

◆ ScalarType

typedef float ScalarType

Definition at line 90 of file matrix4f.h.

Constructor & Destructor Documentation

◆ GfMatrix4f() [1/12]

GfMatrix4f ( )
default

Default constructor. Leaves the matrix component values undefined.

◆ GfMatrix4f() [2/12]

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 101 of file matrix4f.h.

◆ GfMatrix4f() [3/12]

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 113 of file matrix4f.h.

◆ GfMatrix4f() [4/12]

GfMatrix4f ( float  s)
inlineexplicit

Constructor.

Explicitly initializes the matrix to s times the identity matrix.

Definition at line 119 of file matrix4f.h.

◆ GfMatrix4f() [5/12]

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 125 of file matrix4f.h.

◆ GfMatrix4f() [6/12]

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.

◆ GfMatrix4f() [7/12]

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.

◆ GfMatrix4f() [8/12]

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.

◆ GfMatrix4f() [9/12]

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.

◆ GfMatrix4f() [10/12]

GF_API GfMatrix4f ( const GfRotation rotate,
const GfVec3f translate 
)

Constructor.

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

◆ GfMatrix4f() [11/12]

GF_API GfMatrix4f ( const GfMatrix3f rotmx,
const GfVec3f translate 
)

Constructor.

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

◆ GfMatrix4f() [12/12]

GF_API GfMatrix4f ( const class GfMatrix4d m)
explicit

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

Member Function Documentation

◆ data() [1/2]

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 273 of file matrix4f.h.

◆ data() [2/2]

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 279 of file matrix4f.h.

◆ DecomposeRotation()

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

◆ ExtractRotation()

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.

◆ ExtractRotationMatrix()

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.

◆ ExtractRotationQuat()

GF_API GfQuatf 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.

◆ ExtractTranslation()

GfVec3f ExtractTranslation ( ) const
inline

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

Definition at line 618 of file matrix4f.h.

◆ Factor()

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.

◆ Get()

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.

◆ GetArray() [1/2]

float * GetArray ( )
inline

Returns vector components as an array of float values.

Definition at line 284 of file matrix4f.h.

◆ GetArray() [2/2]

const float * GetArray ( ) const
inline

Returns vector components as a const array of float values.

Definition at line 289 of file matrix4f.h.

◆ GetColumn()

GfVec4f GetColumn ( int  i) const
inline

Gets a column of the matrix as a Vec4.

Definition at line 208 of file matrix4f.h.

◆ GetDeterminant()

GF_API double GetDeterminant ( ) const

Returns the determinant of the matrix.

◆ GetDeterminant3()

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 379 of file matrix4f.h.

◆ GetHandedness()

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.

◆ GetInverse()

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.

◆ GetOrthonormalized()

GF_API GfMatrix4f GetOrthonormalized ( bool  issueWarning = true) const

Returns an orthonormalized copy of the matrix.

◆ GetRow()

GfVec4f GetRow ( int  i) const
inline

Gets a row of the matrix as a Vec4.

Definition at line 203 of file matrix4f.h.

◆ GetRow3()

GfVec3f GetRow3 ( int  i) const
inline

Gets a row of the matrix as a Vec3.

Definition at line 372 of file matrix4f.h.

◆ GetTranspose()

GF_API GfMatrix4f GetTranspose ( ) const

Returns the transpose of the matrix.

◆ HasOrthogonalRows3()

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 386 of file matrix4f.h.

◆ IsLeftHanded()

bool IsLeftHanded ( ) const
inline

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

Definition at line 424 of file matrix4f.h.

◆ IsRightHanded()

bool IsRightHanded ( ) const
inline

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

Definition at line 418 of file matrix4f.h.

◆ operator!=() [1/2]

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 337 of file matrix4f.h.

◆ operator!=() [2/2]

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 343 of file matrix4f.h.

◆ operator*=() [1/2]

GF_API GfMatrix4f & operator*= ( const GfMatrix4f m)

Post-multiplies matrix m into this matrix.

◆ operator*=() [2/2]

GF_API GfMatrix4f & operator*= ( double  )

Multiplies the matrix by a float.

◆ operator+=()

GF_API GfMatrix4f & operator+= ( const GfMatrix4f m)

Adds matrix m to this matrix.

◆ operator-=()

GF_API GfMatrix4f & operator-= ( const GfMatrix4f m)

Subtracts matrix m from this matrix.

◆ operator==() [1/2]

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.

◆ operator==() [2/2]

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.

◆ operator[]() [1/2]

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 296 of file matrix4f.h.

◆ operator[]() [2/2]

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 301 of file matrix4f.h.

◆ Orthonormalize()

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.

◆ RemoveScaleShear()

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.

◆ Set() [1/2]

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 228 of file matrix4f.h.

◆ Set() [2/2]

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 215 of file matrix4f.h.

◆ SetColumn()

void SetColumn ( int  i,
const GfVec4f v 
)
inline

Sets a column of the matrix from a Vec4.

Definition at line 195 of file matrix4f.h.

◆ SetDiagonal() [1/2]

GF_API GfMatrix4f & SetDiagonal ( const GfVec4f )

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

◆ SetDiagonal() [2/2]

GF_API GfMatrix4f & SetDiagonal ( float  s)

Sets the matrix to s times the identity matrix.

◆ SetIdentity()

GfMatrix4f & SetIdentity ( )
inline

Sets the matrix to the identity matrix.

Definition at line 249 of file matrix4f.h.

◆ SetLookAt() [1/2]

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.

◆ SetLookAt() [2/2]

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.

◆ SetRotate() [1/3]

GF_API GfMatrix4f & SetRotate ( const GfMatrix3f mx)

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

◆ SetRotate() [2/3]

GF_API GfMatrix4f & SetRotate ( const GfQuatf rot)

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

◆ SetRotate() [3/3]

GF_API GfMatrix4f & SetRotate ( const GfRotation rot)

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

◆ SetRotateOnly() [1/3]

GF_API GfMatrix4f & SetRotateOnly ( const GfMatrix3f mx)

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

◆ SetRotateOnly() [2/3]

GF_API GfMatrix4f & SetRotateOnly ( const GfQuatf rot)

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

◆ SetRotateOnly() [3/3]

GF_API GfMatrix4f & SetRotateOnly ( const GfRotation rot)

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

◆ SetRow()

void SetRow ( int  i,
const GfVec4f v 
)
inline

Sets a row of the matrix from a Vec4.

Definition at line 187 of file matrix4f.h.

◆ SetRow3()

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 365 of file matrix4f.h.

◆ SetScale() [1/2]

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.

◆ SetScale() [2/2]

GF_API GfMatrix4f & SetScale ( float  scaleFactor)

Sets matrix to specify a uniform scaling by scaleFactor.

◆ SetTransform() [1/2]

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

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

◆ SetTransform() [2/2]

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

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

◆ SetTranslate()

GF_API GfMatrix4f & SetTranslate ( const GfVec3f trans)

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

◆ SetTranslateOnly()

GF_API GfMatrix4f & SetTranslateOnly ( const GfVec3f t)

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

◆ SetZero()

GfMatrix4f & SetZero ( )
inline

Sets the matrix to zero.

Definition at line 254 of file matrix4f.h.

◆ Transform() [1/2]

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 659 of file matrix4f.h.

◆ Transform() [2/2]

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 671 of file matrix4f.h.

◆ TransformAffine() [1/2]

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 707 of file matrix4f.h.

◆ TransformAffine() [2/2]

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 718 of file matrix4f.h.

◆ TransformDir() [1/2]

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 683 of file matrix4f.h.

◆ TransformDir() [2/2]

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 696 of file matrix4f.h.

Friends And Related Function Documentation

◆ GfMatrix4d

friend class GfMatrix4d
friend

Definition at line 746 of file matrix4f.h.

◆ hash_value

size_t hash_value ( GfMatrix4f const &  m)
friend

Hash.

Definition at line 304 of file matrix4f.h.

◆ operator* [1/5]

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

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

Definition at line 493 of file matrix4f.h.

◆ operator* [2/5]

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

Multiplies matrix m1 by m2.

Definition at line 479 of file matrix4f.h.

◆ operator* [3/5]

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

Returns the product of a matrix and a float.

Definition at line 437 of file matrix4f.h.

◆ operator* [4/5]

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

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

Definition at line 501 of file matrix4f.h.

◆ operator* [5/5]

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

Definition at line 445 of file matrix4f.h.

◆ operator+

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

Adds matrix m2 to m1.

Definition at line 463 of file matrix4f.h.

◆ operator- [1/2]

GF_API friend GfMatrix4f operator- ( const GfMatrix4f m)
friend

Returns the unary negation of matrix m.

◆ operator- [2/2]

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

Subtracts matrix m2 from m1.

Definition at line 471 of file matrix4f.h.

◆ operator/

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

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

Definition at line 487 of file matrix4f.h.

Member Data Documentation

◆ numColumns

const size_t numColumns = 4
static

Definition at line 93 of file matrix4f.h.

◆ numRows

const size_t numRows = 4
static

Definition at line 92 of file matrix4f.h.


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