#include <include/Matrix3.h>
Public Member Functions | |
Matrix3 () | |
Matrix3 (const Vector3 &v0, const Vector3 &v1, const Vector3 &v2) | |
Matrix3 (const float &x00, const float &x01, const float &x02, const float &x10, const float &x11, const float &x12, const float &x20, const float &x21, const float &x22) | |
Matrix3 & | zero () |
Vector3 & | operator[] (int n) |
const Vector3 & | operator[] (int n) const |
void | setOne (const int c, const Vector3 &v) |
void | setOne (const int c, const float v1, const float v2, const float v3) |
void | setAll (const Vector3 &v1, const Vector3 &v2, const Vector3 &v3) |
void | setAll (const Vector3 *v) |
Vector3 | getOne (const int c) |
void | getAll (Vector3 &v1, Vector3 &v2, Vector3 &v3) |
Matrix3 & | id () |
Matrix3 & | transpose () |
float | det () |
Matrix3 & | inv () |
Matrix3 & | outer (const Vector3 &a, const Vector3 &b) |
Matrix3 & | vecCross (const Vector3 &v) |
Matrix3 & | cay (const Vector3 &v) |
Matrix3 & | rotAround (const Vector3 &v, float angle) |
Matrix3 | operator* (const Matrix3 &m) |
Vector3 | operator* (const Vector3 &v) |
Matrix3 | operator+ (const Matrix3 &m) const |
Matrix3 | operator- (const Matrix3 &m) const |
Matrix3 | operator- () const |
Matrix3 & | operator= (const Matrix3 &m) |
Matrix3 & | operator+= (const Matrix3 &m) |
Matrix3 & | operator-= (const Matrix3 &m) |
Matrix3 & | operator*= (const float s) |
Matrix3 & | operator/= (const float s) |
int | operator== (const Matrix3 &m) const |
int | operator!= (const Matrix3 &m) const |
void | print (ostream &out) const |
Friends | |
Matrix3 | operator* (const Matrix3 &m, float d) |
Matrix3 | operator* (float d, const Matrix3 &m) |
Matrix3 | operator/ (const Matrix3 &m, float d) |
ostream & | operator<< (ostream &out, const Matrix3 &m) |
This class provides storage for a 3x3 floating point table, representing a matrix. It is possible to compute determinant, inverse, transpose and other standart matrix operations.
A matrix is given by 3 Vector3 column vectors and has the form
Caution : When accessing a matrix element by M[i][j], i is the column index, and j the row index! In the linear algebra literature most of the time this convention is the inverse. The structure is chosen like this such that a change of basis from a coordinate system A to a coordinate system B is given by the matrix M, composed by the basis column vectors of the final coordinate system.
Matrix3::Matrix3 | ( | ) |
The default constructor initializes all matrix elements to zero.
References Vector3::zero().
Referenced by operator+(), and operator-().
Constructs a Matrix3 given three row vectors v0, v1 and v2.
Matrix3::Matrix3 | ( | const float & | x00, | |
const float & | x01, | |||
const float & | x02, | |||
const float & | x10, | |||
const float & | x11, | |||
const float & | x12, | |||
const float & | x20, | |||
const float & | x21, | |||
const float & | x22 | |||
) |
Constructs a Matrix3 from 9 floats. Given in row-first order.
Matrix3 & Matrix3::zero | ( | ) |
Set all matrix elements to zero. Returns an instance to itself.
References Vector3::zero().
Referenced by Curve< Vector >::inertiaTensor().
Vector3 & Matrix3::operator[] | ( | int | n | ) | [inline] |
const Vector3 & Matrix3::operator[] | ( | int | n | ) | const [inline] |
void Matrix3::setOne | ( | const int | c, | |
const Vector3 & | v | |||
) |
Fill matrix column c with the components of the vector v.
void Matrix3::setOne | ( | const int | c, | |
const float | v1, | |||
const float | v2, | |||
const float | v3 | |||
) |
Fill matrix column c from top to bottom with the values v1 to v3.
Reset the matrix by columns v1 to v3.
Referenced by id().
Put the matrix columns into the vectors v1 to v3.
Matrix3 & Matrix3::id | ( | ) |
Set the current matrix to the identity and return a reference to itself.
References setAll().
Referenced by cay(), and Curve< Vector >::principalAxis().
Matrix3 & Matrix3::transpose | ( | ) |
Set the current matrix to its transpose and return a reference to itself.
Columns become rows and rows become the columns. I.e, the transpose of a matrix is
float Matrix3::det | ( | ) |
Computes and returns the determinant of the Matrix3.
Referenced by Matrix4::adjoint(), Matrix4::det(), and inv().
Matrix3 & Matrix3::inv | ( | ) |
Sets the current matrix to its inverse and return a reference to itself.
Given the matrix , its inverse is the matrix B, satisfying the relation
,
where is the identity matrix.
If the matrix is hardly invertible, i.e. its determinant is close to zero, then a warning is posted to the error channel and the matrix itself is not changed.
References det().
Computes the outer product between a vector a and a vector b and stores the result in the current Matrix3 object.
Formally we have the product between a column vector a with a row vector b.
Referenced by Vector3::reflect().
Constructs an skew-symmetric matrix from a vector v of the form
Applied to a vector, this matrix acts like a cross product between v and some other vector w. Therefore
Referenced by cay().
Construct a Cayleigh rotation matrix, defined by
Cay Rotation Matrix "Cay(v)", where v are the components of the rot axis and |v| is magnitude of rotation
References id(), Vector3::norm2(), and vecCross().
Referenced by Tube< Vector >::makeMesh().
Sets the current matrix to a rotation matrix. Where the rotation is in the positive trigonometric direction about the axis v by an angle alpha.
References Vector3::normalize().
Multiplies the current matrix on the right hand side by m and returns the result as a new Matrix3 instance.
Applies the current matrix on the left side of a column vector v and returns a vector with the result.
Matrix3 Matrix3::operator- | ( | ) | const |
Assign operator. Makes a copy of m. Returns an instance to itself.
Adds the matrix m to the current one. Returns an instance to itself.
Substracts the matrix m from the current one. Returns an instance to itself.
Matrix3 & Matrix3::operator*= | ( | const float | s | ) |
Multiplies all the elements of the current matrix by s and returns\ an instance to itself.
Matrix3 & Matrix3::operator/= | ( | const float | s | ) |
Divides all the elements of the current matrix by s and returns\ an instance to itself.
int Matrix3::operator== | ( | const Matrix3 & | m | ) | const |
Compare the current matrix to m. If all the elements are the same, the function return 1, 0 otherwise.
int Matrix3::operator!= | ( | const Matrix3 & | m | ) | const |
Compare the current matrix to m. Returns 1 if they are different. 0 if they are the same.
void Matrix3::print | ( | ostream & | out | ) | const |
Prints the components of this matrix in a formated way onto the stream out.
Multiplies every element of the matrix m by a factor of d. and returns a Matrix3 object.
Multiplies every element of the matrix m by a factor of d. and returns a Matrix3 object.
Divides every element of the matrix m by d. and returns a Matrix3 object.
ostream & Matrix3::operator<< | ( | ostream & | out, | |
const Matrix3 & | m | |||
) | [friend] |