|
42 | 42 | #include <geode/inspector/criterion/manifold/solid_facet_manifold.hpp> |
43 | 43 | #include <geode/inspector/criterion/manifold/solid_vertex_manifold.hpp> |
44 | 44 |
|
45 | | -namespace |
46 | | -{ |
47 | | - bool is_vertex_on_free_border( const geode::Surface3D& surface, |
48 | | - geode::index_t vertex, |
49 | | - const geode::BRep& model ) |
50 | | - { |
51 | | - const auto unique_vertex = |
52 | | - model.unique_vertex( { surface.component_id(), vertex } ); |
53 | | - for( const auto& cmv : model.component_mesh_vertices( unique_vertex ) ) |
54 | | - { |
55 | | - if( cmv.component_id.type() |
56 | | - != geode::Line3D::component_type_static() ) |
57 | | - { |
58 | | - continue; |
59 | | - } |
60 | | - if( !model.relation_index( cmv.component_id.id(), surface.id() ) |
61 | | - .has_value() ) |
62 | | - { |
63 | | - continue; |
64 | | - } |
65 | | - if( model.is_internal( |
66 | | - model.line( cmv.component_id.id() ), surface ) ) |
67 | | - { |
68 | | - continue; |
69 | | - } |
70 | | - if( model.nb_incidences( cmv.component_id.id() ) > 1 ) |
71 | | - { |
72 | | - continue; |
73 | | - } |
74 | | - return true; |
75 | | - } |
76 | | - return false; |
77 | | - } |
78 | | - |
79 | | - std::vector< bool > vertices_on_free_border( |
80 | | - const geode::Surface3D& surface, |
81 | | - const geode::SurfaceMesh3D& surface_mesh, |
82 | | - const geode::BRep& model ) |
83 | | - { |
84 | | - std::vector< bool > is_on_free_border( |
85 | | - surface_mesh.nb_vertices(), false ); |
86 | | - for( const auto vertex : geode::Range{ surface_mesh.nb_vertices() } ) |
87 | | - { |
88 | | - is_on_free_border[vertex] = |
89 | | - is_vertex_on_free_border( surface, vertex, model ); |
90 | | - } |
91 | | - return is_on_free_border; |
92 | | - } |
93 | | -} // namespace |
94 | | - |
95 | 45 | namespace geode |
96 | 46 | { |
97 | 47 | std::string BRepMeshesManifoldInspectionResult::string() const |
@@ -241,44 +191,6 @@ namespace geode |
241 | 191 | message ); |
242 | 192 | continue; |
243 | 193 | } |
244 | | - const auto& surface = model().surface( edge.second[0] ); |
245 | | - const auto& mesh = surface.mesh(); |
246 | | - const auto is_on_free_border = |
247 | | - vertices_on_free_border( surface, mesh, model() ); |
248 | | - geode::index_t first_edge_vertex; |
249 | | - geode::index_t second_edge_vertex; |
250 | | - for( const auto& cmv : model().component_mesh_vertices( |
251 | | - edge.first.vertices()[0] ) ) |
252 | | - { |
253 | | - if( cmv.component_id.id() == surface.id() ) |
254 | | - { |
255 | | - first_edge_vertex = cmv.vertex; |
256 | | - break; |
257 | | - } |
258 | | - } |
259 | | - for( const auto& cmv : model().component_mesh_vertices( |
260 | | - edge.first.vertices()[1] ) ) |
261 | | - { |
262 | | - if( cmv.component_id.id() == surface.id() ) |
263 | | - { |
264 | | - second_edge_vertex = cmv.vertex; |
265 | | - break; |
266 | | - } |
267 | | - } |
268 | | - if( !is_on_free_border[first_edge_vertex] |
269 | | - || !is_on_free_border[second_edge_vertex] ) |
270 | | - { |
271 | | - continue; |
272 | | - } |
273 | | - std::string message = absl::StrCat( |
274 | | - "Model edge between unique vertices ", |
275 | | - edge.first.vertices()[0], " and ", edge.first.vertices()[1], |
276 | | - " is not manifold: it has 2 point on the free border " |
277 | | - "without being on the border of surface " ); |
278 | | - absl::StrAppend( &message, edge.second[0].string(), ", " ); |
279 | | - issues.add_issue( |
280 | | - BRepNonManifoldEdge{ edge.first.vertices(), edge.second }, |
281 | | - message ); |
282 | 194 | } |
283 | 195 | for( const auto& line : model().lines() ) |
284 | 196 | { |
@@ -349,5 +261,4 @@ namespace geode |
349 | 261 | impl_->add_model_non_manifold_facets( result.brep_non_manifold_facets ); |
350 | 262 | return result; |
351 | 263 | } |
352 | | - |
353 | 264 | } // namespace geode |
0 commit comments