# cMatrix3d Struct Reference
[Math]

cMatrix3d represents a 3x3 matrix. Each cell of the matrix is composed of a double. This matrix class also provides as simple set of methods to handle floating point arithmetic operations. More...

`#include <CMatrix3d.h>`

List of all members.

## Public Member Functions
| cMatrix3d ()
void | set (const double &a_value)
void | set (const double &a_m00, const double &a_m01, const double &a_m02, const double &a_m10, const double &a_m11, const double &a_m12, const double &a_m20, const double &a_m21, const double &a_m22)
void | setCol (const cVector3d &a_vectCol0, const cVector3d &a_vectCol1, const cVector3d &a_vectCol2)
void | setCol0 (const cVector3d &a_vectCol)
void | setCol1 (const cVector3d &a_vectCol)
void | setCol2 (const cVector3d &a_vectCol)
cVector3d | getCol0 () const
cVector3d | getCol1 () const
cVector3d | getCol2 () const
cVector3d | getRow (const unsigned int &index) const
cVector3d | operator[] (const unsigned int &index) const
void | operator/= (const double &a_val)
void | operator*= (const double &a_val)
cVector3d | operator* (const cVector3d &a_val)
cMatrix3d | operator* (const cMatrix3d &a_val)
void | operator*= (const cMatrix3d &a_val)
void | operator+= (const cMatrix3d &a_input)
void | operator-= (const cMatrix3d &a_input)
void | copyto (cMatrix3d &a_destination) const
void | copyfrom (const cMatrix3d &a_source)
void | identity ()
void | mul (const cMatrix3d &a_matrix)
void | mulr (const cMatrix3d &a_matrix, cMatrix3d &a_result) const
void | mul (cVector3d &a_vector) const
void | mulr (const cVector3d &a_vector, cVector3d &a_result) const
double | det () const
void | trans ()
void | transr (cMatrix3d &a_result) const
bool | invert ()
cMatrix3d | inv (bool *a_result=0) const
bool | invertr (cMatrix3d &a_result) const
bool | set (const cVector3d &a_axis, const double &a_angleRad)
bool | rotate (const cVector3d &a_axis, const double &a_angleRad)
bool | rotater (const cVector3d &a_axis, const double &a_angleRad, cMatrix3d &a_result) const
void | str (string &a_string, const unsigned int a_precision=2) const
string | str (const unsigned int a_precision=2) const
void | print (const unsigned int a_precision=2) const
bool | equals (cMatrix3d &a_matrix) const
bool | toAngleAxis (double &a_angle, cVector3d &a_axis)
## Public Attributes
double | m [3][3]
| Array of doubles describing the matrix.

## Detailed Description

cMatrix3d represents a 3x3 matrix. Each cell of the matrix is composed of a double. This matrix class also provides as simple set of methods to handle floating point arithmetic operations.

## Constructor & Destructor Documentation

cMatrix3d::cMatrix3d | ( |  | ) | `[inline]`

Constructor of cMatrix3d.

## Member Function Documentation

void cMatrix3d::copyfrom | ( | const cMatrix3d & | a_source | ) | `[inline]`

Copy values from an external matrix passed as parameter to current matrix.

Parameters:

  | a_source | Source matrix.

void cMatrix3d::copyto | ( | cMatrix3d & | a_destination | ) | const`[inline]`

Copy current matrix values to an external matrix passed as parameter.

Parameters:

  | a_destination | Destination matrix.

double cMatrix3d::det | ( |  | ) | const`[inline]`

Compute the determinant of current matrix.

Returns:
  Returns determinant of current matrix.

bool cMatrix3d::equals | ( | cMatrix3d & | a_matrix | ) | const`[inline]`

Compare two matrices. Return true if both matrices are equal, otherwise return false.

Parameters:

  | a_matrix | Matrix to compare with.

Returns:
  Returns true if matrices are equal, otherwise false.

cVector3d cMatrix3d::getCol0 | ( |  | ) | const`[inline]`

Read column vector 0 of matrix.

Returns:
  Return vector 0 of current matrix.

cVector3d cMatrix3d::getCol1 | ( |  | ) | const`[inline]`

Read column vector 1 of matrix.

Returns:
  Return vector 1 of current matrix.

cVector3d cMatrix3d::getCol2 | ( |  | ) | const`[inline]`

Read column vector 2 of matrix.

Returns:
  Return vector 2 of current matrix.

cVector3d cMatrix3d::getRow | ( | const unsigned int & | index | ) | const`[inline]`

Read a row of this matrix.

Returns:
  Return a row of this matrix... not a valid l-value; this does not return a reference into this matrix.

void cMatrix3d::identity | ( |  | ) | `[inline]`

Set the identity matrix.

cMatrix3d cMatrix3d::inv | ( | bool * | a_result = `0` | ) | const`[inline]`

Compute the inverse of current matrix.
If the operation succeeds, result is returned.

Parameters:

  | a_result | (optional) return true if the operation succeeds otherwise false.

Returns:
  Inverted matrix.

bool cMatrix3d::invert | ( |  | ) | `[inline]`

Compute the inverse of current matrix.
If the operation succeeds, result is stored in current matrix.

Returns:
  Returns true if matrix was inverted successfully, otherwise return false.

bool cMatrix3d::invertr | ( | cMatrix3d & | a_result | ) | const`[inline]`

Compute the inverse of current matrix. If the operation succeeds, result is stored in result matrix passed as parameter.

Parameters:

  | a_result | Result is stored here.

Returns:
  Returns true if matrix was inverted successfully, otherwise return false.

void cMatrix3d::mul | ( | cVector3d & | a_vector | ) | const`[inline]`

Multiply current matrix with an external vector passed as parameter.
vector = M * vector.
Result is stored in same vector.

Parameters:

  | a_vector | Vector with which multiplication is performed. Result is stored is same vector.

void cMatrix3d::mul | ( | const cMatrix3d & | a_matrix | ) | `[inline]`

Multiply current matrix with an external matrix. M = M * a_matrix. Result is stored in current matrix.

Parameters:

  | a_matrix | Matrix with which multiplication is performed.

void cMatrix3d::mulr | ( | const cVector3d & | a_vector,
|  | cVector3d & | a_result |
| ) |  |  | const`[inline]`

Multiply current matrix with a vector.
result = M * vector.
Result is stored in result vector result. `

Parameters:

  | a_vector | Vector with which multiplication is performed.
  | a_result | Result of multiplication is stored here.

void cMatrix3d::mulr | ( | const cMatrix3d & | a_matrix,
|  | cMatrix3d & | a_result |
| ) |  |  | const`[inline]`

Multiply current matrix with an external matrix.
result = M * matrix.
Result is stored in result matrix.

Parameters:

  | a_matrix | Matrix with which multiplication is performed.
  | a_result | Result matrix.

cMatrix3d cMatrix3d::operator* | ( | const cMatrix3d & | a_val | ) | `[inline]`

An overloaded * operator for matrix/matrix multiplication.

cVector3d cMatrix3d::operator* | ( | const cVector3d & | a_val | ) | `[inline]`

An overloaded * operator for matrix/vector multiplication.

void cMatrix3d::operator*= | ( | const cMatrix3d & | a_val | ) | `[inline]`

An overloaded *= operator for matrix/matrix multiplication.

void cMatrix3d::operator*= | ( | const double & | a_val | ) | `[inline]`

An overloaded *= operator for matrix/scalar multiplication.

void cMatrix3d::operator+= | ( | const cMatrix3d & | a_input | ) | `[inline]`

An overloaded += operator for matrix/matrix addition.

void cMatrix3d::operator-= | ( | const cMatrix3d & | a_input | ) | `[inline]`

An overloaded -= operator for matrix/matrix subtraction.

void cMatrix3d::operator/= | ( | const double & | a_val | ) | `[inline]`

An overloaded /= operator for matrix/scalar division.

cVector3d cMatrix3d::operator[] | ( | const unsigned int & | index | ) | const`[inline]`

This is a slightly confusing operator, because the operation:
my_matrix[1][2] = 4.0;
Warning:
...compiles, but does not modify the matrix. Be careful!

void cMatrix3d::print | ( | const unsigned int | a_precision = `2` | ) | const`[inline]`

Print the current matrix using the CHAI_DEBUG_PRINT macro.

Parameters:

  | a_precision | Number of digits.

bool cMatrix3d::rotate | ( | const cVector3d & | a_axis,
|  | const double & | a_angleRad |
| ) |  |  | `[inline]`

Rotate current matrix around an axis an angle defined as parameters.

Parameters:

  | a_axis | Axis of rotation.
  | a_angleRad | Rotation angle in Radian.

Returns:
  Returns true if operation succeeded. Otherwise return false.

bool cMatrix3d::rotater | ( | const cVector3d & | a_axis,
|  | const double & | a_angleRad,
|  | cMatrix3d & | a_result |
| ) |  |  | const`[inline]`

Rotate current matrix around an axis an angle defined as parameters.
Result is stored in result matrix.

Parameters:

  | a_axis | Axis of rotation.
  | a_angleRad | Rotation angle in Radian.
  | a_result | Result is stored here.

Returns:
  Returns true if operation succeeded. Otherwise return false.

bool cMatrix3d::set | ( | const cVector3d & | a_axis,
|  | const double & | a_angleRad |
| ) |  |  | `[inline]`

Build a rotation matrix defined by a rotation axis and rotation angle given in radian. These values are passed as parameters.
Result is stored in current matrix.

Parameters:

  | a_axis | Axis of rotation.
  | a_angleRad | Rotation angle in Radian.

Returns:
  Returns true if operation succeeded. Otherwise return false.

void cMatrix3d::set | ( | const double & | a_m00,
|  | const double & | a_m01,
|  | const double & | a_m02,
|  | const double & | a_m10,
|  | const double & | a_m11,
|  | const double & | a_m12,
|  | const double & | a_m20,
|  | const double & | a_m21,
|  | const double & | a_m22 |
| ) |  |  | `[inline]`

Initialize a matrix bypassing as parameter values for each cell.

Parameters:

  | a_m00 | Matrix Component [0,0]
  | a_m01 | Matrix Component [0,1]
  | a_m02 | Matrix Component [0,2]
  | a_m10 | Matrix Component [1,0]
  | a_m11 | Matrix Component [1,1]
  | a_m12 | Matrix Component [1,2]
  | a_m20 | Matrix Component [2,0]
  | a_m21 | Matrix Component [2,1]
  | a_m22 | Matrix Component [2,2]

void cMatrix3d::set | ( | const double & | a_value | ) | `[inline]`

Initialize a matrix with a scalar which is copied to each cell of the matrix.

Parameters:

  | a_value | Value.

void cMatrix3d::setCol | ( | const cVector3d & | a_vectCol0,
|  | const cVector3d & | a_vectCol1,
|  | const cVector3d & | a_vectCol2 |
| ) |  |  | `[inline]`

Initialize a matrix by passing as parameter 3 column vectors.
M = (V0,V1,V2).

Parameters:

  | a_vectCol0 | Vector Column 0.
  | a_vectCol1 | Vector Column 1.
  | a_vectCol2 | Vector Column 2.

void cMatrix3d::setCol0 | ( | const cVector3d & | a_vectCol | ) | `[inline]`

Set column 0 of matrix with vector passed as parameter.

Parameters:

  | a_vectCol | Vector Column 0.

void cMatrix3d::setCol1 | ( | const cVector3d & | a_vectCol | ) | `[inline]`

Set column 1 of matrix with vector passed as parameter.

Parameters:

  | a_vectCol | Vector Column 1.

void cMatrix3d::setCol2 | ( | const cVector3d & | a_vectCol | ) | `[inline]`

Set column 2 of matrix with vector passed as parameter.

Parameters:

  | a_vectCol | Vector Column 2.

string cMatrix3d::str | ( | const unsigned int | a_precision = `2` | ) | const`[inline]`

Convert current matrix into a string, which is returned on the stack.

Parameters:

  | a_precision | Number of digits.

void cMatrix3d::str | ( | string & | a_string,
|  | const unsigned int | a_precision = `2` |
| ) |  |  | const`[inline]`

Convert current matrix into a string.

Parameters:

  | a_string | String where conversion is stored
  | a_precision | Number of digits.

bool cMatrix3d::toAngleAxis | ( | double & | a_angle,
|  | cVector3d & | a_axis |
| ) |  |  | `[inline]`

Convert the rotation to an angle axis

Parameters:

  | a_angle | Angle result
  | a_axis | Axis result

Returns:
  Returns true if operation succeeded. Otherwise return false.

void cMatrix3d::trans | ( |  | ) | `[inline]`

Compute the transpose of current matrix.
Result is stored in current matrix.

void cMatrix3d::transr | ( | cMatrix3d & | a_result | ) | const`[inline]`

Compute the transpose of current matrix.
Result is stored in result matrix.

Parameters:

  | a_result | Result is stored here.

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

- D:/CHAI3D/build-2-0-0/2.0.0/win32/src/math/CMatrix3d.h

CHAI3D 2.0.0 documentation
Please address any questions to support@chai3d.org
(C) 2003-2009 - CHAI 3D
All Rights Reserved.