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

PS2Math::Vector4 Class Reference

Class representing an omogeneous vector. More...

#include <PS2Math.h>

List of all members.

Public Member Functions

 Vector4 ()
 Simple constructor, there is nothing to initialize.

 Vector4 (float x, float y, float z, float w=1)
 Contructor to initialize the vector with coordinates values.

Vector4Omogenize ()
 Divide x,y,z by w to find real R3 coordinates.

Vector4Normalize ()
 Normalize vector dividing by the module.

Vector4OmogenizeWtoZ ()
 Divide x, y by w, put w to z and set w to 1, used to omogenize a projected vertex.

float ConvertToFixedPoint (int[])
 Transform data into fixed point format of front buffer of GS.

float & operator[] (int Index)
 operator to use this class as an array.

const float operator[] (int Index) const
 operator to use this class as an array. (Const version)


Public Attributes

float x
 Values storing coordinates of the vertex.

float y
 Values storing coordinates of the vertex.

float z
 Values storing coordinates of the vertex.

float w
 Values storing coordinates of the vertex.


Detailed Description

This class is used to deal with omogeneous vector, such a class is needed to have operators that works with matrix44 class and to define vectors operations such as dot and cross product using omogeneous coordinates.

Definition at line 125 of file PS2Math.h.


Constructor & Destructor Documentation

Vector4::Vector4 float  x,
float  y,
float  z,
float  w = 1
 

Simple constructor from explicit float values. Last value is defaulted to 1.

Definition at line 19 of file Vector4.cpp.


Member Function Documentation

float PS2Math::Vector4::ConvertToFixedPoint int  Vertex[]  ) 
 

This routine is peculiar to PS2 and it's used to convert coordinate values from normal floating point representation to fixed point representation used by front buffer of ps2. Vector is deomogenized during conversion since this operation is done only before sending data to front buffer. If texture Perspective correction is used (S,T,Q) remember that this routine is to be called immediatly after projection matrix is applied, this because perspective correction algorithm needs to know W value of the vector after projection.

Parameters:
Vertex Array of 4 integer that will contain at exit converted value of the vertex.
Returns:
Inverse of W coordinate, this is necessary to do perspective correct texturing in witch GS interpolate U/W, V/W and 1/W.

Definition at line 183 of file Vector4.cpp.

Vector4 & Vector4::Normalize  ) 
 

Do normalization of the vector dividing all coordinate for the module of the vector itself.

Definition at line 46 of file Vector4.cpp.

Vector4 & Vector4::Omogenize  ) 
 

Simply divide x, y, z by w coordinate to move from omogeneuos coordinate to normal cartesian coordinate system.

Definition at line 32 of file Vector4.cpp.

Vector4 & Vector4::OmogenizeWtoZ  ) 
 

Used in conjunction with projection matrix. Some type of projection matrix are W-friendly, this means that after transformation Z coordinate of the vertices are stored in w coordinate of projected vertices. This function is used to bring vector back to normal 3D coordinate system after a projection.

Definition at line 63 of file Vector4.cpp.

float & Vector4::operator[] int  Index  ) 
 

Operator [] is normally used to access the vector4 structure like an array.

Definition at line 77 of file Vector4.cpp.


The documentation for this class was generated from the following files:
Generated on Wed Jan 7 19:12:22 2004 for PS2 Tutorial by doxygen 1.3.4