VertexStorage< T > Class Template Reference

Defines a class to store Vertex information. More...

#include <VertexStorage.h>

List of all members.

Public Member Functions

bool appendVertex (T vertex)
bool appendVertexIndices (int idx1, int idx2, int idx3)
bool appendVertexWithIndices (T vertex, int idx1, int idx2, int idx3)
int getIndexCount ()
int getVertexCount ()
 VertexStorage (int maxVertexCount, int maxIndexCount)
 ~VertexStorage ()

Public Attributes

int * indices
const int MAX_INDEX_COUNT
const int MAX_VERTEX_COUNT
T * vertices

Private Attributes

int nextIndex
int nextVertex


Detailed Description

template<typename T>
class VertexStorage< T >

Defines a class to store Vertex information.

This class is used to translate OpenInventor triangle models into ODE triangles.

Template Parameters:
T type of the vertices to be stored

Definition at line 73 of file VertexStorage.h.


Constructor & Destructor Documentation

template<typename T >
VertexStorage< T >::VertexStorage ( int  maxVertexCount,
int  maxIndexCount 
) [inline]

Initialise the class with the number of verticis and indices it is going to hold. Additionally an array of size maxVertexCount and type T and an array of size maxIndexCount and type int are created.

Template Parameters:
T type of the vertices to be stored
Parameters:
maxVertexCount maximal number of vertices the class is going to hold.
maxIndexCount maximal number of indicees the class is going to hold.

Definition at line 104 of file VertexStorage.h.

References VertexStorage< T >::indices, and VertexStorage< T >::vertices.

template<typename T >
VertexStorage< T >::~VertexStorage (  )  [inline]

Delete both vertex and index array and their contents if they aren't NULL.

Definition at line 118 of file VertexStorage.h.

References VertexStorage< T >::indices, VertexStorage< T >::MAX_VERTEX_COUNT, and VertexStorage< T >::vertices.


Member Function Documentation

template<typename T >
bool VertexStorage< T >::appendVertex ( vertex  )  [inline]

Append a vertex after the last inserted vertex. Increments nextVertex by one.

Parameters:
vertex the vertex to append to VertexStorage::vertices.
Returns:
true if vertex was added.

false if VertexStorage::vertices is full.

Definition at line 139 of file VertexStorage.h.

References VertexStorage< T >::MAX_VERTEX_COUNT, VertexStorage< T >::nextVertex, and VertexStorage< T >::vertices.

Referenced by VertexStorage< T >::appendVertexWithIndices(), and TriangleExtractor::getResult().

template<typename T >
bool VertexStorage< T >::appendVertexIndices ( int  idx1,
int  idx2,
int  idx3 
) [inline]

Append the index numbers for the last inserted vertex. VertexStorage<T>::appendVertex() should be called before or you must be sure that the added indices match the vertices in the vertex array.

Parameters:
idx1 first index of vertex
idx2 second index of vertex
idx3 third index of vertex
Returns:
true if indices were added correctly

false if the indices couldn't be inserted (VertexStorage::indices is full)

Definition at line 163 of file VertexStorage.h.

References VertexStorage< T >::indices, VertexStorage< T >::MAX_INDEX_COUNT, and VertexStorage< T >::nextIndex.

Referenced by VertexStorage< T >::appendVertexWithIndices(), and TriangleExtractor::getResult().

template<typename T >
bool VertexStorage< T >::appendVertexWithIndices ( vertex,
int  idx1,
int  idx2,
int  idx3 
) [inline]

Insert a vertex and the according indices.
Calls VertexStorage::appendVertex() and afterwards VertexStorage::appendVertexIndices(). If the indices could not be inserted the vertex gets "deleted" from VertexStorage::vertices by decrementing VertexStorage::nextVertex.

Parameters:
vertex the vertex to append
idx1 first index of vertex
idx2 second index of vertex
idx3 third index of vertex
Returns:
false if an error happened

true if everything went fine.

Definition at line 188 of file VertexStorage.h.

References VertexStorage< T >::appendVertex(), VertexStorage< T >::appendVertexIndices(), and VertexStorage< T >::nextVertex.

template<typename T>
VertexStorage< T >::getIndexCount (  ) 

Returns:
the number of currently stored indices

template<typename T>
VertexStorage< T >::getVertexCount (  ) 

Returns:
the number of currently stored vertices


Member Data Documentation

template<typename T>
VertexStorage< T >::indices

template<typename T>
VertexStorage< T >::MAX_INDEX_COUNT

Maximum number of indices which can be stored by VertexStorage.

Warning:
This value is currently unrelated to VertexStorage::MAX_VERTEX_COUNT and should be be 3 times the value of VertexStorage::MAX_VERTEX_COUNT.

Definition at line 84 of file VertexStorage.h.

Referenced by VertexStorage< T >::appendVertexIndices(), and SoCollisionShapeTriMesh::cGeom().

template<typename T>
VertexStorage< T >::MAX_VERTEX_COUNT

Maximum number of vertices which can be stored by VertexStorage.

Definition at line 83 of file VertexStorage.h.

Referenced by VertexStorage< T >::appendVertex(), SoCollisionShapeTriMesh::cGeom(), and VertexStorage< T >::~VertexStorage().

template<typename T>
VertexStorage< T >::nextIndex [private]

The next free position in the index array (value is 0 upon creation).

Definition at line 89 of file VertexStorage.h.

Referenced by VertexStorage< T >::appendVertexIndices().

template<typename T>
VertexStorage< T >::nextVertex [private]

The index of the next free position in the vertex array (value is 0 upon creation).

Definition at line 88 of file VertexStorage.h.

Referenced by VertexStorage< T >::appendVertex(), and VertexStorage< T >::appendVertexWithIndices().

template<typename T>
VertexStorage< T >::vertices


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

Get IPSA - Inventor Physics Simulation API at SourceForge.net. Fast, secure and Free Open Source software downloads
Generated on Sat Mar 10 20:00:21 2012 for IPSA by  doxygen 1.5.8