diff --git a/src/geode/inspector/topology/brep_lines_topology.cpp b/src/geode/inspector/topology/brep_lines_topology.cpp index e1850be..1ac8c94 100644 --- a/src/geode/inspector/topology/brep_lines_topology.cpp +++ b/src/geode/inspector/topology/brep_lines_topology.cpp @@ -44,14 +44,15 @@ namespace geode index_t BRepLinesTopologyInspectionResult::nb_issues() const { return lines_not_meshed.nb_issues() + + unique_vertices_linked_to_line_with_wrong_relationship_to_surface + .nb_issues() + lines_not_linked_to_a_unique_vertex.nb_issues() + unique_vertices_linked_to_a_line_with_invalid_embeddings .nb_issues() + unique_vertices_linked_to_a_single_and_invalid_line.nb_issues() - + unique_vertices_linked_to_line_with_wrong_relationship_to_surface - .nb_issues() + unique_vertices_linked_to_several_lines_but_not_linked_to_a_corner - .nb_issues(); + .nb_issues() + + line_edges_with_wrong_component_edges_around.nb_issues(); } std::string BRepLinesTopologyInspectionResult::string() const @@ -61,6 +62,15 @@ namespace geode { absl::StrAppend( &message, lines_not_meshed.string() ); } + if( unique_vertices_linked_to_line_with_wrong_relationship_to_surface + .nb_issues() + != 0 ) + { + absl::StrAppend( &message, + unique_vertices_linked_to_line_with_wrong_relationship_to_surface + .string(), + "\n" ); + } if( lines_not_linked_to_a_unique_vertex.nb_issues() != 0 ) { absl::StrAppend( @@ -80,15 +90,6 @@ namespace geode unique_vertices_linked_to_a_single_and_invalid_line.string(), "\n" ); } - if( unique_vertices_linked_to_line_with_wrong_relationship_to_surface - .nb_issues() - != 0 ) - { - absl::StrAppend( &message, - unique_vertices_linked_to_line_with_wrong_relationship_to_surface - .string(), - "\n" ); - } if( unique_vertices_linked_to_several_lines_but_not_linked_to_a_corner .nb_issues() != 0 ) @@ -97,6 +98,11 @@ namespace geode unique_vertices_linked_to_several_lines_but_not_linked_to_a_corner .string() ); } + if( line_edges_with_wrong_component_edges_around.nb_issues() != 0 ) + { + absl::StrAppend( &message, + line_edges_with_wrong_component_edges_around.string() ); + } if( !message.empty() ) { return message; @@ -452,6 +458,36 @@ namespace geode surface.name(), " (", surface_id.string(), "), but is neither boundary of nor internal to it." ); } + for( const auto& embedding_surface : brep_.embedding_surfaces( line ) ) + { + if( !embedding_surface.is_active() ) + { + continue; + } + if( !cme.surface_edges.contains( embedding_surface.id() ) ) + { + return absl::StrCat( "Line ", line.name(), " (", + line.id().string(), ") is embedded in Surface ", + embedding_surface.name(), " (", + embedding_surface.id().string(), ") but edge ", edge_index, + " has no common edge with the surface" ); + } + } + for( const auto& incident_surface : brep_.incidences( line ) ) + { + if( !incident_surface.is_active() ) + { + continue; + } + if( !cme.surface_edges.contains( incident_surface.id() ) ) + { + return absl::StrCat( "Line ", line.name(), " (", + line.id().string(), ") is incident to Surface ", + incident_surface.name(), " (", + incident_surface.id().string(), ") but edge ", edge_index, + " has no common edge with the surface" ); + } + } for( const auto& [block_id, block_edges] : cme.block_edges ) { const auto& block = brep_.block( block_id ); @@ -468,6 +504,22 @@ namespace geode continue; } } + for( const auto& embedding_block : brep_.embedding_blocks( line ) ) + { + if( !embedding_block.is_active() + || embedding_block.mesh().nb_polyhedra() == 0 ) + { + continue; + } + if( !cme.block_edges.contains( embedding_block.id() ) ) + { + return absl::StrCat( "Line ", line.name(), " (", + line.id().string(), ") is embedded in Block ", + embedding_block.name(), " (", embedding_block.id().string(), + ") but edge ", edge_index, + " has no common edge with the block" ); + } + } return std::nullopt; } diff --git a/src/geode/inspector/topology/brep_surfaces_topology.cpp b/src/geode/inspector/topology/brep_surfaces_topology.cpp index 8b97a87..bb6a9dc 100644 --- a/src/geode/inspector/topology/brep_surfaces_topology.cpp +++ b/src/geode/inspector/topology/brep_surfaces_topology.cpp @@ -218,45 +218,44 @@ namespace geode } const auto line_uuids = internal::components_uuids( brep_, unique_vertex_index, Line3D::component_type_static() ); - // if( line_uuids.empty() ) - // { - // bool has_corner_internal_to_all_surfaces{ false }; - // for( const auto& cmv : - // brep_.component_mesh_vertices( unique_vertex_index ) ) - // { - // if( cmv.component_id.type() - // != Corner3D::component_type_static() ) - // { - // continue; - // } - // const auto& corner = brep_.corner( cmv.component_id.id() ); - // for( const auto& surface_id : surface_uuids ) - // { - // const auto& surface = brep_.surface( surface_id ); - // if( surface.is_active() - // && !brep_.is_internal( corner, surface ) ) - // { - // return absl::StrCat( "unique vertex ", - // unique_vertex_index, " at position [", - // corner.mesh().point( cmv.vertex ).string(), - // "] is part of multiple active Surfaces, and not " - // "part of any Line, but is part of Corner ", - // corner.name(), " (", corner.id().string(), - // "), which is not internal to active Surface ", - // surface.name(), " (", surface_id.string(), ")." - // ); - // } - // } - // has_corner_internal_to_all_surfaces = true; - // } - // if( !has_corner_internal_to_all_surfaces ) - // { - // return absl::StrCat( "unique vertex ", unique_vertex_index, - // " is part of multiple active Surfaces, and not part of " - // "any Line, but not part of any Corner internal to all " - // "Surfaces." ); - // } - // } + if( line_uuids.empty() ) + { + bool has_corner_internal_to_all_surfaces{ false }; + for( const auto& cmv : + brep_.component_mesh_vertices( unique_vertex_index ) ) + { + if( cmv.component_id.type() + != Corner3D::component_type_static() ) + { + continue; + } + const auto& corner = brep_.corner( cmv.component_id.id() ); + for( const auto& surface_id : surface_uuids ) + { + const auto& surface = brep_.surface( surface_id ); + if( surface.is_active() + && !brep_.is_internal( corner, surface ) ) + { + return absl::StrCat( "unique vertex ", + unique_vertex_index, " at position [", + corner.mesh().point( cmv.vertex ).string(), + "] is part of multiple active Surfaces, and not " + "part of any Line, but is part of Corner ", + corner.name(), " (", corner.id().string(), + "), which is not internal to active Surface ", + surface.name(), " (", surface_id.string(), ")." ); + } + } + has_corner_internal_to_all_surfaces = true; + } + if( !has_corner_internal_to_all_surfaces ) + { + return absl::StrCat( "unique vertex ", unique_vertex_index, + " is part of multiple active Surfaces, and not part of " + "any Line, but not part of any Corner internal to all " + "Surfaces." ); + } + } if( line_uuids.size() == 1 ) { index_t nb_cmv_lines{ 0 }; @@ -294,13 +293,22 @@ namespace geode } if( brep_.Relationships::nb_embeddings( cmv.component_id.id() ) + nb_of_line_relationships_with_surfaces - != surface_uuids.size() ) + < surface_uuids.size() ) { return absl::StrCat( "unique vertex ", unique_vertex_index, " is part of multiple active Surfaces and only one " "Line, is a Corner, but is not internal to all the " "Surfaces without relationships to the Line." ); } + if( brep_.Relationships::nb_embeddings( cmv.component_id.id() ) + + nb_of_line_relationships_with_surfaces + > surface_uuids.size() ) + { + return absl::StrCat( "unique vertex ", unique_vertex_index, + " is part of multiple active Surfaces and only one " + "Line, is a Corner, but is internal to Surfaces with " + "relationships to the Line." ); + } } } return std::nullopt; diff --git a/tests/inspector/test-solid-adjacency.cpp b/tests/inspector/test-solid-adjacency.cpp index 265a896..f7e52c5 100644 --- a/tests/inspector/test-solid-adjacency.cpp +++ b/tests/inspector/test-solid-adjacency.cpp @@ -167,6 +167,7 @@ int main() try { geode::InspectorInspectorLibrary::initialize(); + geode::Logger::set_level( geode::Logger::LEVEL::debug ); check_adjacency(); check_non_adjacency_no_bijection(); check_non_adjacency_wrong_facet();