Skip to content

Commit

Permalink
fix(Manifoldness): avoid exception on bad input surfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
panquez committed Dec 12, 2023
1 parent 679502e commit dedbf3d
Showing 1 changed file with 43 additions and 20 deletions.
63 changes: 43 additions & 20 deletions src/geode/inspector/criterion/manifold/surface_vertex_manifold.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,18 @@ namespace geode
polygons_around_vertices( mesh_ );
for( const auto vertex_id : geode::Range{ mesh_.nb_vertices() } )
{
if( !polygons_around_vertex_are_the_same(
polygons_around_vertices_list[vertex_id],
mesh_.polygons_around_vertex( vertex_id ) ) )
try
{
return false;
if( !polygons_around_vertex_are_the_same(
polygons_around_vertices_list[vertex_id],
mesh_.polygons_around_vertex( vertex_id ) ) )
{
return false;
}
}
catch( const geode::OpenGeodeException& e )
{
continue;
}
}
return true;
Expand All @@ -106,17 +113,25 @@ namespace geode
index_t nb_non_manifold_vertices{ 0 };
for( const auto vertex_id : geode::Range{ mesh_.nb_vertices() } )
{
if( !polygons_around_vertex_are_the_same(
polygons_around_vertices_list[vertex_id],
mesh_.polygons_around_vertex( vertex_id ) ) )
try
{
if( verbose_ )
if( !polygons_around_vertex_are_the_same(
polygons_around_vertices_list[vertex_id],
mesh_.polygons_around_vertex( vertex_id ) ) )
{
geode::Logger::info( "Vertex with index ", vertex_id,
", at position ", mesh_.point( vertex_id ).string(),
", is not manifold." );
if( verbose_ )
{
geode::Logger::info( "Vertex with index ",
vertex_id, ", at position ",
mesh_.point( vertex_id ).string(),
", is not manifold." );
}
nb_non_manifold_vertices++;
}
nb_non_manifold_vertices++;
}
catch( const geode::OpenGeodeException& e )
{
continue;
}
}
return nb_non_manifold_vertices;
Expand All @@ -129,17 +144,25 @@ namespace geode
std::vector< geode::index_t > non_manifold_vertices;
for( const auto vertex_id : geode::Range{ mesh_.nb_vertices() } )
{
if( !polygons_around_vertex_are_the_same(
polygons_around_vertices_list[vertex_id],
mesh_.polygons_around_vertex( vertex_id ) ) )
try
{
if( verbose_ )
if( !polygons_around_vertex_are_the_same(
polygons_around_vertices_list[vertex_id],
mesh_.polygons_around_vertex( vertex_id ) ) )
{
geode::Logger::info( "Vertex with index ", vertex_id,
", at position ", mesh_.point( vertex_id ).string(),
", is not manifold." );
if( verbose_ )
{
geode::Logger::info( "Vertex with index ",
vertex_id, ", at position ",
mesh_.point( vertex_id ).string(),
", is not manifold." );
}
non_manifold_vertices.push_back( vertex_id );
}
non_manifold_vertices.push_back( vertex_id );
}
catch( const geode::OpenGeodeException& e )
{
continue;
}
}
return non_manifold_vertices;
Expand Down

0 comments on commit dedbf3d

Please sign in to comment.