Skip to content

Commit

Permalink
fix(BRep): remove non manifold edge test on model surfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
BotellaA committed Oct 3, 2024
1 parent 8a23178 commit 8316f65
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 93 deletions.
89 changes: 0 additions & 89 deletions src/geode/inspector/criterion/manifold/brep_meshes_manifold.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,56 +42,6 @@
#include <geode/inspector/criterion/manifold/solid_facet_manifold.hpp>
#include <geode/inspector/criterion/manifold/solid_vertex_manifold.hpp>

namespace
{
bool is_vertex_on_free_border( const geode::Surface3D& surface,
geode::index_t vertex,
const geode::BRep& model )
{
const auto unique_vertex =
model.unique_vertex( { surface.component_id(), vertex } );
for( const auto& cmv : model.component_mesh_vertices( unique_vertex ) )
{
if( cmv.component_id.type()
!= geode::Line3D::component_type_static() )
{
continue;
}
if( !model.relation_index( cmv.component_id.id(), surface.id() )
.has_value() )
{
continue;
}
if( model.is_internal(
model.line( cmv.component_id.id() ), surface ) )
{
continue;
}
if( model.nb_incidences( cmv.component_id.id() ) > 1 )
{
continue;
}
return true;
}
return false;
}

std::vector< bool > vertices_on_free_border(
const geode::Surface3D& surface,
const geode::SurfaceMesh3D& surface_mesh,
const geode::BRep& model )
{
std::vector< bool > is_on_free_border(
surface_mesh.nb_vertices(), false );
for( const auto vertex : geode::Range{ surface_mesh.nb_vertices() } )
{
is_on_free_border[vertex] =
is_vertex_on_free_border( surface, vertex, model );
}
return is_on_free_border;
}
} // namespace

namespace geode
{
std::string BRepMeshesManifoldInspectionResult::string() const
Expand Down Expand Up @@ -241,44 +191,6 @@ namespace geode
message );
continue;
}
const auto& surface = model().surface( edge.second[0] );
const auto& mesh = surface.mesh();
const auto is_on_free_border =
vertices_on_free_border( surface, mesh, model() );
geode::index_t first_edge_vertex;
geode::index_t second_edge_vertex;
for( const auto& cmv : model().component_mesh_vertices(
edge.first.vertices()[0] ) )
{
if( cmv.component_id.id() == surface.id() )
{
first_edge_vertex = cmv.vertex;
break;
}
}
for( const auto& cmv : model().component_mesh_vertices(
edge.first.vertices()[1] ) )
{
if( cmv.component_id.id() == surface.id() )
{
second_edge_vertex = cmv.vertex;
break;
}
}
if( !is_on_free_border[first_edge_vertex]
|| !is_on_free_border[second_edge_vertex] )
{
continue;
}
std::string message = absl::StrCat(
"Model edge between unique vertices ",
edge.first.vertices()[0], " and ", edge.first.vertices()[1],
" is not manifold: it has 2 point on the free border "
"without being on the border of surface " );
absl::StrAppend( &message, edge.second[0].string(), ", " );
issues.add_issue(
BRepNonManifoldEdge{ edge.first.vertices(), edge.second },
message );
}
for( const auto& line : model().lines() )
{
Expand Down Expand Up @@ -349,5 +261,4 @@ namespace geode
impl_->add_model_non_manifold_facets( result.brep_non_manifold_facets );
return result;
}

} // namespace geode
8 changes: 4 additions & 4 deletions tests/inspector/test-brep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,9 @@ void check_model_a1( bool string )

const auto nb_component_meshes_issues =
launch_component_meshes_validity_checks( result.meshes, string );
OPENGEODE_EXCEPTION( nb_component_meshes_issues == 13503,
OPENGEODE_EXCEPTION( nb_component_meshes_issues == 13494,
"[Test] model_A1 has ", nb_component_meshes_issues,
" meshes problems instead of 13503." );
" meshes problems instead of 13494." );
}

void check_model_a1_valid( bool string )
Expand All @@ -340,9 +340,9 @@ void check_model_a1_valid( bool string )

const auto nb_component_meshes_issues =
launch_component_meshes_validity_checks( result.meshes, string );
OPENGEODE_EXCEPTION( nb_component_meshes_issues == 13503,
OPENGEODE_EXCEPTION( nb_component_meshes_issues == 13494,
"[Test] model_A1_valid has ", nb_component_meshes_issues,
" meshes problems instead of 13503." );
" meshes problems instead of 13494." );
}

void check_model_mss( bool string )
Expand Down

0 comments on commit 8316f65

Please sign in to comment.