|
Stores a 2x2 matrix of float
elements.
More...
#include <matrix2f.h>
Public Types | |
typedef float | ScalarType |
Public Member Functions | |
GfMatrix2f ()=default | |
Default constructor. Leaves the matrix component values undefined. | |
GfMatrix2f (float m00, float m01, float m10, float m11) | |
Constructor. | |
GfMatrix2f (const float m[2][2]) | |
Constructor. | |
GfMatrix2f (float s) | |
Constructor. | |
GfMatrix2f (int s) | |
This explicit constructor initializes the matrix to s times the identity matrix. | |
GfMatrix2f (const GfVec2f &v) | |
Constructor. | |
GF_API | GfMatrix2f (const std::vector< std::vector< double > > &v) |
Constructor. | |
GF_API | GfMatrix2f (const std::vector< std::vector< float > > &v) |
Constructor. | |
GF_API | GfMatrix2f (const class GfMatrix2d &m) |
This explicit constructor converts a "double" matrix to a "float" matrix. | |
void | SetRow (int i, const GfVec2f &v) |
Sets a row of the matrix from a Vec2. | |
void | SetColumn (int i, const GfVec2f &v) |
Sets a column of the matrix from a Vec2. | |
GfVec2f | GetRow (int i) const |
Gets a row of the matrix as a Vec2. | |
GfVec2f | GetColumn (int i) const |
Gets a column of the matrix as a Vec2. | |
GfMatrix2f & | Set (float m00, float m01, float m10, float m11) |
Sets the matrix from 4 independent float values, specified in row-major order. | |
GfMatrix2f & | Set (const float m[2][2]) |
Sets the matrix from a 2x2 array of float values, specified in row-major order. | |
GfMatrix2f & | SetIdentity () |
Sets the matrix to the identity matrix. | |
GfMatrix2f & | SetZero () |
Sets the matrix to zero. | |
GF_API GfMatrix2f & | SetDiagonal (float s) |
Sets the matrix to s times the identity matrix. | |
GF_API GfMatrix2f & | SetDiagonal (const GfVec2f &) |
Sets the matrix to have diagonal (v[0], v[1] ). | |
GF_API float * | Get (float m[2][2]) const |
Fills a 2x2 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 2 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 2 float values so that standard indexing (such as m[0][1] ) works correctly. | |
GF_API bool | operator== (const GfMatrix2d &m) const |
Tests for element-wise matrix equality. | |
GF_API bool | operator== (const GfMatrix2f &m) const |
Tests for element-wise matrix equality. | |
bool | operator!= (const GfMatrix2d &m) const |
Tests for element-wise matrix inequality. | |
bool | operator!= (const GfMatrix2f &m) const |
Tests for element-wise matrix inequality. | |
GF_API GfMatrix2f | GetTranspose () const |
Returns the transpose of the matrix. | |
GF_API GfMatrix2f | 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. | |
GF_API GfMatrix2f & | operator*= (const GfMatrix2f &m) |
Post-multiplies matrix m into this matrix. | |
GF_API GfMatrix2f & | operator*= (double) |
Multiplies the matrix by a float. | |
GF_API GfMatrix2f & | operator+= (const GfMatrix2f &m) |
Adds matrix m to this matrix. | |
GF_API GfMatrix2f & | operator-= (const GfMatrix2f &m) |
Subtracts matrix m from this matrix. | |
Static Public Attributes | |
static const size_t | numRows = 2 |
static const size_t | numColumns = 2 |
Friends | |
class | GfMatrix2d |
size_t | hash_value (GfMatrix2f const &m) |
Hash. | |
GfMatrix2f | operator* (const GfMatrix2f &m1, double d) |
Returns the product of a matrix and a float. | |
GfMatrix2f | operator* (double d, const GfMatrix2f &m) |
GF_API friend GfMatrix2f | operator- (const GfMatrix2f &m) |
Returns the unary negation of matrix m. | |
GfMatrix2f | operator+ (const GfMatrix2f &m1, const GfMatrix2f &m2) |
Adds matrix m2 to m1. | |
GfMatrix2f | operator- (const GfMatrix2f &m1, const GfMatrix2f &m2) |
Subtracts matrix m2 from m1. | |
GfMatrix2f | operator* (const GfMatrix2f &m1, const GfMatrix2f &m2) |
Multiplies matrix m1 by m2. | |
GfMatrix2f | operator/ (const GfMatrix2f &m1, const GfMatrix2f &m2) |
Divides matrix m1 by m2 (that is, m1 * inv(m2) ). | |
GfVec2f | operator* (const GfMatrix2f &m, const GfVec2f &vec) |
Returns the product of a matrix m and a column vector vec. | |
GfVec2f | operator* (const GfVec2f &vec, const GfMatrix2f &m) |
Returns the product of row vector vec and a matrix m. | |
Stores a 2x2 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.
Definition at line 44 of file matrix2f.h.
typedef float ScalarType |
Definition at line 47 of file matrix2f.h.
|
default |
Default constructor. Leaves the matrix component values undefined.
|
inline |
Constructor.
Initializes the matrix from 4 independent float
values, specified in row-major order. For example, parameter m10 specifies the value in row 1 and column 0.
Definition at line 58 of file matrix2f.h.
|
inline |
Constructor.
Initializes the matrix from a 2x2 array of float
values, specified in row-major order.
Definition at line 66 of file matrix2f.h.
|
inlineexplicit |
Constructor.
Explicitly initializes the matrix to s times the identity matrix.
Definition at line 72 of file matrix2f.h.
|
inlineexplicit |
This explicit constructor initializes the matrix to s
times the identity matrix.
Definition at line 78 of file matrix2f.h.
|
inlineexplicit |
Constructor.
Explicitly initializes the matrix to diagonal form, with the i th element on the diagonal set to v[i]
.
Definition at line 84 of file matrix2f.h.
|
explicit |
Constructor.
Initialize the matrix from a vector of vectors of double. The vector is expected to be 2x2. If it is too big, only the first 2 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.
|
explicit |
Constructor.
Initialize the matrix from a vector of vectors of float. The vector is expected to be 2x2. If it is too big, only the first 2 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.
|
explicit |
This explicit constructor converts a "double" matrix to a "float" matrix.
|
inline |
Returns raw access to components of matrix as an array of float
values.
Components are in row-major order.
Definition at line 177 of file matrix2f.h.
|
inline |
Returns const raw access to components of matrix as an array of float
values.
Components are in row-major order.
Definition at line 183 of file matrix2f.h.
GF_API float * Get | ( | float | m[2][2] | ) | const |
Fills a 2x2 array of float
values with the values in the matrix, specified in row-major order.
|
inline |
Returns vector components as an array of float
values.
Definition at line 188 of file matrix2f.h.
|
inline |
Returns vector components as a const array of float
values.
Definition at line 193 of file matrix2f.h.
|
inline |
Gets a column of the matrix as a Vec2.
Definition at line 128 of file matrix2f.h.
GF_API double GetDeterminant | ( | ) | const |
Returns the determinant of the matrix.
GF_API GfMatrix2f 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.
|
inline |
Gets a row of the matrix as a Vec2.
Definition at line 123 of file matrix2f.h.
GF_API GfMatrix2f GetTranspose | ( | ) | const |
Returns the transpose of the matrix.
|
inline |
Tests for element-wise matrix inequality.
All elements must match exactly for matrices to be considered equal.
Definition at line 229 of file matrix2f.h.
|
inline |
Tests for element-wise matrix inequality.
All elements must match exactly for matrices to be considered equal.
Definition at line 235 of file matrix2f.h.
GF_API GfMatrix2f & operator*= | ( | const GfMatrix2f & | m | ) |
Post-multiplies matrix m into this matrix.
GF_API GfMatrix2f & operator*= | ( | double | ) |
Multiplies the matrix by a float.
GF_API GfMatrix2f & operator+= | ( | const GfMatrix2f & | m | ) |
Adds matrix m to this matrix.
GF_API GfMatrix2f & operator-= | ( | const GfMatrix2f & | m | ) |
Subtracts matrix m from this matrix.
GF_API bool operator== | ( | const GfMatrix2d & | m | ) | const |
Tests for element-wise matrix equality.
All elements must match exactly for matrices to be considered equal.
GF_API bool operator== | ( | const GfMatrix2f & | m | ) | const |
Tests for element-wise matrix equality.
All elements must match exactly for matrices to be considered equal.
|
inline |
Accesses an indexed row i of the matrix as an array of 2 float
values so that standard indexing (such as m[0][1]
) works correctly.
Definition at line 200 of file matrix2f.h.
|
inline |
Accesses an indexed row i of the matrix as an array of 2 float
values so that standard indexing (such as m[0][1]
) works correctly.
Definition at line 205 of file matrix2f.h.
|
inline |
Sets the matrix from a 2x2 array of float
values, specified in row-major order.
Definition at line 144 of file matrix2f.h.
|
inline |
Sets the matrix from 4 independent float
values, specified in row-major order.
For example, parameter m10 specifies the value in row 1 and column 0.
Definition at line 135 of file matrix2f.h.
|
inline |
Sets a column of the matrix from a Vec2.
Definition at line 117 of file matrix2f.h.
GF_API GfMatrix2f & SetDiagonal | ( | const GfVec2f & | ) |
Sets the matrix to have diagonal (v[0], v[1]
).
GF_API GfMatrix2f & SetDiagonal | ( | float | s | ) |
Sets the matrix to s times the identity matrix.
|
inline |
Sets the matrix to the identity matrix.
Definition at line 153 of file matrix2f.h.
|
inline |
Sets a row of the matrix from a Vec2.
Definition at line 111 of file matrix2f.h.
|
inline |
Sets the matrix to zero.
Definition at line 158 of file matrix2f.h.
|
friend |
Definition at line 338 of file matrix2f.h.
|
friend |
Hash.
Definition at line 208 of file matrix2f.h.
|
friend |
Returns the product of a matrix m and a column vector vec.
Definition at line 321 of file matrix2f.h.
|
friend |
Multiplies matrix m1 by m2.
Definition at line 307 of file matrix2f.h.
|
friend |
Returns the product of a matrix and a float.
Definition at line 265 of file matrix2f.h.
|
friend |
Returns the product of row vector vec and a matrix m.
Definition at line 327 of file matrix2f.h.
|
friend |
Definition at line 273 of file matrix2f.h.
|
friend |
Adds matrix m2 to m1.
Definition at line 291 of file matrix2f.h.
|
friend |
Returns the unary negation of matrix m.
|
friend |
Subtracts matrix m2 from m1.
Definition at line 299 of file matrix2f.h.
|
friend |
Divides matrix m1 by m2 (that is, m1 * inv(m2)
).
Definition at line 315 of file matrix2f.h.
|
static |
Definition at line 50 of file matrix2f.h.
|
static |
Definition at line 49 of file matrix2f.h.