Skip to content

Commit 2676b07

Browse files
committed
fix(python): export mesh type queries
1 parent f920d6a commit 2676b07

File tree

6 files changed

+953
-748
lines changed

6 files changed

+953
-748
lines changed

bindings/python/src/mesh/core/solid_mesh.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@
2121
*
2222
*/
2323

24+
#include <geode/mesh/core/polyhedral_solid.h>
2425
#include <geode/mesh/core/solid_edges.h>
2526
#include <geode/mesh/core/solid_facets.h>
2627
#include <geode/mesh/core/solid_mesh.h>
28+
#include <geode/mesh/core/tetrahedral_solid.h>
2729

2830
#define PYTHON_SOLID_MESH( dimension ) \
2931
const auto name##dimension = \
@@ -107,7 +109,17 @@
107109
pybind11::return_value_policy::reference ) \
108110
.def( "bounding_box", &SolidMesh##dimension##D::bounding_box ) \
109111
.def( "edge_vertices_in_polyhedron", \
110-
&SolidMesh##dimension##D::edge_vertices_in_polyhedron )
112+
&SolidMesh##dimension##D::edge_vertices_in_polyhedron ) \
113+
.def( "is_tetrahedral_type", \
114+
[]( const SolidMesh< dimension >& solid ) { \
115+
return solid.type_name() \
116+
== TetrahedralSolid< dimension >::type_name_static(); \
117+
} ) \
118+
.def( \
119+
"is_polyhedral_type", []( const SolidMesh< dimension >& solid ) { \
120+
return solid.type_name() \
121+
== PolyhedralSolid< dimension >::type_name_static(); \
122+
} )
111123

112124
namespace geode
113125
{

bindings/python/src/mesh/core/surface_mesh.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525

2626
#include <geode/geometry/vector.h>
2727

28+
#include <geode/mesh/core/polygonal_surface.h>
2829
#include <geode/mesh/core/surface_mesh.h>
30+
#include <geode/mesh/core/triangulated_surface.h>
2931

3032
#define PYTHON_SURFACE_MESH( dimension ) \
3133
const auto name##dimension = \
@@ -108,7 +110,18 @@
108110
.def_static( \
109111
"create", ( std::unique_ptr< SurfaceMesh##dimension##D >( * )() ) \
110112
& SurfaceMesh##dimension##D::create ) \
111-
.def( "clone", &SurfaceMesh##dimension##D::clone )
113+
.def( "clone", &SurfaceMesh##dimension##D::clone ) \
114+
.def( "is_triangulated_type", \
115+
[]( const SurfaceMesh< dimension >& surface ) { \
116+
return surface.type_name() \
117+
== TriangulatedSurface< \
118+
dimension >::type_name_static(); \
119+
} ) \
120+
.def( "is_polygonal_type", \
121+
[]( const SurfaceMesh< dimension >& surface ) { \
122+
return surface.type_name() \
123+
== PolygonalSurface< dimension >::type_name_static(); \
124+
} )
112125

113126
namespace geode
114127
{

0 commit comments

Comments
 (0)