KrisLibrary
1.0.0
|
A 2x2 matrix class. More...
#include <primitives.h>
Public Member Functions | |
Matrix2 (const Matrix2 &) | |
Matrix2 (Real) | |
Matrix2 (const Real[2][2]) | |
Matrix2 (const Real *) | |
Matrix2 (const Vector2 &xb, const Vector2 &yb) | |
bool | operator== (const Matrix2 &) const |
bool | operator!= (const Matrix2 &) const |
const Matrix2 & | operator= (const Matrix2 &) |
void | operator+= (const Matrix2 &) |
void | operator-= (const Matrix2 &) |
void | operator*= (const Matrix2 &) |
void | operator*= (Real scale) |
void | operator/= (Real scale) |
operator const Real * () const | |
Real & | operator() (int i, int j) |
const Real & | operator() (int i, int j) const |
void | set (const Matrix2 &) |
void | set (Real) |
void | set (const Real[2][2]) |
void | set (const Real *) |
void | set (const Vector2 &xb, const Vector2 &yb) |
void | setZero () |
void | setIdentity () |
void | setDiagonal (const Vector2 &) |
void | setTranspose (const Matrix2 &) |
void | setNegative (const Matrix2 &) |
bool | setInverse (const Matrix2 &) |
returns true when successful | |
void | setScale (Real s) |
void | setScale (Real sx, Real sy) |
void | setRotate (Real rads) |
sets the matrix that rotates ccw by rads | |
void | setOuterProduct (const Vector2 &a, const Vector2 &b) |
this = a*b^t | |
void | get (Matrix2 &) const |
void | get (Real[2][2]) const |
void | get (Real[4]) const |
void | get (Vector2 &xb, Vector2 &yb) const |
void | getTranspose (Matrix2 &) const |
void | getNegative (Matrix2 &) const |
bool | getInverse (Matrix2 &) const |
void | inplaceTranspose () |
void | inplaceNegative () |
bool | inplaceInverse () |
void | inplaceMul (Real s) |
void | inplaceDiv (Real s) |
void | inplaceRowScale (Real sx, Real sy) |
void | inplaceColScale (Real sx, Real sy) |
bool | isZero (Real eps=Zero) const |
bool | isIdentity (Real eps=Zero) const |
bool | isEqual (const Matrix2 &, Real eps=Zero) const |
bool | isInvertible (Real eps=Zero) const |
Real | determinant () const |
Real | trace () const |
Real | minElement (int *i=NULL, int *j=NULL) const |
Real | maxElement (int *i=NULL, int *j=NULL) const |
Real | minAbsElement (int *i=NULL, int *j=NULL) const |
Real | maxAbsElement (int *i=NULL, int *j=NULL) const |
bool | Read (File &) |
bool | Write (File &) const |
Real * | col (int j) |
Real * | col1 () |
Real * | col2 () |
const Real * | col (int j) const |
const Real * | col1 () const |
const Real * | col2 () const |
void | setCol (int j, const Vector2 &v) |
void | setCol1 (const Vector2 &v) |
void | setCol2 (const Vector2 &v) |
void | setRow (int i, const Vector2 &v) |
void | setRow1 (const Vector2 &v) |
void | setRow2 (const Vector2 &v) |
void | getCol (int j, Vector2 &v) const |
void | getCol1 (Vector2 &v) const |
void | getCol2 (Vector2 &v) const |
void | getRow (int i, Vector2 &v) const |
void | getRow1 (Vector2 &v) const |
void | getRow2 (Vector2 &v) const |
Vector2 | getXBasis () const |
Vector2 | getYBasis () const |
matrix ops (this = a op b) | |
void | add (const Matrix2 &a, const Matrix2 &b) |
void | sub (const Matrix2 &a, const Matrix2 &b) |
void | mul (const Matrix2 &a, const Matrix2 &b) |
void | mulTransposeA (const Matrix2 &a, const Matrix2 &b) |
void | mulTransposeB (const Matrix2 &a, const Matrix2 &b) |
scalar ops (this = a op b) | |
void | mul (const Matrix2 &a, Real b) |
void | div (const Matrix2 &a, Real b) |
vector ops (out = this op a) | |
void | mul (const Vector2 &a, Vector2 &out) const |
void | mulTranspose (const Vector2 &a, Vector2 &out) const |
Public Attributes | |
Real | data [2][2] |
column major format | |
A 2x2 matrix class.
The elements can be accessed as (i,j) for i,j in [0,1].
WARNING: For historical reasons, the data array data[2][2] is in column major format, e.g. data[i][j] = element (j,i).