diff --git a/src/geode/inspector/inspection/topology/brep_corners_topology.cpp b/src/geode/inspector/inspection/topology/brep_corners_topology.cpp index 6bad880..7a71657 100644 --- a/src/geode/inspector/inspection/topology/brep_corners_topology.cpp +++ b/src/geode/inspector/inspection/topology/brep_corners_topology.cpp @@ -244,63 +244,63 @@ 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 ) ) { + 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() ) ) + line_to_nb_cmvs.try_emplace( line_id, 0 ).first->second++; + } + for( const auto& [line_id, nb_cmvs] : line_to_nb_cmvs ) + { + 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 ", + corner.name().value_or( corner.id().string() ), + " (", corner.id().string(), + "), which is boundary to Line ", + 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, cmv_line.component_id.id() ) ) + if( brep_.is_internal( corner, line ) ) { - index_t line_vertex_count{ 0 }; - for( const auto& cmv2 : - brep_.component_mesh_vertices( unique_vertex_index ) ) - { - if( cmv2.component_id.id() == corner_uuid ) - { - line_vertex_count++; - } - } - if( line_vertex_count != 2 ) + 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( cmv_line.component_id.id() ) - .name() - .value_or( - cmv_line.component_id.id().string() ), - " (", cmv_line.component_id.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 ", - line_vertex_count, " vertices on it instead." ); + nb_cmvs, " vertices on it instead." ); } continue; } 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( cmv_line.component_id.id() ) - .name() - .value_or( cmv_line.component_id.id().string() ), - " (", cmv_line.component_id.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." ); } } diff --git a/src/geode/inspector/inspection/topology/brep_lines_topology.cpp b/src/geode/inspector/inspection/topology/brep_lines_topology.cpp index 239e789..0f5b2ef 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; } @@ -479,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; }