JNGL
Easy to use cross-platform 2D game library
|
3x3 matrix More...
#include <jngl/Mat3.hpp>
Public Member Functions | |
Mat3 ()=default | |
creates identity matrix | |
Mat3 (std::initializer_list< float >) | |
construct matrix from row-major array with 9 elements | |
Mat3 & | translate (const Vec2 &v) |
Multiplies the matrix with a translation matrix generated from v. | |
Mat3 & | translate (Pixels x, Pixels y) |
Multiplies the matrix with a translation matrix generated from (x,y) | |
Mat3 & | scale (float factor) |
Multiplies the matrix by a scaling matrix. | |
Mat3 & | scale (float xfactor, float yfactor) |
Multiplies the matrix by a scaling matrix. | |
Mat3 & | rotate (float radian) |
Multiplies the matrix with a rotation matrix. | |
Public Attributes | |
float | data [9] = { 1, 0, 0, 0, 1, 0, 0, 0, 1 } |
column-major | |
3x3 matrix
identical to boost::qvm::mat<float, 3, 3>, but stores the elements column-major in memory
|
default |
creates identity matrix
Mat3 | ( | std::initializer_list< float > | ) |
construct matrix from row-major array with 9 elements
jngl::Mat3({ 1, 2, 3, 4, 5, 6, 7, 8, 9 })
is equivalent to:
Multiplies the matrix with a translation matrix generated from v.
Multiplies the matrix with a translation matrix generated from (x,y)
Mat3 & scale | ( | float | factor | ) |
Multiplies the matrix by a scaling matrix.
Equivalent to calling Mat3::scale(factor, factor)
.
Mat3 & scale | ( | float | xfactor, |
float | yfactor ) |
Multiplies the matrix by a scaling matrix.
If you want to draw a sprite with double the width, but the correct height:
Mat3 & rotate | ( | float | radian | ) |
Multiplies the matrix with a rotation matrix.