Bindings.cc 2.09 KB
Newer Older
Alexander Dielen's avatar
Alexander Dielen committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
#include "MeshTypes.hh"
#include "Miscellaneous.hh"
#include "Mesh.hh"
#include "Iterator.hh"
#include "Circulator.hh"
#include "InputOutput.hh"
#include "Decimater.hh"

#include <pybind11/pybind11.h>
#include <pybind11/embed.h>

#ifdef OPENMESH_PYTHON_EMBEDDED_MODULE
#include "InitPlugin.hh"
#endif

namespace py = pybind11;
namespace OM = OpenMesh;

namespace OpenMeshPython {


#ifdef OPENMESH_PYTHON_EMBEDDED_MODULE
PYBIND11_EMBEDDED_MODULE(OpenMeshPython, m) {
	init_plugin(m);
#else
PYBIND11_MODULE(openmesh, m) {
#endif
	expose_handles(m);

	expose_mesh<PolyMesh>(m, "PolyMesh");
	expose_mesh<TriMesh>(m, "TriMesh");

	expose_iterator<OM::PolyConnectivity::VertexIter, &OM::ArrayKernel::n_vertices>(m, "VertexIter");
	expose_iterator<OM::PolyConnectivity::HalfedgeIter, &OM::ArrayKernel::n_halfedges>(m, "HalfedgeIter");
	expose_iterator<OM::PolyConnectivity::EdgeIter, &OM::ArrayKernel::n_edges>(m, "EdgeIter");
	expose_iterator<OM::PolyConnectivity::FaceIter, &OM::ArrayKernel::n_faces>(m, "FaceIter");

	expose_circulator<OM::PolyConnectivity::VertexVertexIter, OM::VertexHandle>(m, "VertexVertexIter");
	expose_circulator<OM::PolyConnectivity::VertexIHalfedgeIter, OM::VertexHandle>(m, "VertexIHalfedgeIter");
	expose_circulator<OM::PolyConnectivity::VertexOHalfedgeIter, OM::VertexHandle>(m, "VertexOHalfedgeIter");
	expose_circulator<OM::PolyConnectivity::VertexEdgeIter, OM::VertexHandle>(m, "VertexEdgeIter");
	expose_circulator<OM::PolyConnectivity::VertexFaceIter, OM::VertexHandle>(m, "VertexFaceIter");

	expose_circulator<OM::PolyConnectivity::FaceVertexIter, OM::FaceHandle>(m, "FaceVertexIter");
	expose_circulator<OM::PolyConnectivity::FaceHalfedgeIter, OM::FaceHandle>(m, "FaceHalfedgeIter");
	expose_circulator<OM::PolyConnectivity::FaceEdgeIter, OM::FaceHandle>(m, "FaceEdgeIter");
	expose_circulator<OM::PolyConnectivity::FaceFaceIter, OM::FaceHandle>(m, "FaceFaceIter");

	expose_circulator<OM::PolyConnectivity::HalfedgeLoopIter, OM::HalfedgeHandle>(m, "HalfedgeLoopIter");

	expose_io(m);

	expose_decimater<PolyMesh>(m, "PolyMesh");
	expose_decimater<TriMesh>(m, "TriMesh");
}

} // namespace OpenMeshPython