# FacetMeshAccumulator Class Reference
[Data Structures]

Inheritance diagram for FacetMeshAccumulator:

List of all members.

## Classes
struct | VertexPlusIndex
## Public Member Functions
| FacetMeshAccumulator ()
| ~FacetMeshAccumulator ()
void | AccumulateFacet (const TFacet3D *aF)
void | PrepareAccumulation (uint32 estimatedFacetsCount)
MCErr | CalculateNormals (real smoothAngle)
void | MakeFacetMesh (FacetMesh **outMesh)
void | Reset ()
uint32 | GetAccumulatedFacetsCount ()
void | SetDynamicBuild (uint32 estimatedFacetsCount)
int32 | GetFinalFacetCount () const
int32 | GetFinalVertexCount () const
TMCArray< TFacet3D > & | GetFacetsArray ()
## Protected Member Functions
const TMCArray< VertexPlusIndex > & | GetVertices () const
const TMCArray< IndexedFacet > & | GetFacets () const
TVertex3D * | VertexAt (int32 index)
void | BuildUsingHash (const TMCArray< TFacet3D > *facets, const TMCArray< TFacet3D > *facets2=nil)
int32 | AddVertex (const TVertex3D &avertex)
int32 | HashVertex (const TVertex3D &avertex)
void | AddFacet (const TFacet3D &afacet)
## Protected Attributes
boolean | fDynamicBuild
TMCArray< VertexPlusIndex > | fVertices
TMCArray< IndexedFacet > | fFacets
TMCArray< int32 > | fHashTable
int32 | fHashTableSize
int16 | fHashPower
TMCArray< TFacet3D > | fOrigFacets
## Friends
class | IndexedFacetIterator

## Detailed Description

A Facet Mesh Accumulator turns a set of disconnected triangles (triangle soup) into an indexed facetMesh. It merge vertices that are located at the same position that have the same normals and texture coordinates.

Note that if you already have connection information it might be more efficient to build the FacetMesh directly without going through the accumulator.

The typical way to use the accumulator is:

     FacetMeshAccumulator accumulator;

     for (all triangles)
     {
        accumulator.AccumulateFacet(triangle);
     }
     TMCCountedPtr<FacetMesh> facetMesh;
     accumulator.MakeFacetMesh(&facetMesh);

## Constructor & Destructor Documentation

FacetMeshAccumulator::FacetMeshAccumulator | ( |  | ) |

FacetMeshAccumulator::~FacetMeshAccumulator | ( |  | ) |

## Member Function Documentation

void FacetMeshAccumulator::AccumulateFacet | ( | const TFacet3D * | aF | ) |

Adds one triangle to the accumulator.

void FacetMeshAccumulator::AddFacet | ( | const TFacet3D & | afacet | ) | `[protected]`

int32 FacetMeshAccumulator::AddVertex | ( | const TVertex3D & | avertex | ) | `[protected]`

void FacetMeshAccumulator::BuildUsingHash | ( | const TMCArray< TFacet3D > * | facets,
|  | const TMCArray< TFacet3D > * | facets2 = `nil` |
| ) |  |  | `[protected]`

MCErr FacetMeshAccumulator::CalculateNormals | ( | real | smoothAngle | ) |

Computes the normals of the facets and does smoothing if abs(smoothAngle) > 1E-5 Call this after accumulating the facets and before MakeFacetMesh.

uint32 FacetMeshAccumulator::GetAccumulatedFacetsCount | ( |  | ) | `[inline]`

Returns the number of triangles that were accumulated.

const TMCArray<IndexedFacet>& FacetMeshAccumulator::GetFacets | ( |  | ) | const`[inline, protected]`

TMCArray<TFacet3D>& FacetMeshAccumulator::GetFacetsArray | ( |  | ) | `[inline]`

int32 FacetMeshAccumulator::GetFinalFacetCount | ( |  | ) | const

int32 FacetMeshAccumulator::GetFinalVertexCount | ( |  | ) | const

const TMCArray<VertexPlusIndex>& FacetMeshAccumulator::GetVertices | ( |  | ) | const`[inline, protected]`

int32 FacetMeshAccumulator::HashVertex | ( | const TVertex3D & | avertex | ) | `[protected]`

void FacetMeshAccumulator::MakeFacetMesh | ( | FacetMesh ** | outMesh | ) |

Generates the actual facet Mesh.

void FacetMeshAccumulator::PrepareAccumulation | ( | uint32 | estimatedFacetsCount | ) |

Call this before accumulating facets to preallocate memory for them if you know how many triangles will be added.

void FacetMeshAccumulator::Reset | ( |  | ) |

Reset

void FacetMeshAccumulator::SetDynamicBuild | ( | uint32 | estimatedFacetsCount | ) |

Set the build mode to dynamic (mesh build during facet accumulation)

TVertex3D* FacetMeshAccumulator::VertexAt | ( | int32 | index | ) | `[inline, protected]`

## Friends And Related Function Documentation

friend class IndexedFacetIterator`[friend]`

## Member Data Documentation

boolean FacetMeshAccumulator::fDynamicBuild`[protected]`

TMCArray<IndexedFacet> FacetMeshAccumulator::fFacets`[protected]`

int16 FacetMeshAccumulator::fHashPower`[protected]`

TMCArray<int32> FacetMeshAccumulator::fHashTable`[protected]`

int32 FacetMeshAccumulator::fHashTableSize`[protected]`

TMCArray<TFacet3D> FacetMeshAccumulator::fOrigFacets`[protected]`

TMCArray<VertexPlusIndex> FacetMeshAccumulator::fVertices`[protected]`

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

- PublicUtilities.h