Skip to content

Commit bdecc1e

Browse files
committed
feat(SolidInspector): Added the inspection of the adjacency and manifold properties on SolidMeshes.
1 parent a840e37 commit bdecc1e

31 files changed

+2100
-44
lines changed

bindings/python/src/inspector/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ add_geode_python_binding(
2222
NAME "py_inspector"
2323
SOURCES
2424
"adjacency/surface_adjacency.h"
25+
"adjacency/solid_adjacency"
2526
"colocation/edgedcurve_colocation.h"
2627
"colocation/pointset_colocation.h"
2728
"colocation/surface_colocation.h"
@@ -31,6 +32,9 @@ add_geode_python_binding(
3132
"degeneration/surface_degeneration.h"
3233
"manifold/surface_edge_manifold.h"
3334
"manifold/surface_vertex_manifold.h"
35+
"manifold/solid_vertex_manifold.h"
36+
"manifold/solid_edge_manifold.h"
37+
"manifold/solid_facet_manifold.h"
3438
"topology/brep_topology.h"
3539
"topology/section_topology.h"
3640
"inspector.cpp"
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Copyright (c) 2019 - 2022 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+
#include <geode/mesh/core/solid_mesh.h>
25+
26+
#include <geode/inspector/criterion/adjacency/solid_adjacency.h>
27+
28+
#define PYTHON_SOLID_ADJACENCY( dimension ) \
29+
const auto name##dimension = \
30+
"SolidMeshAdjacency" + std::to_string( dimension ) + "D"; \
31+
pybind11::class_< SolidMeshAdjacency##dimension##D >( \
32+
module, name##dimension.c_str() ) \
33+
.def( pybind11::init< const SolidMesh< dimension >& >() ) \
34+
.def( pybind11::init< const SolidMesh< dimension >&, bool >() ) \
35+
.def( "mesh_has_wrong_adjacencies", \
36+
&SolidMeshAdjacency##dimension##D::mesh_has_wrong_adjacencies ) \
37+
.def( "nb_facets_with_wrong_adjacency", \
38+
&SolidMeshAdjacency##dimension##D:: \
39+
nb_facets_with_wrong_adjacency ) \
40+
.def( "polyhedron_facets_with_wrong_adjacency", \
41+
&SolidMeshAdjacency##dimension##D:: \
42+
polyhedron_facets_with_wrong_adjacency )
43+
44+
namespace geode
45+
{
46+
void define_solid_adjacency( pybind11::module& module )
47+
{
48+
PYTHON_SOLID_ADJACENCY( 3 );
49+
}
50+
} // namespace geode

bindings/python/src/inspector/inspector.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "pybind11/pybind11.h"
2626
#include "pybind11/stl.h"
2727

28+
#include "adjacency/solid_adjacency.h"
2829
#include "adjacency/surface_adjacency.h"
2930

3031
#include "colocation/edgedcurve_colocation.h"
@@ -36,6 +37,9 @@
3637
#include "degeneration/solid_degeneration.h"
3738
#include "degeneration/surface_degeneration.h"
3839

40+
#include "manifold/solid_edge_manifold.h"
41+
#include "manifold/solid_facet_manifold.h"
42+
#include "manifold/solid_vertex_manifold.h"
3943
#include "manifold/surface_edge_manifold.h"
4044
#include "manifold/surface_vertex_manifold.h"
4145

@@ -53,6 +57,7 @@ PYBIND11_MODULE( opengeode_inspector_py_inspector, module )
5357
{
5458
module.doc() = "OpenGeode-Inspector Python binding";
5559
geode::define_surface_adjacency( module );
60+
geode::define_solid_adjacency( module );
5661
geode::define_edgedcurve_colocation( module );
5762
geode::define_pointset_colocation( module );
5863
geode::define_solid_colocation( module );
@@ -62,6 +67,9 @@ PYBIND11_MODULE( opengeode_inspector_py_inspector, module )
6267
geode::define_surface_degeneration( module );
6368
geode::define_surface_edge_manifold( module );
6469
geode::define_surface_vertex_manifold( module );
70+
geode::define_solid_edge_manifold( module );
71+
geode::define_solid_vertex_manifold( module );
72+
geode::define_solid_facet_manifold( module );
6573
geode::define_brep_topology_inspector( module );
6674
geode::define_section_topology_inspector( module );
6775
geode::define_brep_inspector( module );
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Copyright (c) 2019 - 2022 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+
#include <geode/mesh/core/solid_mesh.h>
25+
26+
#include <geode/mesh/core/detail/vertex_cycle.h>
27+
28+
#include <geode/inspector/criterion/manifold/solid_edge_manifold.h>
29+
30+
#define PYTHON_SOLID_EDGE_MANIFOLD( dimension ) \
31+
const auto name##dimension = \
32+
"SolidMeshEdgeManifold" + std::to_string( dimension ) + "D"; \
33+
pybind11::class_< SolidMeshEdgeManifold##dimension##D >( \
34+
module, name##dimension.c_str() ) \
35+
.def( pybind11::init< const SolidMesh< dimension >& >() ) \
36+
.def( pybind11::init< const SolidMesh< dimension >&, bool >() ) \
37+
.def( "mesh_edges_are_manifold", \
38+
&SolidMeshEdgeManifold##dimension##D::mesh_edges_are_manifold ) \
39+
.def( "nb_non_manifold_edges", \
40+
&SolidMeshEdgeManifold##dimension##D::nb_non_manifold_edges ) \
41+
.def( "non_manifold_edges", \
42+
&SolidMeshEdgeManifold##dimension##D::non_manifold_edges )
43+
44+
namespace geode
45+
{
46+
void define_solid_edge_manifold( pybind11::module& module )
47+
{
48+
PYTHON_SOLID_EDGE_MANIFOLD( 3 );
49+
}
50+
} // namespace geode
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Copyright (c) 2019 - 2022 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+
#include <geode/mesh/core/solid_mesh.h>
25+
26+
#include <geode/mesh/core/detail/vertex_cycle.h>
27+
28+
#include <geode/inspector/criterion/manifold/solid_facet_manifold.h>
29+
30+
#define PYTHON_SOLID_FACET_MANIFOLD( dimension ) \
31+
const auto name##dimension = \
32+
"SolidMeshFacetManifold" + std::to_string( dimension ) + "D"; \
33+
pybind11::class_< SolidMeshFacetManifold##dimension##D >( \
34+
module, name##dimension.c_str() ) \
35+
.def( pybind11::init< const SolidMesh< dimension >& >() ) \
36+
.def( pybind11::init< const SolidMesh< dimension >&, bool >() ) \
37+
.def( "mesh_facets_are_manifold", \
38+
&SolidMeshFacetManifold##dimension##D::mesh_facets_are_manifold ) \
39+
.def( "nb_non_manifold_facets", \
40+
&SolidMeshFacetManifold##dimension##D::nb_non_manifold_facets ) \
41+
.def( "non_manifold_facets", \
42+
&SolidMeshFacetManifold##dimension##D::non_manifold_facets )
43+
44+
namespace geode
45+
{
46+
void define_solid_facet_manifold( pybind11::module& module )
47+
{
48+
PYTHON_SOLID_FACET_MANIFOLD( 3 );
49+
}
50+
} // namespace geode
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright (c) 2019 - 2022 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+
#include <geode/mesh/core/solid_mesh.h>
25+
26+
#include <geode/inspector/criterion/manifold/solid_vertex_manifold.h>
27+
28+
#define PYTHON_SOLID_VERTEX_MANIFOLD( dimension ) \
29+
const auto name##dimension = \
30+
"SolidMeshVertexManifold" + std::to_string( dimension ) + "D"; \
31+
pybind11::class_< SolidMeshVertexManifold##dimension##D >( \
32+
module, name##dimension.c_str() ) \
33+
.def( pybind11::init< const SolidMesh< dimension >& >() ) \
34+
.def( pybind11::init< const SolidMesh< dimension >&, bool >() ) \
35+
.def( "mesh_vertices_are_manifold", \
36+
&SolidMeshVertexManifold##dimension##D:: \
37+
mesh_vertices_are_manifold ) \
38+
.def( "nb_non_manifold_vertices", \
39+
&SolidMeshVertexManifold##dimension##D::nb_non_manifold_vertices ) \
40+
.def( "non_manifold_vertices", \
41+
&SolidMeshVertexManifold##dimension##D::non_manifold_vertices )
42+
43+
namespace geode
44+
{
45+
void define_solid_vertex_manifold( pybind11::module& module )
46+
{
47+
PYTHON_SOLID_VERTEX_MANIFOLD( 3 );
48+
}
49+
} // namespace geode

bindings/python/src/inspector/solid_inspector.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,11 @@
2929
const auto name##dimension = \
3030
"SolidMeshInspector" + std::to_string( dimension ) + "D"; \
3131
pybind11::class_< SolidMeshInspector##dimension##D, \
32-
SolidMeshColocation##dimension##D, \
33-
SolidMeshDegeneration##dimension##D >( \
32+
SolidMeshAdjacency##dimension##D, SolidMeshColocation##dimension##D, \
33+
SolidMeshDegeneration##dimension##D, \
34+
SolidMeshVertexManifold##dimension##D, \
35+
SolidMeshEdgeManifold##dimension##D, \
36+
SolidMeshFacetManifold##dimension##D >( \
3437
module, name##dimension.c_str() ) \
3538
.def( pybind11::init< const SolidMesh< dimension >& >() ) \
3639
.def( pybind11::init< const SolidMesh< dimension >&, bool >() )

0 commit comments

Comments
 (0)