This project has moved and is read-only. For the latest updates, please go here.
Generates the adjacency and/or point representatives for a mesh.

HRESULT GenerateAdjacencyAndPointReps(
   _In_reads_(nFaces*3) const uint16_t* indices, _In_ size_t nFaces,
   _In_reads_(nVerts) const XMFLOAT3* positions, _In_ size_t nVerts, 
   _In_ float epsilon,
   _Out_writes_opt_(nVerts) uint32_t* pointRep,
   _Out_writes_opt_(nFaces*3) uint32_t* adjacency );

HRESULT GenerateAdjacencyAndPointReps(
   _In_reads_(nFaces*3) const uint32_t* indices, _In_ size_t nFaces,
   _In_reads_(nVerts) const XMFLOAT3* positions, _In_ size_t nVerts, 
   _In_ float epsilon,
   _Out_writes_opt_(nVerts) uint32_t* pointRep,
   _Out_writes_opt_(nFaces*3) uint32_t* adjacency );

Parameters

epsilon: Threshold used when comparing positions for shared/duplicate positions. This value can be 0 for bit-wise identical vertex positions.

If pointRep is nullptr, it is still generated as part of the computation but is not returned to the caller.

If both pointRep and adjacency are nullptr, these functions return an error code.

Remarks

These functions assume the triangular mesh description is valid. See Mesh cleanup and validation

Example

std::unique_ptr<WaveFrontReader<uint16_t>> mesh( new WaveFrontReader<uint16_t>() );

if ( FAILED( mesh->Load( L"test.obj" ) ) )
   // Error

size_t nFaces = mesh->indices.size() / 3;
size_t nVerts = mesh->vertices.size();

std::unique_ptr<XMFLOAT3[]> pos( new XMFLOAT3[ nVerts ] );
for( size_t j = 0; j < nVerts; ++j )
   pos[ j ] = mesh->vertices[ j ].position;

std::unique_ptr<uint32_t[]> adj( new uint32_t[ mesh->indices.size() ] );
if ( FAILED ( GenerateAdjacencyAndPointReps(
   &mesh->indices.front(), nFaces,
   pos.get(), nVerts, 0.f, nullptr, adj.get() ) ) )
   // Error

Last edited Nov 20, 2014 at 7:57 PM by walbourn, version 8