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

MCMesh::MCTriangle Class Reference

A single triangle in the mesh. More...

Collaboration diagram for MCMesh::MCTriangle:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 MCTriangle (int type)
 Default constructor.
virtual ~MCTriangle ()
 Destructor.
int AddVertex (MCVertex *v)
 Adds the vertex v to its list of member vertices.
MCVertexGetVertex (int n)
 Returns the n -th vertex in the triangle.
vuVector GetNormal ()
 Calculates the normal for the n-th vertex in the triangle.
bool Complete ()
 Indication the completion of the triangle.
MCMesh::index_t GetVertexIdx (int v)
int Type ()
 Returns the type of this triangle.

Private Attributes

int _type
 Indicates the type of cube the triangle belongs to.
MCVertex_vertices [3]
 The member vertices of the triangle.
unsigned short _vertCnt
 Fill level of the _vertices array.
std::list< MCTriangle * > _neighbours
 A list of all neighbours.

Detailed Description

A single triangle in the mesh.

Definition at line 289 of file MarchingCubesData.h.


Constructor & Destructor Documentation

MCMesh::MCTriangle::MCTriangle int  type  ) 
 

Default constructor.

Definition at line 108 of file MarchingCubesData.cpp.

References _vertices, and DEBUGC.

MCMesh::MCTriangle::~MCTriangle  )  [virtual]
 

Destructor.

Definition at line 116 of file MarchingCubesData.cpp.

References DEBUGD.


Member Function Documentation

int MCMesh::MCTriangle::AddVertex MCVertex v  ) 
 

Adds the vertex v to its list of member vertices.

If this list is already complete, the function returns -1. If the addition was successfull the function returns the index of the vertex in the member list (i.e. 0-2).

Attention:
The neighbourhood information will only be written when all vertices are added to the triangle. In other words in an incomplete triangle there is on neighbourhood informations for this triangle.
Parameters:
v The vertex to add to the triangle.
Returns:
If the vertex could be added, the index in the internal list and otherwise -1 is returned.

Definition at line 121 of file MarchingCubesData.cpp.

References _vertCnt, _vertices, MCMesh::MCVertex::AddNeigbour(), and DEBUG0.

Here is the call graph for this function:

bool MCMesh::MCTriangle::Complete  ) 
 

Indication the completion of the triangle.

Definition at line 158 of file MarchingCubesData.cpp.

References _vertCnt, and DEBUG0.

Referenced by GetNormal().

vuVector MCMesh::MCTriangle::GetNormal  ) 
 

Calculates the normal for the n-th vertex in the triangle.

Definition at line 147 of file MarchingCubesData.cpp.

References _vertices, assert, Complete(), vuVector::cross, DEBUG0, vuVector::makeUnit(), and MCMesh::MCVertex::Vertex().

Here is the call graph for this function:

MCMesh::MCVertex * MCMesh::MCTriangle::GetVertex int  n  ) 
 

Returns the n -th vertex in the triangle.

Definition at line 139 of file MarchingCubesData.cpp.

References _vertices, assert, and DEBUG0.

MCMesh::index_t MCMesh::MCTriangle::GetVertexIdx int  v  ) 
 

Definition at line 164 of file MarchingCubesData.cpp.

References _vertices, assert, DEBUG0, MCMesh::MCVertex::Idx(), and MCMesh::index_t.

Here is the call graph for this function:

int MCMesh::MCTriangle::Type  ) 
 

Returns the type of this triangle.

Definition at line 172 of file MarchingCubesData.cpp.

References DEBUG0.


Member Data Documentation

std::list<MCTriangle *> MCMesh::MCTriangle::_neighbours [private]
 

A list of all neighbours.

The neighbours need not be accessed directly but sequentially, this is why I use STLs single linked list.

Definition at line 316 of file MarchingCubesData.h.

int MCMesh::MCTriangle::_type [private]
 

Indicates the type of cube the triangle belongs to.

Definition at line 297 of file MarchingCubesData.h.

unsigned short MCMesh::MCTriangle::_vertCnt [private]
 

Fill level of the _vertices array.

This counter will also be used by the Complete function.

Definition at line 310 of file MarchingCubesData.h.

Referenced by AddVertex(), and Complete().

MCVertex* MCMesh::MCTriangle::_vertices[3] [private]
 

The member vertices of the triangle.

A triangle has only 3 vertices, therefore a fixed size array is the best choice. The elements in the array must not be destroyed, because they are only references.

Definition at line 305 of file MarchingCubesData.h.

Referenced by AddVertex(), GetNormal(), GetVertex(), GetVertexIdx(), and MCTriangle().


The documentation for this class was generated from the following files:
Generated on Wed Dec 15 21:20:58 2004 for vuVolume by  doxygen 1.3.9.1