Main Page | Namespace List | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

PS2Math Namespace Reference

Namespace for maths needed by the tutorials This namespace contains various classes to handle math needed by tutorial examples. More...


Classes

class  Matrix44
 Class to handle square 4x4 matrix This class is build not to handle a general 4x4 matrix but to work with linear function in omogeneous space. More...

class  Vector4
 Class representing an omogeneous vector. More...


Enumerations

enum  MainAxis { X_AXIS, Y_AXIS, Z_AXIS }
 This enum is used to specify rotation axis for various functions of Matrix44.


Functions

Matrix44Matrix44Multiply (const Matrix44 &M1, const Matrix44 &M2, Matrix44 &Result)
 Matrix Multiplication, result is stored in new matrix.

Matrix44Matrix44MultiplyL (Matrix44 &M1_result, const Matrix44 &M2)
 Matrix Multiplication, result is stored in first matrix.

Matrix44Matrix44MultiplyR (const Matrix44 &M1, Matrix44 &M2_result)
 Matrix Multiplication, result is stored in first matrix.

const Matrix44 operator * (const Matrix44 &M1, const Matrix44 &M2)
 Operators * for class Matrix44.

Matrix44operator *= (Matrix44 &M1, const Matrix44 &M2)
 Operators *= for class Matrix44.

std::ostream & operator<< (std::ostream &outStream, const Matrix44 &Mat)
 To print Matrix44 Element with standard stream, useful for debugging.

const Vector4 operator * (const Matrix44 &M, const Vector4 &V)
 Multiply a Matrix44 for a vector, remember that I use column vectors.

const Vector4 operator- (const Vector4 &V)
 Negate a vector, same module, same direction opposite verse.

const Vector4 operator * (const Vector4 &V1, const Vector4 &V2)
 Cross product between two vectors in a Rigth handed coordinate system.

const Vector4 operator- (const Vector4 &V1, const Vector4 &V2)
 Subtraction between two vertex.

const Vector4 operator+ (const Vector4 &V1, const Vector4 &V2)
 Addiction between two vertex.

float Dot (const Vector4 &V1, const Vector4 &V2)
 External function to do Dot operation, this because operator * is used for cross product.

std::ostream & operator<< (std::ostream &outStream, const Vector4 &V)
 To print Vector4 Element with standard stream, useful for debugging.


Function Documentation

float PS2Math::Dot const Vector4 V1,
const Vector4 V2
 

Definition at line 164 of file Vector4.cpp.

Matrix44 & PS2Math::Matrix44Multiply const Matrix44 M1,
const Matrix44 M2,
Matrix44 Result
 

This function is used to multiply two Matrix44 object, pay attenction that the destination matrix cannot be one of the two matrix used for the operation. A call of the type Matrix44Multiply(M1, M1, M2) is wrong, use Matrix44MultiplyL(Matrix44 &, const Matrix44 &) instead. This fact is due to the implementation of this function that calculate one element at a time and immediatly store them in result matrix. This function is not to be used directly: to multiply two Matrix44 object is preferible to use the * operator.

Parameters:
M1 Right Matrix involved into the multiplication
M2 Left Matrix involved into the multiplication
Result Matrix in with store the result
Returns:
A reference to Result matrix passed as parameters.
Deprecated:

Definition at line 26 of file Matrix44Operation.cpp.

const Vector4 PS2Math::operator * const Matrix44 M,
const Vector4 V
 

This is used to Transform a Vector44 by a transformation function expressed by a Matrix44, result is transformed vector.

Parameters:
M Matrix of the Transformation to apply to the vector
V Vector to be transformed
Returns:
A new const Vector4 object that represent V transformed by matrix M

Definition at line 117 of file Matrix44Operation.cpp.

const Matrix44 PS2Math::operator * const Matrix44 M1,
const Matrix44 M2
 

This is the usual * operator for 4x4 Matrix, both matrix object are passed as const reference because they must not be modified.

Parameters:
M1 First matrix operand in moltiplication operation
M2 Second matrix operand in moltiplication operation
Returns:
A temporary const matrix representing the result of the mulplication operation.

Definition at line 342 of file Matrix44.cpp.

Matrix44 & PS2Math::operator *= Matrix44 M1,
const Matrix44 M2
 

Operator *= for class Matrix44, it internally use the Matrix44MultiplyL function that multiply two matrix storing result in the Matrix44 object passed as first(left) parameter. It perform the operation M1 *= M2, since M2 matrix is not modified it is passed as const reference.

Parameters:
M1 Matrix44 object used as left matrix
M2 Matrix44 object used as rigth parameter
Returns:
A non const referece to the M1 Matrix object

Definition at line 360 of file Matrix44.cpp.

const Vector4 PS2Math::operator- const Vector4 V  ) 
 

Unary minus operator is useful to change sign of a vector

Definition at line 130 of file Vector4.cpp.

std::ostream & PS2Math::operator<< std::ostream &  outStream,
const Vector4 V
 

Debugging routine that permit to output in a stream the content of a Vector44 object.

Definition at line 119 of file Vector4.cpp.

std::ostream & PS2Math::operator<< std::ostream &  outStream,
const Matrix44 Mat
 

This is a standard implementation of operator << to output the content of a Matrix44 object to a std::outStream, it can be very useful because it's very easy to output content of a matrix to a file for debug purpose.

Definition at line 372 of file Matrix44.cpp.


Generated on Wed Jan 7 19:12:21 2004 for PS2 Tutorial by doxygen 1.3.4