Crystal Space: csMatrix2 Class Reference (Crystal Space Public API Reference)

| ## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# csMatrix2 Class Reference
[Geometry utilities]

A 2x2 matrix. More...

`#include <csgeom/matrix2.h>`

List of all members.

## Public Member Functions
csVector2 | Col1 () const
| Get the first column of this matrix as a vector.
csVector2 | Col2 () const
| Get the second column of this matrix as a vector.
| csMatrix2 (float m11, float m12, float m21, float m22)
| Construct a matrix and initialize it.
| csMatrix2 ()
| Construct a matrix, initialized to be the identity.
float | Determinant () const
| Compute the determinant of this matrix.
csMatrix2 | GetInverse () const
| Return the inverse of this matrix.
csMatrix2 | GetTranspose () const
| Return the transpose of this matrix.
void | Identity ()
| Set this matrix to the identity matrix.
void | Invert ()
| Invert this matrix.
csMatrix2 & | operator *= (float s)
| Multiply this matrix with a scalar.
csMatrix2 & | operator *= (const csMatrix2 &m)
| Multiply another matrix with this matrix.
csMatrix2 | operator+ () const
| Unary + operator.
csMatrix2 & | operator+= (const csMatrix2 &m)
| Add another matrix to this matrix.
csMatrix2 | operator- () const
| Unary - operator.
csMatrix2 & | operator-= (const csMatrix2 &m)
| Subtract another matrix from this matrix.
csMatrix2 & | operator/= (float s)
| Divide this matrix by a scalar.
csVector2 | Row1 () const
| Get the first row of this matrix as a vector.
csVector2 | Row2 () const
| Get the second row of this matrix as a vector.
void | Set (float m11, float m12, float m21, float m22)
| Set matrix values.
void | Transpose ()
| Transpose this matrix.
## Public Attributes
float | m11
float | m12
float | m21
float | m22
## Friends
csMatrix2 | operator * (float f, const csMatrix2 &m)
| Multiply a matrix and a scalar.
csMatrix2 | operator * (const csMatrix2 &m, float f)
| Multiply a matrix and a scalar.
csVector2 | operator * (const csMatrix2 &m, const csVector2 &v)
| Multiply a vector by a matrix (transform it).
csMatrix2 | operator * (const csMatrix2 &m1, const csMatrix2 &m2)
| Multiply two matricies.
csMatrix2 | operator+ (const csMatrix2 &m1, const csMatrix2 &m2)
| Add two matricies.
csMatrix2 | operator- (const csMatrix2 &m1, const csMatrix2 &m2)
| Subtract two matricies.
csMatrix2 | operator/ (const csMatrix2 &m, float f)
| Divide a matrix by a scalar.

## Detailed Description

A 2x2 matrix.

Definition at line 37 of file matrix2.h.

## Constructor & Destructor Documentation

csMatrix2::csMatrix2 | ( |  | ) |

Construct a matrix, initialized to be the identity.

csMatrix2::csMatrix2 | ( | float | m11,
|  | float | m12,
|  | float | m21,
|  | float | m22 |
| ) |  |  |

Construct a matrix and initialize it.

## Member Function Documentation

csVector2 csMatrix2::Col1 | ( |  | ) | const`[inline]`

Get the first column of this matrix as a vector.

Definition at line 58 of file matrix2.h.

csVector2 csMatrix2::Col2 | ( |  | ) | const`[inline]`

Get the second column of this matrix as a vector.

Definition at line 61 of file matrix2.h.

float csMatrix2::Determinant | ( |  | ) | const

Compute the determinant of this matrix.

csMatrix2 csMatrix2::GetInverse | ( |  | ) | const`[inline]`

Return the inverse of this matrix.

Definition at line 101 of file matrix2.h.

csMatrix2 csMatrix2::GetTranspose | ( |  | ) | const

Return the transpose of this matrix.

void csMatrix2::Identity | ( |  | ) |

Set this matrix to the identity matrix.

void csMatrix2::Invert | ( |  | ) | `[inline]`

Invert this matrix.

Definition at line 109 of file matrix2.h.

csMatrix2& csMatrix2::operator *= | ( | float | s | ) |

Multiply this matrix with a scalar.

csMatrix2& csMatrix2::operator *= | ( | const csMatrix2 & | m | ) |

Multiply another matrix with this matrix.

csMatrix2 csMatrix2::operator+ | ( |  | ) | const`[inline]`

Unary + operator.

Definition at line 87 of file matrix2.h.

csMatrix2& csMatrix2::operator+= | ( | const csMatrix2 & | m | ) |

Add another matrix to this matrix.

csMatrix2 csMatrix2::operator- | ( |  | ) | const`[inline]`

Unary - operator.

Definition at line 89 of file matrix2.h.

csMatrix2& csMatrix2::operator-= | ( | const csMatrix2 & | m | ) |

Subtract another matrix from this matrix.

csMatrix2& csMatrix2::operator/= | ( | float | s | ) |

Divide this matrix by a scalar.

csVector2 csMatrix2::Row1 | ( |  | ) | const`[inline]`

Get the first row of this matrix as a vector.

Definition at line 52 of file matrix2.h.

csVector2 csMatrix2::Row2 | ( |  | ) | const`[inline]`

Get the second row of this matrix as a vector.

Definition at line 55 of file matrix2.h.

void csMatrix2::Set | ( | float | m11,
|  | float | m12,
|  | float | m21,
|  | float | m22 |
| ) |  |  | `[inline]`

Set matrix values.

Definition at line 64 of file matrix2.h.

References m11, m12, m21, and m22.

void csMatrix2::Transpose | ( |  | ) |

Transpose this matrix.

## Friends And Related Function Documentation

csMatrix2 operator * | ( | float | f,
|  | const csMatrix2 & | m |
| ) |  |  | `[friend]`

Multiply a matrix and a scalar.

csMatrix2 operator * | ( | const csMatrix2 & | m,
|  | float | f |
| ) |  |  | `[friend]`

Multiply a matrix and a scalar.

csVector2 operator * | ( | const csMatrix2 & | m,
|  | const csVector2 & | v |
| ) |  |  | `[friend]`

Multiply a vector by a matrix (transform it).

Definition at line 125 of file matrix2.h.

csMatrix2 operator * | ( | const csMatrix2 & | m1,
|  | const csMatrix2 & | m2 |
| ) |  |  | `[friend]`

Multiply two matricies.

csMatrix2 operator+ | ( | const csMatrix2 & | m1,
|  | const csMatrix2 & | m2 |
| ) |  |  | `[friend]`

Add two matricies.

csMatrix2 operator- | ( | const csMatrix2 & | m1,
|  | const csMatrix2 & | m2 |
| ) |  |  | `[friend]`

Subtract two matricies.

csMatrix2 operator/ | ( | const csMatrix2 & | m,
|  | float | f |
| ) |  |  | `[friend]`

Divide a matrix by a scalar.

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

- csgeom/matrix2.h