Float2x2
A 2x2 matrix of floating-point values.
A Float2x2
can represent any linear transformation on the 2D plane without a translation
component, such as rotation, scale or shear.
The matrix is stored in column-major order. In other words, it's an array of two Float2
column
vectors.
Header File
#include <ply-math/Matrix.h>
Also included from <ply-math/Base.h>
.
Constructors
-
Constructs an uninitialized
Float2x2
. -
Constructs a 2x2 matrix from the given column vectors.
Float2x2 m = {{1, 0}, {0, 1}};
-
Accesses the column vector at the specified index.
Float2x2 m = {{1, 0}, {0, 1}}; m[0].x = -1; StdOut::text() << m[1]; // "{0, 1}"
bool operator==(const Float2x2& a, const Float2x2& b)
[code]bool operator!=(const Float2x2& a, const Float2x2& b)
[code]-
Returns
true
if the matrices are equal (or not equal) using floating-point comparison. In particular, a component with a value of0.f
is equal to a component with a value of-0.f
. -
Returns the identity matrix
{{1, 0}, {0, 1}}
. -
Returns a scale matrix.
-
Returns a counter-clockwise rotation matrix. The angle is specified in radians.
-
Returns a rotation and scale matrix whose first column is given by
c
. Transforming a vector by this matrix is equivalent to premultiplying by the vector byc
on the complex plane.Float2x2::fromComplex({1, 0}) // returns the identity matrix
-
Returns the transpose of the 2x2 matrix. If the matrix is orthogonal (in other words, it consists only of a rotation and/or reflection), this function also returns the inverse matrix.
-
Transform a vector using a matrix.
v
is treated as a column vector and premultiplied by the matrixm
. Float2x2 operator*(const Float2x2& a, const Float2x2& b)
[code]-
Matrix multiplication.