Skip to content

Commit 21c8e7d

Browse files
committed
fix(SurfaceComponentMeshEdges): assure that component edges does not return surface edges with identical unique vertices
1 parent 9b92db1 commit 21c8e7d

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

src/geode/model/helpers/component_mesh_edges.cpp

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,31 @@ namespace geode
161161
const auto& mesh = surface.mesh();
162162
for( const auto& pair : surface_pair.second )
163163
{
164-
for( auto& polygon_vertex :
165-
mesh.polygons_from_edge_vertices( pair ) )
164+
if( auto edge = mesh.polygon_edge_from_vertices(
165+
pair[0], pair[1] ) )
166+
167+
{
168+
edges[surface.id()].emplace_back(
169+
std::move( edge.value() ) );
170+
if( auto adj =
171+
mesh.polygon_adjacent_edge( edge.value() ) )
172+
{
173+
edges[surface.id()].emplace_back(
174+
std::move( adj.value() ) );
175+
}
176+
continue;
177+
}
178+
if( auto edge = mesh.polygon_edge_from_vertices(
179+
pair[1], pair[0] ) )
166180
{
167181
edges[surface.id()].emplace_back(
168-
std::move( polygon_vertex ) );
182+
std::move( edge.value() ) );
183+
if( auto adj =
184+
mesh.polygon_adjacent_edge( edge.value() ) )
185+
{
186+
edges[surface.id()].emplace_back(
187+
std::move( adj.value() ) );
188+
}
169189
}
170190
}
171191
}

0 commit comments

Comments
 (0)