From a9fa00f83e4d5c90ea90c64060ae0974b852e021 Mon Sep 17 00:00:00 2001 From: MelchiorSchuh Date: Tue, 23 Jun 2026 10:48:19 +0200 Subject: [PATCH 1/4] fix(ModelTopology): Fixed check on corner internal to a line --- .../topology/brep_corners_topology.cpp | 60 +++++++++++-------- 1 file changed, 36 insertions(+), 24 deletions(-) diff --git a/src/geode/inspector/inspection/topology/brep_corners_topology.cpp b/src/geode/inspector/inspection/topology/brep_corners_topology.cpp index 6bad8800..ec78f3db 100644 --- a/src/geode/inspector/inspection/topology/brep_corners_topology.cpp +++ b/src/geode/inspector/inspection/topology/brep_corners_topology.cpp @@ -245,33 +245,49 @@ namespace geode continue; } const auto& corner_uuid = cmv.component_id.id(); + absl::linked_hash_map< uuid, index_t > line_to_nb_cmvs; for( const auto& cmv_line : brep_.component_mesh_vertices( unique_vertex_index ) ) { + const auto& line_id = cmv_line.component_id.id(); if( cmv_line.component_id.type() != Line3D::component_type_static() - || !brep_.line( cmv_line.component_id.id() ).is_active() ) + || !brep_.line( line_id ).is_active() ) { continue; } - if( brep_.Relationships::is_boundary( - corner_uuid, cmv_line.component_id.id() ) ) + auto [itr, inserted] = + line_to_nb_cmvs.try_emplace( line_id, 1 ); + if( !inserted ) { - continue; + itr->second++; } - if( brep_.Relationships::is_internal( - corner_uuid, cmv_line.component_id.id() ) ) + } + for( const auto& [line_id, nb_cmvs] : line_to_nb_cmvs ) + { + if( brep_.Relationships::is_boundary( corner_uuid, line_id ) ) { - index_t line_vertex_count{ 0 }; - for( const auto& cmv2 : - brep_.component_mesh_vertices( unique_vertex_index ) ) + if( nb_cmvs != 1 ) { - if( cmv2.component_id.id() == corner_uuid ) - { - line_vertex_count++; - } + return absl::StrCat( "unique vertex with index ", + unique_vertex_index, " is associated with Corner ", + brep_.corner( corner_uuid ) + .name() + .value_or( corner_uuid.string() ), + " (", corner_uuid.string(), + "), which is boundary to Line ", + brep_.line( line_id ).name().value_or( + line_id.string() ), + " (", line_id.string(), + "), so Line should have one cmv on this unique " + "vertex, but has ", + nb_cmvs, " vertices on it instead." ); } - if( line_vertex_count != 2 ) + continue; + } + if( brep_.Relationships::is_internal( corner_uuid, line_id ) ) + { + if( nb_cmvs != 2 ) { return absl::StrCat( "unique vertex with index ", unique_vertex_index, " is associated with Corner ", @@ -280,14 +296,12 @@ namespace geode .value_or( corner_uuid.string() ), " (", corner_uuid.string(), "), which is internal to Line ", - brep_.line( cmv_line.component_id.id() ) - .name() - .value_or( - cmv_line.component_id.id().string() ), - " (", cmv_line.component_id.id().string(), + brep_.line( line_id ).name().value_or( + line_id.string() ), + " (", line_id.string(), "), so Line should be closed and have two " "different vertices on unique vertex, but has ", - line_vertex_count, " vertices on it instead." ); + nb_cmvs, " vertices on it instead." ); } continue; } @@ -297,10 +311,8 @@ namespace geode .name() .value_or( corner_uuid.string() ), " (", corner_uuid.string() + "), part of line ", - brep_.line( cmv_line.component_id.id() ) - .name() - .value_or( cmv_line.component_id.id().string() ), - " (", cmv_line.component_id.id().string(), + brep_.line( line_id ).name().value_or( line_id.string() ), + " (", line_id.string(), "), but is neither boundary nor internal of it." ); } } From 355190970112ff1c4c9b81e58f0ae5f92985e1d9 Mon Sep 17 00:00:00 2001 From: MelchiorSchuh Date: Tue, 23 Jun 2026 11:33:43 +0200 Subject: [PATCH 2/4] fix tests --- .../inspector/inspection/topology/brep_corners_topology.cpp | 4 ++-- .../inspector/inspection/topology/brep_lines_topology.cpp | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/geode/inspector/inspection/topology/brep_corners_topology.cpp b/src/geode/inspector/inspection/topology/brep_corners_topology.cpp index ec78f3db..c2da4ddb 100644 --- a/src/geode/inspector/inspection/topology/brep_corners_topology.cpp +++ b/src/geode/inspector/inspection/topology/brep_corners_topology.cpp @@ -267,7 +267,7 @@ namespace geode { if( brep_.Relationships::is_boundary( corner_uuid, line_id ) ) { - if( nb_cmvs != 1 ) + if( nb_cmvs != 1 && nb_cmvs != 2 ) { return absl::StrCat( "unique vertex with index ", unique_vertex_index, " is associated with Corner ", @@ -279,7 +279,7 @@ namespace geode brep_.line( line_id ).name().value_or( line_id.string() ), " (", line_id.string(), - "), so Line should have one cmv on this unique " + "), so Line should have 1 or 2 cmv on this unique " "vertex, but has ", nb_cmvs, " vertices on it instead." ); } diff --git a/src/geode/inspector/inspection/topology/brep_lines_topology.cpp b/src/geode/inspector/inspection/topology/brep_lines_topology.cpp index 239e7891..93a1c686 100644 --- a/src/geode/inspector/inspection/topology/brep_lines_topology.cpp +++ b/src/geode/inspector/inspection/topology/brep_lines_topology.cpp @@ -466,7 +466,8 @@ namespace geode surface.name().value_or( surface_id.string() ), " (", surface_id.string(), "), but has ", surface_edges.size(), - " edges of this Surface around it, it should be 1." ); + " edges of this Surface around edge ", edge_index, + ", it should be 1." ); } continue; } From 5f0d7ab1775ce485061df313bce4c3e19875a223 Mon Sep 17 00:00:00 2001 From: MelchiorSchuh Date: Tue, 23 Jun 2026 12:41:32 +0200 Subject: [PATCH 3/4] better test --- .../inspection/topology/brep_corners_topology.cpp | 7 +------ .../inspector/inspection/topology/brep_lines_topology.cpp | 3 ++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/geode/inspector/inspection/topology/brep_corners_topology.cpp b/src/geode/inspector/inspection/topology/brep_corners_topology.cpp index c2da4ddb..cfd93d24 100644 --- a/src/geode/inspector/inspection/topology/brep_corners_topology.cpp +++ b/src/geode/inspector/inspection/topology/brep_corners_topology.cpp @@ -256,12 +256,7 @@ namespace geode { continue; } - auto [itr, inserted] = - line_to_nb_cmvs.try_emplace( line_id, 1 ); - if( !inserted ) - { - itr->second++; - } + line_to_nb_cmvs.try_emplace( line_id, 0 ).first->second++; } for( const auto& [line_id, nb_cmvs] : line_to_nb_cmvs ) { diff --git a/src/geode/inspector/inspection/topology/brep_lines_topology.cpp b/src/geode/inspector/inspection/topology/brep_lines_topology.cpp index 93a1c686..0f5b2ef2 100644 --- a/src/geode/inspector/inspection/topology/brep_lines_topology.cpp +++ b/src/geode/inspector/inspection/topology/brep_lines_topology.cpp @@ -480,7 +480,8 @@ namespace geode surface.name().value_or( surface_id.string() ), " (", surface_id.string(), "), but has ", surface_edges.size(), - " edges of this surface around it, it should be 2." ); + " edges of this surface around edge ", edge_index, + ", it should be 2." ); } continue; } From 2d2e7e0372576492d280a8a49a754a52ca5b439c Mon Sep 17 00:00:00 2001 From: MelchiorSchuh Date: Wed, 24 Jun 2026 16:54:13 +0200 Subject: [PATCH 4/4] modified from OG api update --- .../topology/brep_corners_topology.cpp | 39 ++++++++----------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/src/geode/inspector/inspection/topology/brep_corners_topology.cpp b/src/geode/inspector/inspection/topology/brep_corners_topology.cpp index cfd93d24..7a716574 100644 --- a/src/geode/inspector/inspection/topology/brep_corners_topology.cpp +++ b/src/geode/inspector/inspection/topology/brep_corners_topology.cpp @@ -244,7 +244,7 @@ namespace geode { continue; } - const auto& corner_uuid = cmv.component_id.id(); + const auto& corner = brep_.corner( cmv.component_id.id() ); absl::linked_hash_map< uuid, index_t > line_to_nb_cmvs; for( const auto& cmv_line : brep_.component_mesh_vertices( unique_vertex_index ) ) @@ -260,40 +260,35 @@ namespace geode } for( const auto& [line_id, nb_cmvs] : line_to_nb_cmvs ) { - if( brep_.Relationships::is_boundary( corner_uuid, line_id ) ) + const auto& line = brep_.line( line_id ); + if( brep_.is_boundary( corner, line ) ) { if( nb_cmvs != 1 && nb_cmvs != 2 ) { return absl::StrCat( "unique vertex with index ", unique_vertex_index, " is associated with Corner ", - brep_.corner( corner_uuid ) - .name() - .value_or( corner_uuid.string() ), - " (", corner_uuid.string(), + corner.name().value_or( corner.id().string() ), + " (", corner.id().string(), "), which is boundary to Line ", - brep_.line( line_id ).name().value_or( - line_id.string() ), - " (", line_id.string(), + line.name().value_or( line_id.string() ), " (", + line_id.string(), "), so Line should have 1 or 2 cmv on this unique " "vertex, but has ", nb_cmvs, " vertices on it instead." ); } continue; } - if( brep_.Relationships::is_internal( corner_uuid, line_id ) ) + if( brep_.is_internal( corner, line ) ) { if( nb_cmvs != 2 ) { return absl::StrCat( "unique vertex with index ", unique_vertex_index, " is associated with Corner ", - brep_.corner( corner_uuid ) - .name() - .value_or( corner_uuid.string() ), - " (", corner_uuid.string(), + corner.name().value_or( corner.id().string() ), + " (", corner.id().string(), "), which is internal to Line ", - brep_.line( line_id ).name().value_or( - line_id.string() ), - " (", line_id.string(), + line.name().value_or( line_id.string() ), " (", + line_id.string(), "), so Line should be closed and have two " "different vertices on unique vertex, but has ", nb_cmvs, " vertices on it instead." ); @@ -302,12 +297,10 @@ namespace geode } return absl::StrCat( "unique vertex ", unique_vertex_index, " is associated with Corner ", - brep_.corner( corner_uuid ) - .name() - .value_or( corner_uuid.string() ), - " (", corner_uuid.string() + "), part of line ", - brep_.line( line_id ).name().value_or( line_id.string() ), - " (", line_id.string(), + corner.name().value_or( corner.id().string() ), " (", + corner.id().string() + "), part of line ", + line.name().value_or( line.id().string() ), " (", + line_id.string(), "), but is neither boundary nor internal of it." ); } }