ASL
Loading...
Searching...
No Matches
Matrix3_< T > Class Template Reference

Detailed Description

template<class T>
class asl::Matrix3_< T >

A Matrix3 is a 3x3 matrix useful for representing affine transformations in 2D space.

Matrix3 rotation = Matrix3::rotate(PI/3) * Matrix3::scale(0.5);
Vec2 v = translation * rotation * Vec2(x, y);
static Matrix3_ rotate(float t)
Definition Matrix3.h:246
T rotation() const
Returns the rotation part of this matrix (assuming there is no skew).
Definition Matrix3.h:305
static Matrix3_ scale(float s)
Definition Matrix3.h:268
Vec2_< T > translation() const
Returns the translation part of this matrix (the last column) as a Vec2.
Definition Matrix3.h:295
static Matrix3_ translate(const Vec2_< float > &t)
Definition Matrix3.h:255

#include <asl/Matrix3.h>

Public Member Functions

int rows () const
 Returns the nubmer of rows of this matrix (3).
int cols () const
 Returns the nubmer of columns of this matrix (3).
T trace () const
 Returns the trace of this matrix.
 Matrix3_ (T a00, T a01, T a02, T a10, T a11, T a12, T a20=0, T a21=0, T a22=1)
 Constructs a 3x3 matrix given its elements (by rows).
 Matrix3_ (const T *m, bool colmajor=false)
 Constructs a matrix from elements pointed by m, row-major (default) or column-major.
template<class T2>
Matrix3_< T2 > with () const
 Returns a copy of this matrix with elements converted to the given type.
Matrix3_ transposed () const
 Returns this matrix transposed.
T & operator() (int i, int j)
 Returns the element at row i, column j.
Vec2_< T > operator* (const Vec2_< T > &v) const
 Returns vector v left-multiplied by this matrix (only two components, to apply an affine transform).
Vec3_< T > operator* (const Vec3_< T > &v) const
 Returns vector v transformed by this affine transform.
Vec2_< T > operator^ (const Vec2_< T > &v) const
 Returns vector v transformed by this projective transform.
Matrix3_ operator* (T t) const
 Returns this matrix multiplied by scalar t.
Matrix3_ operator+ (const Matrix3_ &B) const
 Returns this matrix plus B.
Matrix3_ operator- (const Matrix3_ &B) const
 Returns this matrix minus B.
Matrix3_ operator* (const Matrix3_ &B) const
 Returns this matrix multiplied by matrix B.
Vec2_< T > column2 (int i) const
 Returns the i-th column's top 2 elements as a Vec2.
Vec3_< T > column (int i) const
 Returns the i-th column as a Vec3.
Vec2_< T > translation () const
 Returns the translation part of this matrix (the last column) as a Vec2.
Matrix3_ & setTranslation (const Vec2_< T > &t)
 Sets the translation part of this matrix (the last column).
T rotation () const
 Returns the rotation part of this matrix (assuming there is no skew).
Matrix3_ inverse () const
 Returns the inverse of this matrix.
T det () const
 Returns the determinant of this matrix.
T normSq () const
 Returns the matrix Frobenius norm squared.
T norm () const
 Returns the matrix Frobenius norm.

Static Public Member Functions

static Matrix3_ identity ()
 Returns a 3x3 identity matrix.
static Matrix3_ zeros ()
 Returns a zero matrix.
static Matrix3_ rotate (T t)
 Returns a 2D rotation matrix for angle t.
static Matrix3_ translate (const Vec2_< T > &t)
 Returns a 2D translation matrix for vector t.
static Matrix3_ scale (T s)
 Returns a 2D scale matrix with factor s.
static Matrix3_ scale (T sx, T sy)
 Returns a 2D scale matrix with factor sx, sy.

The documentation for this class was generated from the following file:
  • Matrix3.h