Skip to content

Commit 6c09886

Browse files
committed
Added model validity functions
1 parent 5f058c8 commit 6c09886

13 files changed

Lines changed: 1068 additions & 2 deletions

File tree

bindings/python/src/inspection/topology/brep_topology.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ namespace geode
4141
.def_readwrite( "unique_vertices_linked_to_multiple_corners",
4242
&BRepCornersTopologyInspectionResult::
4343
unique_vertices_linked_to_multiple_corners )
44+
.def_readwrite(
45+
"unique_vertices_linked_to_multiply_embedded_corner",
46+
&BRepCornersTopologyInspectionResult::
47+
unique_vertices_linked_to_multiply_embedded_corner )
4448
.def_readwrite(
4549
"unique_vertices_linked_to_not_internal_nor_boundary_corner",
4650
&BRepCornersTopologyInspectionResult::

include/geode/inspector/inspection/topology/brep_corners_topology.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ namespace geode
5252
InspectionIssues< index_t > unique_vertices_linked_to_multiple_corners{
5353
"unique vertices shared by several Corners"
5454
};
55+
InspectionIssues< index_t >
56+
unique_vertices_linked_to_multiply_embedded_corner{
57+
"unique vertices linked to a Corner embedded in more than two "
58+
"components"
59+
};
5560
InspectionIssues< index_t >
5661
unique_vertices_linked_to_not_internal_nor_boundary_corner{
5762
"unique vertices linked to a Corner with neither "
@@ -95,6 +100,9 @@ namespace geode
95100
unique_vertex_has_multiple_corners(
96101
index_t unique_vertex_index ) const;
97102

103+
[[nodiscard]] std::optional< std::string > corner_is_multiply_embedded(
104+
index_t unique_vertex_index ) const;
105+
98106
[[nodiscard]] std::optional< std::string >
99107
corner_is_not_internal_nor_boundary(
100108
index_t unique_vertex_index ) const;
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright (c) 2019 - 2026 Geode-solutions
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*
22+
*/
23+
24+
#pragma once
25+
26+
#include <geode/inspector/validity/common.hpp>
27+
28+
namespace geode
29+
{
30+
class BRep;
31+
struct ObjectValidity;
32+
} // namespace geode
33+
34+
namespace geode
35+
{
36+
[[nodiscard]] ObjectValidity opengeode_inspector_validity_api is_brep_valid(
37+
const BRep& brep );
38+
} // namespace geode
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright (c) 2019 - 2026 Geode-solutions
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*
22+
*/
23+
24+
#pragma once
25+
26+
#include <geode/inspector/validity/common.hpp>
27+
28+
namespace geode
29+
{
30+
class Section;
31+
struct ObjectValidity;
32+
} // namespace geode
33+
34+
namespace geode
35+
{
36+
[[nodiscard]] ObjectValidity opengeode_inspector_validity_api
37+
is_section_valid( const Section& section );
38+
} // namespace geode

src/geode/inspector/inspection/topology/brep_corners_topology.cpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ namespace geode
3939
return corners_not_meshed.nb_issues()
4040
+ corners_not_linked_to_a_unique_vertex.nb_issues()
4141
+ unique_vertices_linked_to_multiple_corners.nb_issues()
42+
+ unique_vertices_linked_to_multiply_embedded_corner.nb_issues()
4243
+ unique_vertices_linked_to_not_internal_nor_boundary_corner
4344
.nb_issues()
4445
+ unique_vertices_liked_to_not_boundary_line_corner.nb_issues();
@@ -61,6 +62,12 @@ namespace geode
6162
absl::StrAppend(
6263
&message, unique_vertices_linked_to_multiple_corners.string() );
6364
}
65+
if( unique_vertices_linked_to_multiply_embedded_corner.nb_issues()
66+
!= 0 )
67+
{
68+
absl::StrAppend( &message,
69+
unique_vertices_linked_to_multiply_embedded_corner.string() );
70+
}
6471
if( unique_vertices_linked_to_not_internal_nor_boundary_corner
6572
.nb_issues()
6673
!= 0 )
@@ -167,6 +174,29 @@ namespace geode
167174
return std::nullopt;
168175
}
169176

177+
std::optional< std::string >
178+
BRepCornersTopology::corner_is_multiply_embedded(
179+
index_t unique_vertex_index ) const
180+
{
181+
for( const auto& cmv :
182+
brep_.component_mesh_vertices( unique_vertex_index ) )
183+
{
184+
if( cmv.component_id.type() == Corner3D::component_type_static()
185+
&& brep_.corner( cmv.component_id.id() ).is_active()
186+
&& brep_.nb_embeddings( cmv.component_id.id() ) > 1 )
187+
{
188+
return absl::StrCat( "unique vertex ", unique_vertex_index,
189+
" is associated to Corner ",
190+
brep_.corner( cmv.component_id.id() )
191+
.name()
192+
.value_or( cmv.component_id.id().string() ),
193+
" (", cmv.component_id.id().string(),
194+
"), which is embedded in several components." );
195+
}
196+
}
197+
return std::nullopt;
198+
}
199+
170200
std::optional< std::string >
171201
BRepCornersTopology::corner_is_not_internal_nor_boundary(
172202
index_t unique_vertex_index ) const
@@ -300,6 +330,12 @@ namespace geode
300330
result.unique_vertices_linked_to_multiple_corners.add_issue(
301331
unique_vertex_id, problem_message.value() );
302332
}
333+
if( const auto problem_message =
334+
corner_is_multiply_embedded( unique_vertex_id ) )
335+
{
336+
result.unique_vertices_linked_to_multiply_embedded_corner
337+
.add_issue( unique_vertex_id, problem_message.value() );
338+
}
303339
if( const auto problem_message =
304340
corner_is_not_internal_nor_boundary( unique_vertex_id ) )
305341
{

src/geode/inspector/validity/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,21 @@ add_geode_library(
2222
NAME validity
2323
FOLDER "geode/inspector/validity"
2424
SOURCES
25+
"brep_validity.cpp"
2526
"common.cpp"
2627
"edgedcurve_validity.cpp"
2728
"object_validity.cpp"
2829
"pointset_validity.cpp"
30+
"section_validity.cpp"
2931
"solid_validity.cpp"
3032
"surface_validity.cpp"
3133
PUBLIC_HEADERS
34+
"brep_validity.hpp"
3235
"common.hpp"
3336
"edgedcurve_validity.hpp"
3437
"object_validity.hpp"
3538
"pointset_validity.hpp"
39+
"section_validity.hpp"
3640
"solid_validity.hpp"
3741
"surface_validity.hpp"
3842
PUBLIC_DEPENDENCIES

0 commit comments

Comments
 (0)