Skip to content

Commit 3b764df

Browse files
Merge pull request #121 from Geode-solutions/fix/brep-adj-no-id
fix(BRepAdjacency): handle vertex not linked to unique vertex
2 parents 8ff5b8a + 93d9353 commit 3b764df

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

src/geode/inspector/criterion/adjacency/brep_meshes_adjacency.cpp

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,16 @@ namespace geode
9090
{
9191
const PolyhedronFacet polyhedron_facet{ polyhedron_id,
9292
facet_id };
93-
if( mesh.is_polyhedron_facet_on_border(
94-
polyhedron_facet )
95-
&& !polyhedron_facet_is_on_a_surface(
96-
block, polyhedron_facet ) )
93+
if( !mesh.is_polyhedron_facet_on_border(
94+
polyhedron_facet ) )
95+
{
96+
continue;
97+
}
98+
const auto is_on_surface =
99+
polyhedron_facet_is_on_a_surface(
100+
block, polyhedron_facet );
101+
if( is_on_surface.has_value()
102+
&& !is_on_surface.value() )
97103
{
98104
wrong_adjacencies.add_issue( polyhedron_facet,
99105
absl::StrCat( "Local facet ", facet_id,
@@ -109,11 +115,16 @@ namespace geode
109115
}
110116

111117
private:
112-
bool polyhedron_facet_is_on_a_surface( const Block3D& block,
118+
absl::optional< bool > polyhedron_facet_is_on_a_surface(
119+
const Block3D& block,
113120
const PolyhedronFacet& polyhedron_facet ) const
114121
{
115122
const auto facet_unique_vertices =
116123
polygon_unique_vertices( model(), block, polyhedron_facet );
124+
if( absl::c_contains( facet_unique_vertices, geode::NO_ID ) )
125+
{
126+
return std::nullopt;
127+
}
117128
return !detail::surface_component_mesh_polygons(
118129
model(), facet_unique_vertices )
119130
.empty();

0 commit comments

Comments
 (0)