#include <stdio.h>
#include <stdlib.h>
#define MIN_HOLE_AREA 100.f
int main( int argc, char* argv[] )
{
int rc = EXIT_FAILURE;
if ( argc != 2 && argc != 3 )
{
fprintf( stderr, "Usage: %s INPUT [OUTPUT]", argv[0] );
goto out;
}
const char* input = argv[1];
const char* output = ( argc == 2 ) ? argv[1] : argv[2];
if ( errorString )
{
fprintf( stderr,
"Failed to load mesh: %s",
mrStringData( errorString ) );
goto out;
}
if ( holes->size == 0 )
{
printf( "Mesh doesn't have any holes" );
goto out_holes;
}
size_t newFaceCount = 0;
#define FILL_ALL_HOLES 1
#if FILL_ALL_HOLES
mrFillHoles( mesh, holes->data, holes->size, ¶ms );
#else
for ( int i = 0; i < mrEdgePathSize( holes ); i++ )
{
MREdgeId e = mrEdgePathData( holes )[i];
if ( mrVector3Length( &holeDirArea ) >= MIN_HOLE_AREA )
{
}
}
#endif
printf( "Added new %zu faces", newFaceCount );
if ( errorString )
{
fprintf( stderr,
"Failed to save mesh: %s",
mrStringData( errorString ) );
goto out_newFaces;
}
rc = EXIT_SUCCESS;
out_newFaces:
out_metric:
out_holes:
mrEdgePathFree( holes );
out_mesh:
out:
return rc;
}
MRMESHC_API size_t mrBitSetCount(const MRBitSet *bs)
returns the number of bits in this bitset that are set
MRMESHC_API void mrFaceBitSetFree(MRFaceBitSet *fbs)
deallocates a FaceBitSet object
MRMESHC_API MRFaceBitSet * mrFaceBitSetNew(size_t numBits, bool fillValue)
creates a new FaceBitSet object
MRMESHC_API void mrFillHole(MRMesh *mesh, MREdgeId a, const MRFillHoleParams *params)
Fills hole in mesh .
MRMESHC_API void mrFillHoles(MRMesh *mesh, const MREdgeId *as, size_t asNum, const MRFillHoleParams *params)
fill all holes given by their representative edges in
MRMESHC_API MRFillHoleParams mrFillHoleParamsNew(void)
struct MRMesh MRMesh
Definition MRMeshC/MRMeshFwd.h:43
struct MRFaceBitSet MRFaceBitSet
Definition MRMeshC/MRMeshFwd.h:37
typedefMR_EXTERN_C_BEGIN struct MRString MRString
Definition MRMeshC/MRMeshFwd.h:32
MRMESHC_API MRFillHoleMetric * mrGetUniversalMetric(const MRMesh *mesh)
MRMESHC_API void mrFillHoleMetricFree(MRFillHoleMetric *metric)
MRMESHC_API MRVector3f mrMeshHoleDirArea(const MRMesh *mesh, MREdgeId e)
MRMESHC_API MREdgePath * mrMeshFindHoleRepresentiveEdges(const MRMesh *mesh)
MRMESHC_API void mrMeshFree(MRMesh *mesh)
deallocates a Mesh object
MRMESHC_API void mrStringFree(MRString *str)
deallocates the string object
MR_EXTERN_C_BEGIN MRMESHC_API const char * mrStringData(const MRString *str)
gets read-only access to the string data
MRMESHC_API MRMesh * mrMeshLoadFromAnySupportedFormat(const char *file, MRString **errorStr)
MRMESHC_API void mrMeshSaveToAnySupportedFormat(const MRMesh *mesh, const char *file, MRString **errorStr)
edge index
Definition MRMeshC/MRId.h:8
Holds metrics for mrFillHole and mrBuildCylinderBetweenTwoHoles triangulation .
Parameters structure for mrFillHole Structure has some options to control mrFillHole.
Definition MRMeshC/MRMeshFillHole.h:23
MRFaceBitSet * outNewFaces
If not nullptr accumulate new faces.
Definition MRMeshC/MRMeshFillHole.h:31
const MRFillHoleMetric * metric
Definition MRMeshC/MRMeshFillHole.h:28
three-dimensional vector
Definition MRMeshC/MRVector3.h:9