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 translation = Matrix3::translate(10, 4);
Matrix3 rotation = Matrix3::rotate(PI/3) * Matrix3::scale(0.5);
Vec2 v = translation * rotation * Vec2(x, y);
An Array is a contiguous and resizable array of any type of elements.
Definition Array.h:69
T rotation() const
Returns the rotation part of this matrix (assuming there is no skew)
Definition Matrix3.h:270
Vec2_< T > translation() const
Returns the translation part of this matrix (the last column) as a Vec2.
Definition Matrix3.h:260

#include <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_< T2with () const
 Returns a copy of this matrix with elements converted to the given type.
 
Matrix3_ transposed () const
 Returns this matrix transposed.
 
Toperator() (int i, int j)
 Returns the element at row i, column j.
 
Vec2_< Toperator* (const Vec2_< T > &v) const
 Returns vector v left-multiplied by this matrix (only two components, to apply an affine transform).
 
Vec3_< Toperator* (const Vec3_< T > &v) const
 Returns vector v transformed by this affine transform.
 
Vec2_< Toperator^ (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 the sum of this matrix and B.
 
Matrix3_ operator* (const Matrix3_ &B) const
 Returns this matrix multiplied by matrix B.
 
Vec2_< Tcolumn2 (int i) const
 Returns the i-th column's top 2 elements as a Vec2.
 
Vec3_< Tcolumn (int i) const
 Returns the i-th column as a Vec3.
 
Vec2_< Ttranslation () 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 the 3x3 identity 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 t)
 Returns a 2D scale matrix for factor t.
 

The documentation for this class was generated from the following file: