diff --git a/src/geode/model/helpers/component_mesh_edges.cpp b/src/geode/model/helpers/component_mesh_edges.cpp index f91a60574..3dbb90957 100644 --- a/src/geode/model/helpers/component_mesh_edges.cpp +++ b/src/geode/model/helpers/component_mesh_edges.cpp @@ -161,11 +161,19 @@ namespace geode const auto& mesh = surface.mesh(); for( const auto& pair : surface_pair.second ) { - for( auto& polygon_vertex : - mesh.polygons_from_edge_vertices( pair ) ) + if( auto edge = mesh.polygon_edge_from_vertices( + pair[0], pair[1] ) ) + + { + edges[surface.id()].emplace_back( + std::move( edge.value() ) ); + continue; + } + if( auto edge = mesh.polygon_edge_from_vertices( + pair[1], pair[0] ) ) { edges[surface.id()].emplace_back( - std::move( polygon_vertex ) ); + std::move( edge.value() ) ); } } } diff --git a/src/geode/model/helpers/detail/split_along_surface_mesh_borders.cpp b/src/geode/model/helpers/detail/split_along_surface_mesh_borders.cpp index eb05be8d9..cf19357ae 100644 --- a/src/geode/model/helpers/detail/split_along_surface_mesh_borders.cpp +++ b/src/geode/model/helpers/detail/split_along_surface_mesh_borders.cpp @@ -219,7 +219,25 @@ namespace geode } for( auto& edge : it->second ) { - edges.emplace_back( std::move( edge ) ); + const auto& surface_mesh = surface.mesh(); + const auto& edge_vertices = + surface_mesh.polygon_edge_vertices( edge ); + edges.emplace_back( + surface_mesh + .polygon_edge_from_vertices( + edge_vertices[0], edge_vertices[1] ) + .value() ); + if( surface_mesh + .polygon_edge_from_vertices( + edge_vertices[1], edge_vertices[0] ) + .has_value() ) + { + edges.emplace_back( + surface_mesh + .polygon_edge_from_vertices( + edge_vertices[1], edge_vertices[0] ) + .value() ); + } } } }