Public Member Functions | Public Attributes

ml7::Matrix2x2 Class Reference

#include <Matrix2x2.h>

List of all members.

Public Member Functions

 Matrix2x2 (void)
 Matrix2x2 (const Matrix2x2 &m)
Matrix2x2operator= (const Matrix2x2 &m)
void swap (Matrix2x2 &m)
 ~Matrix2x2 (void)
 Matrix2x2 (const float _11, const float _12, const float _21, const float _22)
 Matrix2x2 (const float phi)
const float det () const
const Matrix2x2 transposed () const
const Matrix2x2 inverted () const
const float operator[] (unsigned index) const
float & operator[] (unsigned index)
const Vector2 get (unsigned i) const
const Matrix2x2set (unsigned i, const Vector2 &v)
const Matrix2x2set (const ml7::Vector2 &x, const ml7::Vector2 &y)
const float angle () const
const Matrix2x2 operator- () const
const Matrix2x2 operator+ (const Matrix2x2 &m) const
const Matrix2x2 operator- (const Matrix2x2 &m) const
const Matrix2x2 operator* (const float s) const
const Vector2 operator* (const Vector2 &v) const
const Matrix2x2 operator* (const Matrix2x2 &m) const
const Vector2 trans (const Vector2 &v) const
const Vector2 transinv (const Vector2 &v) const
Matrix2x2operator+= (const Matrix2x2 &m)
Matrix2x2operator-= (const Matrix2x2 &m)
Matrix2x2operator*= (const float s)
Matrix2x2operator*= (const Matrix2x2 &m)
Matrix2x2clear ()
Matrix2x2identity ()
Matrix2x2transpose ()
Matrix2x2transpose (const Matrix2x2 &m)
Matrix2x2invert ()
Matrix2x2invert (const Matrix2x2 &m)
Matrix2x2rotation (const float phi)
const bool operator== (const Matrix2x2 &m) const
const bool operator!= (const Matrix2x2 &m) const
const bool operator< (const Matrix2x2 &m) const
const bool operator> (const Matrix2x2 &m) const
const bool operator<= (const Matrix2x2 &m) const
const bool operator>= (const Matrix2x2 &m) const
 operator const float *const () const
 operator float *const ()

Public Attributes

union {
   struct {
      float   a
      float   b
      float   c
      float   d
   } 
   struct {
      float   _11
      float   _12
      float   _21
      float   _22
   } 
   float   data [4]
   float   m [2][2]
}; 

Detailed Description

Represents a 2x2-matrix for rotating 2d-vectors. Used for 2d-physics and -graphics.


Constructor & Destructor Documentation

ml7::Matrix2x2::Matrix2x2 ( void   )  [inline]

Default constructor. Creates a new identity matrix representing a zero rotation.

ml7::Matrix2x2::Matrix2x2 ( const Matrix2x2 m  )  [inline]

Copy constructor. Copies a given matrix m.

ml7::Matrix2x2::~Matrix2x2 ( void   )  [inline]

Destructor.

ml7::Matrix2x2::Matrix2x2 ( const float  _11,
const float  _12,
const float  _21,
const float  _22 
) [inline]

Explicit constructor with parameters for each element.

ml7::Matrix2x2::Matrix2x2 ( const float  phi  )  [inline, explicit]

Explicit constructor. Creates a rotation matrix by a ccw-angle phi in radians.


Member Function Documentation

const float ml7::Matrix2x2::angle (  )  const [inline]

Returns the angle of the counter-clockwise rotation represented by this matrix.

Matrix2x2& ml7::Matrix2x2::clear (  )  [inline]

Forces this matrix to be an empty matrix representing no legal rotation.

const float ml7::Matrix2x2::det (  )  const [inline]

Returns the determinant of this matrix.

const Vector2 ml7::Matrix2x2::get ( unsigned  i  )  const [inline]

Returns the i-th (0-indexed) column vector of this matrix.

Matrix2x2& ml7::Matrix2x2::identity (  )  [inline]

Forces this matrix to be an identity matrix representing a zero rotation.

Matrix2x2& ml7::Matrix2x2::invert (  )  [inline]

Inverts this matrix. Fortunately we have to deal with a rotation matrix so we confidently may do a transposition instead of an expensive inversion.

Matrix2x2& ml7::Matrix2x2::invert ( const Matrix2x2 m  )  [inline]

Replaces this matrix by a given matrix m inverted. Fortunately we have to deal with a rotation matrix so we confidently may do a transposition instead of an expensive inversion.

const Matrix2x2 ml7::Matrix2x2::inverted (  )  const [inline]

Copies this matrix and inverts it. Fortunately we have to deal with a rotation matrix so we confidently may do a transposition instead of an expensive inversion.

ml7::Matrix2x2::operator const float *const (  )  const [inline]
ml7::Matrix2x2::operator float *const (  )  [inline]
const bool ml7::Matrix2x2::operator!= ( const Matrix2x2 m  )  const [inline]

Checks if a given matrix m and this have non-identical elements.

const Vector2 ml7::Matrix2x2::operator* ( const Vector2 v  )  const [inline]

Returns a copy of a given vector v tranformed by this matrix.

const Matrix2x2 ml7::Matrix2x2::operator* ( const Matrix2x2 m  )  const [inline]

Returns a copy of a given matrix m transformed by this.

const Matrix2x2 ml7::Matrix2x2::operator* ( const float  s  )  const [inline]

Returns a copy of this matrix scaled by a given scalar s.

Matrix2x2& ml7::Matrix2x2::operator*= ( const float  s  )  [inline]

Scales this matrix by a given scalar s.

Matrix2x2& ml7::Matrix2x2::operator*= ( const Matrix2x2 m  )  [inline]

Transforms this matrix by a given matrix m. It results in an operation identical to m * this.

const Matrix2x2 ml7::Matrix2x2::operator+ ( const Matrix2x2 m  )  const [inline]

Returns a given matrix m added to this.

Matrix2x2& ml7::Matrix2x2::operator+= ( const Matrix2x2 m  )  [inline]

Adds a given matrix m to this.

const Matrix2x2 ml7::Matrix2x2::operator- (  )  const [inline]

Returns a copy of this matrix with the elements having signs flipped.

const Matrix2x2 ml7::Matrix2x2::operator- ( const Matrix2x2 m  )  const [inline]

Returns a given matrix m subtracted from this.

Matrix2x2& ml7::Matrix2x2::operator-= ( const Matrix2x2 m  )  [inline]

Subtracts a given matrix m from this.

const bool ml7::Matrix2x2::operator< ( const Matrix2x2 m  )  const [inline]

Checks if the angle of the rotation represented by this matrix is less than that of a given matrix m.

const bool ml7::Matrix2x2::operator<= ( const Matrix2x2 m  )  const [inline]

Checks if the angle of the rotation represented by this matrix is less than or equal to that of a given matrix m.

Matrix2x2& ml7::Matrix2x2::operator= ( const Matrix2x2 m  )  [inline]

Copy assignment operator. Copies the elements of a given matrix m.

const bool ml7::Matrix2x2::operator== ( const Matrix2x2 m  )  const [inline]

Checks if a given matrix m and this have identical elements.

const bool ml7::Matrix2x2::operator> ( const Matrix2x2 m  )  const [inline]

Checks if the angle of the rotation represented by this matrix is greater than that of a given matrix m.

const bool ml7::Matrix2x2::operator>= ( const Matrix2x2 m  )  const [inline]

Checks if the angle of the rotation represented by this matrix is greater than or equal to that of a given matrix m.

float& ml7::Matrix2x2::operator[] ( unsigned  index  )  [inline]

Indexed component access.

const float ml7::Matrix2x2::operator[] ( unsigned  index  )  const [inline]

Indexed component access.

Matrix2x2& ml7::Matrix2x2::rotation ( const float  phi  )  [inline]

Forces this matrix to be a rotation matrix with a ccw-angle phi.

const Matrix2x2& ml7::Matrix2x2::set ( const ml7::Vector2 x,
const ml7::Vector2 y 
) [inline]

Sets the column vectors of this matrix.

const Matrix2x2& ml7::Matrix2x2::set ( unsigned  i,
const Vector2 v 
) [inline]

Sets the i-th (0-indexed) column vector of this matrix.

void ml7::Matrix2x2::swap ( Matrix2x2 m  )  [inline]

Swap operation. Swaps the elements of a given matrix m with this.

const Vector2 ml7::Matrix2x2::trans ( const Vector2 v  )  const

Returns a copy of a given vector v transformed by this matrix.

const Vector2 ml7::Matrix2x2::transinv ( const Vector2 v  )  const

Returns a copy of a given vector v transformed by this matrix inverted.

Matrix2x2& ml7::Matrix2x2::transpose ( const Matrix2x2 m  )  [inline]

Replaces this matrix by a given matrix m transposed.

Matrix2x2& ml7::Matrix2x2::transpose (  )  [inline]

Transposes this matrix.

const Matrix2x2 ml7::Matrix2x2::transposed (  )  const [inline]

Copies this matrix and transposes it.


Member Data Documentation

union { ... }

Element in the 1st row and 1st column.

Element in the 1st row and 2nd column.

Element in the 2nd row and 1st column.

Element in the 2nd row and 2nd column.

Element in the 1st row and 1st column.

Element in the 1st row and 2nd column.

Element in the 2nd row and 1st column.

Element in the 2nd row and 2nd column.

Array of the elements.

float ml7::Matrix2x2::m[2][2]

2d-array of the elements.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines