mat2
Header file: include/mat2.h
mat2 is a column-major matrix with 2 columns and 2 rows.
\(mat2 = \begin{bmatrix} x.x & y.x \\ x.y & y.y \end{bmatrix}\)
Class variables
Type |
Name |
Description |
|---|---|---|
x |
The first column of the mat2. |
|
y |
The second column of the mat2. |
Class functions
Constructors
Name |
Description |
|---|---|
Construct a ([0.0, 0.0], [0.0, 0.0]) matrix. |
|
Construct a ([_value, _value], [_value, _value]) matrix. |
|
Construct a ([_xx, _xy], [_yx, _yy]) matrix. |
|
Construct a ([_xx, _xy], [_y.x, _y.y]) matrix. |
|
Construct a ([_x.x, _x.y], [_yx, _yy]) matrix. |
|
Construct a ([_x.x, _x.y], [_y.x, _y.y]) matrix. |
|
Construct a matrix from a pointer. |
|
Construct a ([_mat.x.x, _mat.x.y], [_mat.y.x, _mat.y.y]) matrix. |
|
Construct a ([_mat.x.x, _mat.x.y], [_mat.y.x, _mat.y.y]) matrix. |
Operators
Name |
Description |
|---|---|
Add a mat2 to the current mat2. |
|
Substract a mat2 from the current mat2. |
|
Multiply the current mat2 by a mat2. |
|
Multiply the current mat2 by a scalar. |
|
Divide the current mat2 by a scalar. |
|
Return a reference to x if index is 0 or a reference to y if index is 1, else, throw an exception. |
|
Return a const reference to x if index is 0 or a const reference to y if index is 1, else, throw an exception. |
Functions
Name |
Description |
|---|---|
Return the determinant of the matrix. |
|
Return a pointer to the matrix’s elements. |
Static Functions
Name |
Description |
|---|---|
Return a ([1.0, 0.0], [0.0, 1.0]) identity matrix. |
Namespace functions
Operators
Name |
Description |
|---|---|
Return a mat2 that is the sum between two mat2. |
|
Return a mat2 that is the difference between two mat2. |
|
Return a mat2 that is the product between two mat2. |
|
Return a vec2 that is the product between a mat2 and a vec2. |
|
Return a mat2 that is the product between a mat2 and a scalar. |
|
Return a mat2 that is the product between a scalar and a mat2. |
|
Return a mat2 that is the quotient between a mat2 and a scalar. |
|
Return true if the two mat2 are identical, else, return false. |
|
Return true if the two mat2 are different, else, return false. |
Functions
Name |
Description |
|---|---|
Return a mat2 where the columns of mat are the rows and the rows of mat are the columns. |
|
Return the inverse of a mat2. |
|
Return a mat2 as a string under the format “[[x.x, x.y], [y.x, y.y]]”. |