From 21c8e7d4234d3ba722eefbcfbaf1148c316f8e61 Mon Sep 17 00:00:00 2001 From: BenPinet Date: Mon, 29 Apr 2024 17:22:24 +0200 Subject: [PATCH 1/4] fix(SurfaceComponentMeshEdges): assure that component edges does not return surface edges with identical unique vertices --- .../model/helpers/component_mesh_edges.cpp | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/geode/model/helpers/component_mesh_edges.cpp b/src/geode/model/helpers/component_mesh_edges.cpp index f91a60574..fabc7fdff 100644 --- a/src/geode/model/helpers/component_mesh_edges.cpp +++ b/src/geode/model/helpers/component_mesh_edges.cpp @@ -161,11 +161,31 @@ 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() ) ); + if( auto adj = + mesh.polygon_adjacent_edge( edge.value() ) ) + { + edges[surface.id()].emplace_back( + std::move( adj.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() ) ); + if( auto adj = + mesh.polygon_adjacent_edge( edge.value() ) ) + { + edges[surface.id()].emplace_back( + std::move( adj.value() ) ); + } } } } From 92f0d2a8fd7b69acd33f406ef7d76db3147e277c Mon Sep 17 00:00:00 2001 From: BenPinet Date: Tue, 30 Apr 2024 09:18:20 +0200 Subject: [PATCH 2/4] Remove the adjacency if blocks --- src/geode/model/helpers/component_mesh_edges.cpp | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/geode/model/helpers/component_mesh_edges.cpp b/src/geode/model/helpers/component_mesh_edges.cpp index fabc7fdff..3dbb90957 100644 --- a/src/geode/model/helpers/component_mesh_edges.cpp +++ b/src/geode/model/helpers/component_mesh_edges.cpp @@ -167,12 +167,6 @@ namespace geode { edges[surface.id()].emplace_back( std::move( edge.value() ) ); - if( auto adj = - mesh.polygon_adjacent_edge( edge.value() ) ) - { - edges[surface.id()].emplace_back( - std::move( adj.value() ) ); - } continue; } if( auto edge = mesh.polygon_edge_from_vertices( @@ -180,12 +174,6 @@ namespace geode { edges[surface.id()].emplace_back( std::move( edge.value() ) ); - if( auto adj = - mesh.polygon_adjacent_edge( edge.value() ) ) - { - edges[surface.id()].emplace_back( - std::move( adj.value() ) ); - } } } } From 0016419f01195b018a3525f75bbc6bee9b3d128c Mon Sep 17 00:00:00 2001 From: BenPinet Date: Wed, 29 May 2024 16:16:05 +0200 Subject: [PATCH 3/4] remove adjeacencies along internal lines on both polygon edge --- .../detail/split_along_surface_mesh_borders.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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..bd8d69181 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,19 @@ 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() ); + edges.emplace_back( + surface_mesh + .polygon_edge_from_vertices( + edge_vertices[1], edge_vertices[0] ) + .value() ); } } } From 4cabaddede1aec1c4c6bca8b4d273411f1d67f44 Mon Sep 17 00:00:00 2001 From: BenPinet Date: Wed, 29 May 2024 16:28:12 +0200 Subject: [PATCH 4/4] verify if second polygon edge exists --- .../detail/split_along_surface_mesh_borders.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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 bd8d69181..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 @@ -227,11 +227,17 @@ namespace geode .polygon_edge_from_vertices( edge_vertices[0], edge_vertices[1] ) .value() ); - edges.emplace_back( - surface_mesh + if( surface_mesh .polygon_edge_from_vertices( edge_vertices[1], edge_vertices[0] ) - .value() ); + .has_value() ) + { + edges.emplace_back( + surface_mesh + .polygon_edge_from_vertices( + edge_vertices[1], edge_vertices[0] ) + .value() ); + } } } }