Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

model::Vertex Class Reference
[The PCG model layer]

A Vertex class. More...

#include <Vertex.h>

List of all members.

Public Member Functions

 Vertex ()
 Default constructor.
 Vertex (IvVector3 *vCoordinates)
 Constructor taking a coordinates vector.
 Vertex (float fX, float fY, float fZ)
 Constructor taking 3 floats as coorninates.
 ~Vertex ()
 Default deconstructor.
 Vertex (const Vertex &other)
 Copy constructor.
Vertexoperator= (const Vertex &other)
 Copy assignmed.
IvVector3 * getCoordinates ()
 Get coordinates.
void setCoordinates (IvVector3 *vCoordinates)
 Set coordinates.
void setCoordinates (float fX, float fY, float fZ)
 Sets the coordinates.
void updateCoordinates (float fX, float fY, float fZ)
 Sets the coordinates.
IvVector3 * getNormal ()
 Get normal.
void setNormal (IvVector3 *vNormal)
 Sets the normal.
void setNormal (float fX, float fY, float fZ)
 Sets the normal.
void setIndex (int index)
 Sets the index.
int getIndex ()
 Get the index.
void translate (IvVector3 *vTargetPos)
 Translates the Vertex.
void rotate (float fAngleX, float fAngleY, float fAngleZ)
 Rotate the Vertex.
bool operator== (const Vertex &other) const
 Comparition operator.
bool operator!= (const Vertex &other) const
 Comparition operator.

Private Attributes

IvVector3 * m_vCoordinates
 Vector holding the coordinates of the vertex.
IvVector3 * m_vNormal
int m_index


Detailed Description

A Vertex class.

A data holding class for a Vertex. It has functions to calculate rotation and translation.

See also:
Face | Bone

Definition at line 22 of file Vertex.h.


Constructor & Destructor Documentation

model::Vertex::Vertex  )  [inline]
 

Default constructor.

Creates a empty Vertex

Definition at line 35 of file Vertex.h.

00035 {};

Vertex::Vertex IvVector3 *  vCoordinates  ) 
 

Constructor taking a coordinates vector.

A constructor that takes a vector and creates a vertex with the vector as it's coordinates.

Parameters:
vCoordinates The vertexs coordinates vector.

Definition at line 16 of file Vertex.cpp.

References m_index, and setCoordinates().

00016                                       {
00017         setCoordinates(vCoordinates);
00018         m_index = 0;
00019 }

Here is the call graph for this function:

Vertex::Vertex float  fX,
float  fY,
float  fZ
 

Constructor taking 3 floats as coorninates.

Parameters:
fX Coordinate X.
fY Coordinate Y.
fZ Coordinate Z.
Creates a vertex with the floats as its coordinates.

Definition at line 36 of file Vertex.cpp.

References m_index, and setCoordinates().

00036                                            {
00037         setCoordinates(fX,fY,fZ);
00038         m_index = 0;
00039 }

Here is the call graph for this function:

model::Vertex::~Vertex  )  [inline]
 

Default deconstructor.

It does nothing.

Definition at line 46 of file Vertex.h.

00046 {};

Vertex::Vertex const Vertex other  ) 
 

Copy constructor.

Copying all the variables to the new Vertex.

Parameters:
other A other Vertex

Definition at line 50 of file Vertex.cpp.

References m_index.

00050                                   : 
00051 m_vCoordinates( other.m_vCoordinates ),
00052 m_vNormal( other.m_vNormal )
00053 {
00054         m_index = 0;
00055 }


Member Function Documentation

IvVector3 * Vertex::getCoordinates  ) 
 

Get coordinates.

Returns the coordiantes of the Vertex.

Returns:
A vector containg the corrdiantes of the Vertex.

Definition at line 136 of file Vertex.cpp.

Referenced by model::Model::getModelVertexs(), pcggui::Render(), and model::Model::save().

00136                                   {
00137         return m_vCoordinates;
00138 }

int Vertex::getIndex  ) 
 

Get the index.

Returns the index of the Vertex.

Returns:
The index

Definition at line 272 of file Vertex.cpp.

Referenced by pcggui::Render(), and model::Model::save().

00272                      {
00273         return m_index;
00274 }

IvVector3 * Vertex::getNormal  ) 
 

Get normal.

Returns the normal of the Vertex.

Returns:
A vector containing the normal of the Vertex.

Definition at line 148 of file Vertex.cpp.

Referenced by pcggui::Render(), and model::Model::save().

00148                              {
00149         return m_vNormal;
00150 }

bool Vertex::operator!= const Vertex other  )  const
 

Comparition operator.

Compare two Vertexs to see if they are not equal.

Parameters:
other A other Vertex
Returns:
Returns true if the two Vertexs is not equal.

Definition at line 244 of file Vertex.cpp.

References m_vCoordinates, and m_vNormal.

00245 {
00246         if(other.m_vCoordinates == m_vCoordinates && other.m_vNormal == m_vNormal) {
00247                 return false;
00248         }
00249         return true;
00250 }  

Vertex & Vertex::operator= const Vertex other  ) 
 

Copy assignmed.

Copying all the variables to the new Vertex.

Parameters:
other A other Vertex

Definition at line 66 of file Vertex.cpp.

References m_vCoordinates, and m_vNormal.

00067 {
00068         // if same object
00069         if ( this == &other )
00070                 return *this;
00071 
00072         m_vCoordinates = other.m_vCoordinates;
00073         m_vNormal = other.m_vNormal;
00074 
00075         return *this;
00076 }  

bool Vertex::operator== const Vertex other  )  const
 

Comparition operator.

Compare two Vertexs to see if thay are equal.

Parameters:
other A other Vertex
Returns:
Returns true if the two Vertexs is equal.

Definition at line 225 of file Vertex.cpp.

References m_vCoordinates, and m_vNormal.

00226 {
00227         if(other.m_vCoordinates == m_vCoordinates && other.m_vNormal == m_vNormal) {
00228                 return true;
00229         }
00230         return false;  
00231 }   

void Vertex::rotate float  fAngleX,
float  fAngleY,
float  fAngleZ
 

Rotate the Vertex.

Changes the normal of the vertex giving 3 angles.

Parameters:
fAngleX The rotation around the x-axis.
fAngleY The rotation around the y-axis.
fAngleZ The rotation around the z-axis.

Definition at line 208 of file Vertex.cpp.

References m_vNormal.

00208                                                                {
00209         IvMatrix33 euler = IvMatrix33();
00210         euler.Rotation(fAngleZ, fAngleY, fAngleX);
00211         m_vNormal = &(*m_vNormal * euler);
00212 }

void Vertex::setCoordinates float  fX,
float  fY,
float  fZ
 

Sets the coordinates.

Sets the coordinates of the Vertex giving 3 floats.

Parameters:
fX The X coordinate
fY The Y coordiante
fZ The Z coordinate

Definition at line 92 of file Vertex.cpp.

References m_vCoordinates.

00092                                                         {
00093         m_vCoordinates = new IvVector3(fX,fY,fZ);
00094 }

void Vertex::setCoordinates IvVector3 *  vCoordinates  ) 
 

Set coordinates.

Sets the coordnates of the Vertex giving a vector.

Parameters:
vCoordinates The vector with the coordinates of the Vertex.

Definition at line 104 of file Vertex.cpp.

References m_vCoordinates.

Referenced by pcggui::CovertScene(), model::Model::load(), and Vertex().

00104                                                    {
00105         m_vCoordinates = vCoordinates;
00106 }

void Vertex::setIndex int  index  ) 
 

Sets the index.

Sets the index of the Vertex giving a int.

Parameters:
index The new index

Definition at line 260 of file Vertex.cpp.

References m_index.

Referenced by model::Model::addVertex().

00260                                {
00261         m_index = index;
00262 }

void Vertex::setNormal float  fX,
float  fY,
float  fZ
 

Sets the normal.

Sets the normal of the Vertex giving 3 floats.

Parameters:
fX The X element of the normal.
fY The Y element of the normal.
fZ The Z element of the normal.

Definition at line 178 of file Vertex.cpp.

References m_vNormal.

00178                                                    {
00179         m_vNormal = new IvVector3(fX,fY,fZ);
00180 }

void Vertex::setNormal IvVector3 *  vNormal  ) 
 

Sets the normal.

Sets the normal of the Vertex giving a vector.

Parameters:
vNormal A vector with the new normal

Definition at line 160 of file Vertex.cpp.

References m_vNormal.

Referenced by pcggui::CovertScene(), model::Model::load(), functions::Importer::readAttributes(), and pcggui::Render().

00160                                          {
00161         m_vNormal = vNormal;
00162 }

void Vertex::translate IvVector3 *  vTargetpos  ) 
 

Translates the Vertex.

Giving a vector the Vertex is translated as denoted by the vector.

Parameters:
vTargetpos The vector that are translated with.

Definition at line 190 of file Vertex.cpp.

References m_vCoordinates.

00190                                             {
00191         m_vCoordinates=&(*m_vCoordinates + *vTargetpos);
00192 }

void Vertex::updateCoordinates float  fX,
float  fY,
float  fZ
 

Sets the coordinates.

Sets the coordinates of the Vertex giving 3 floats.

Parameters:
fX The X coordinate
fY The Y coordiante
fZ The Z coordinate

Definition at line 122 of file Vertex.cpp.

References m_vCoordinates.

Referenced by model::Model::updateVertices().

00122                                                            {
00123         m_vCoordinates->x = fX;
00124         m_vCoordinates->y = fY;
00125         m_vCoordinates->z = fZ;
00126 }


Member Data Documentation

int model::Vertex::m_index [private]
 

Definition at line 27 of file Vertex.h.

Referenced by setIndex(), and Vertex().

IvVector3* model::Vertex::m_vCoordinates [private]
 

Vector holding the coordinates of the vertex.

Definition at line 25 of file Vertex.h.

Referenced by operator!=(), operator=(), operator==(), setCoordinates(), translate(), and updateCoordinates().

IvVector3* model::Vertex::m_vNormal [private]
 

Definition at line 26 of file Vertex.h.

Referenced by operator!=(), operator=(), operator==(), rotate(), and setNormal().


The documentation for this class was generated from the following files:
Generated on Tue Apr 17 09:40:08 2007 for PCG Library by  doxygen 1.3.9.1