diff --git a/CI/ci-linux.sh b/CI/ci-linux.sh
index f7632198..84283cae 100755
--- a/CI/ci-linux.sh
+++ b/CI/ci-linux.sh
@@ -76,7 +76,7 @@ fi
cd build-release-$BUILDPATH-Vector-Checks
-cmake -DCMAKE_BUILD_TYPE=Release -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON -DOPENMESH_BUILD_PYTHON_BINDINGS=OFF $OPTIONS ../
+cmake -DCMAKE_BUILD_TYPE=Release -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON $OPTIONS ../
#build it
make $MAKE_OPTIONS
@@ -99,51 +99,6 @@ cd Unittests
cd ..
cd ..
-echo -e "${OUTPUT}"
-echo ""
-echo "======================================================================"
-echo "Building Release version with vectorchecks disabled for python tests"
-echo "======================================================================"
-echo -e "${NC}"
-
-if [ ! -d build-release-$BUILDPATH ]; then
- mkdir build-release-$BUILDPATH
-fi
-
-cd build-release-$BUILDPATH
-
-cmake -DCMAKE_BUILD_TYPE=Release -DOPENMESH_BUILD_PYTHON_UNIT_TESTS=ON -DBUILD_APPS=OFF $OPTIONS ../
-
-#build it
-make $MAKE_OPTIONS
-
-echo -e "${OUTPUT}"
-echo ""
-echo "======================================================================"
-echo "Running Python unittests Release version "
-echo "======================================================================"
-echo -e "${NC}"
-
-if [ "$LANGUAGE" == "C++11" ] || [ "$COMPILER" == "gcc" ] ; then
-
- # Execute Python unittests
- cd Python-Unittests
-
- python -m unittest discover -v
-
- cd ..
-
-else
- echo -e "${WARNING}"
- echo "WARNING! Python unittests disabled !!"
- echo -e "${NC}"
-fi
-
-
-cd ..
-
-
-
echo -e "${OUTPUT}"
echo ""
echo "======================================================================"
@@ -158,7 +113,7 @@ fi
cd build-debug-$BUILDPATH-Vector-Checks
-cmake -DCMAKE_BUILD_TYPE=Debug -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON -DOPENMESH_BUILD_PYTHON_BINDINGS=OFF $OPTIONS ../
+cmake -DCMAKE_BUILD_TYPE=Debug -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON $OPTIONS ../
#build it
make $MAKE_OPTIONS
@@ -181,42 +136,3 @@ cd Unittests
cd ..
cd ..
-
-echo -e "${OUTPUT}"
-echo ""
-echo "======================================================================"
-echo "Building Debug version with vectorchecks disabled for python tests"
-echo "======================================================================"
-echo -e "${NC}"
-
-if [ ! -d build-debug-$BUILDPATH ]; then
- mkdir build-debug-$BUILDPATH
-fi
-
-cd build-debug-$BUILDPATH
-
-cmake -DCMAKE_BUILD_TYPE=DEBUG -DOPENMESH_BUILD_PYTHON_UNIT_TESTS=ON -DBUILD_APPS=OFF $OPTIONS ../
-
-#build it
-make $MAKE_OPTIONS
-
-echo -e "${OUTPUT}"
-echo ""
-echo "======================================================================"
-echo "Running Python unittests Debug version "
-echo "======================================================================"
-echo -e "${NC}"
-
-if [ "$LANGUAGE" == "C++11" ] || [ "$COMPILER" == "gcc" ] ; then
-
- # Execute Python unittests
- cd Python-Unittests
-
- python -m unittest discover -v
-else
-
- echo -e "${WARNING}"
- echo "WARNING! Python unittests disabled !!"
- echo -e "${NC}"
-
-fi
diff --git a/CI/ci-mac.sh b/CI/ci-mac.sh
index 9dd14577..a804012d 100755
--- a/CI/ci-mac.sh
+++ b/CI/ci-mac.sh
@@ -58,7 +58,7 @@ fi
cd build-release-$BUILDPATH-Vector-Checks
-cmake -DCMAKE_BUILD_TYPE=Release -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON -DOPENMESH_BUILD_PYTHON_UNIT_TESTS=OFF $OPTIONS ../
+cmake -DCMAKE_BUILD_TYPE=Release -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON $OPTIONS ../
#build it
make
@@ -81,53 +81,6 @@ cd Unittests
cd ..
cd ..
-echo -e "${OUTPUT}"
-echo ""
-echo "======================================================================"
-echo "Building Release version with vectorchecks disabled for python tests"
-echo "======================================================================"
-echo -e "${NC}"
-
-if [ ! -d build-release-$BUILDPATH ]; then
- mkdir build-release-$BUILDPATH
-fi
-
-cd build-release-$BUILDPATH
-
-cmake -DCMAKE_BUILD_TYPE=Release -DOPENMESH_BUILD_PYTHON_UNIT_TESTS=ON -DBUILD_APPS=OFF -DCPACK_BINARY_DRAGNDROP=ON $OPTIONS ../
-
-#build it
-make
-
-echo -e "${OUTPUT}"
-echo ""
-echo "======================================================================"
-echo "Running Python unittests Release version "
-echo "======================================================================"
-echo -e "${NC}"
-
-
-if [ "$LANGUAGE" == "C++11" ]; then
-
- # Execute Python unittests
- cd Python-Unittests
-
- rm -f openmesh.so
- cp ../Build/python/openmesh.so .
- python -m unittest discover -v
-
- cd ..
-
-else
- echo -e "${WARNING}"
- echo "WARNING! Python unittests disabled for clang on Mac with c++98 !!"
- echo -e "${NC}"
-fi
-
-cd ..
-
-
-
echo -e "${OUTPUT}"
echo ""
echo "======================================================================"
@@ -142,7 +95,7 @@ fi
cd build-debug-$BUILDPATH-Vector-Checks
-cmake -DCMAKE_BUILD_TYPE=Debug -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON -DOPENMESH_BUILD_PYTHON_UNIT_TESTS=OFF $OPTIONS ../
+cmake -DCMAKE_BUILD_TYPE=Debug -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON $OPTIONS ../
#build it
make
@@ -166,52 +119,6 @@ cd Unittests
cd ..
cd ..
-echo -e "${OUTPUT}"
-echo ""
-echo "======================================================================"
-echo "Building Debug version with vectorchecks disabled for python tests"
-echo "======================================================================"
-echo -e "${NC}"
-
-if [ ! -d build-debug-$BUILDPATH ]; then
- mkdir build-debug-$BUILDPATH
-fi
-
-cd build-debug-$BUILDPATH
-
-cmake -DCMAKE_BUILD_TYPE=DEBUG -DOPENMESH_BUILD_PYTHON_UNIT_TESTS=ON -DBUILD_APPS=OFF $OPTIONS ../
-
-#build it
-make
-
-echo -e "${OUTPUT}"
-echo ""
-echo "======================================================================"
-echo "Running Python unittests Debug version "
-echo "======================================================================"
-echo -e "${NC}"
-
-if [ "$LANGUAGE" == "C++11" ]; then
-
- # Execute Python unittests
- cd Python-Unittests
-
- rm -f openmesh.so
- cp ../Build/python/openmesh.so .
- python -m unittest discover -v
-
- cd ..
-
-else
-
- echo -e "${WARNING}"
- echo "WARNING! Python unittests disabled for clang on Mac with c++98 !!"
- echo -e "${NC}"
-
-fi
-
-cd ..
-
echo -e "${OUTPUT}"
echo ""
echo "======================================================================"
@@ -219,10 +126,15 @@ echo "Package creation (DMG and tarball)"
echo "======================================================================"
echo -e "${NC}"
+
+if [ ! -d build-release-$BUILDPATH ]; then
+ mkdir build-release-$BUILDPATH
+fi
+
cd build-release-$BUILDPATH
-cp ../build-debug-$BUILDPATH/Build/lib/* ./Build/lib/
-cmake .
+
+cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_APPS=OFF -DCPACK_BINARY_DRAGNDROP=ON $OPTIONS ../
+
+#build it
+make
make package
-
-
-
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3ff533be..47e75aca 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -129,12 +129,6 @@ endif()
add_subdirectory (Doc)
-# ========================================================================
-# Include Python interface
-# ========================================================================
-
-add_subdirectory (src/Python)
-
# ========================================================================
# Bundle generation (Targets exist, now configure them)
# ========================================================================
diff --git a/Doc/Examples/python_tutorial.py b/Doc/Examples/python_tutorial.py
deleted file mode 100644
index c43420cf..00000000
--- a/Doc/Examples/python_tutorial.py
+++ /dev/null
@@ -1,158 +0,0 @@
-##################################################
-# Getting Started
-##################################################
-
-from openmesh import *
-
-mesh = TriMesh()
-
-
-##################################################
-# Adding Items to a Mesh
-##################################################
-
-# add a a couple of vertices to the mesh
-vh0 = mesh.add_vertex(TriMesh.Point(0, 1, 0))
-vh1 = mesh.add_vertex(TriMesh.Point(1, 0, 0))
-vh2 = mesh.add_vertex(TriMesh.Point(2, 1, 0))
-vh3 = mesh.add_vertex(TriMesh.Point(0,-1, 0))
-vh4 = mesh.add_vertex(TriMesh.Point(2,-1, 0))
-
-# add a couple of faces to the mesh
-fh0 = mesh.add_face(vh0, vh1, vh2)
-fh1 = mesh.add_face(vh1, vh3, vh4)
-fh2 = mesh.add_face(vh0, vh3, vh1)
-
-# add another face to the mesh, this time using a list
-vh_list = [vh2, vh1, vh4]
-fh3 = mesh.add_face(vh_list)
-
-# 0 ==== 2
-# |\ 0 /|
-# | \ / |
-# |2 1 3|
-# | / \ |
-# |/ 1 \|
-# 3 ==== 4
-
-
-##################################################
-# Iterators
-##################################################
-
-# iterate over all vertices
-for vh in mesh.vertices():
- print vh.idx()
-
-# iterate over all halfedges
-for heh in mesh.halfedges():
- print heh.idx()
-
-# iterate over all edges
-for eh in mesh.edges():
- print eh.idx()
-
-# iterate over all faces
-for fh in mesh.faces():
- print fh.idx()
-
-
-##################################################
-# Circulators
-##################################################
-
-# iterate over all neighboring vertices
-for vh in mesh.vv(vh1):
- print vh.idx()
-
-# iterate over all incoming halfedges
-for heh in mesh.vih(vh1):
- print heh.idx()
-
-# iterate over all outgoing halfedges
-for heh in mesh.voh(vh1):
- print heh.idx()
-
-# iterate over all adjacent edges
-for eh in mesh.ve(vh1):
- print eh.idx()
-
-# iterate over all adjacent faces
-for fh in mesh.vf(vh1):
- print fh.idx()
-
-# iterate over the face's vertices
-for vh in mesh.fv(fh0):
- print vh.idx()
-
-# iterate over the face's halfedges
-for heh in mesh.fh(fh0):
- print heh.idx()
-
-# iterate over the face's edges
-for eh in mesh.fe(fh0):
- print eh.idx()
-
-# iterate over all edge-neighboring faces
-for fh in mesh.ff(fh0):
- print fh.idx()
-
-
-##################################################
-# Properties
-##################################################
-
-prop_handle = VPropHandle()
-mesh.add_property(prop_handle, "cogs")
-
-for vh in mesh.vertices():
- cog = TriMesh.Point(0,0,0)
- valence = 0
- for neighbor in mesh.vv(vh):
- cog += mesh.point(neighbor)
- valence += 1
- mesh.set_property(prop_handle, vh, cog / valence)
-
-mesh.remove_property(prop_handle)
-
-
-##################################################
-# Property Managers
-##################################################
-
-prop_man = VPropertyManager(mesh, "cogs")
-
-prop_man.set_range(mesh.vertices(), TriMesh.Point(0,0,0))
-
-for vh in mesh.vertices():
- valence = 0
- for neighbor in mesh.vv(vh):
- prop_man[vh] += mesh.point(neighbor)
- valence += 1
- prop_man[vh] /= valence
-
-
-##################################################
-# I/O
-##################################################
-
-mesh = TriMesh()
-
-read_mesh(mesh, "bunny.obj")
-# modify mesh ...
-write_mesh(mesh, "bunny.obj")
-
-
-mesh = TriMesh()
-mesh.request_halfedge_normals()
-mesh.request_vertex_normals()
-
-options = Options()
-options += Options.VertexNormal
-
-result = read_mesh(mesh, "bunny.obj", options)
-
-if result:
- print "everything worked"
-else:
- print "something went wrong"
diff --git a/Doc/changelog.docu b/Doc/changelog.docu
index d3021a7a..87d79dc8 100644
--- a/Doc/changelog.docu
+++ b/Doc/changelog.docu
@@ -11,6 +11,7 @@
Breaking changes
The minimal standard for C++ has been raised to C++11. Compilers not supporting C++11 or higher are no longer supported
+
Removed the python bindings from this project. They have migrated to a seperate project.
Core
diff --git a/Doc/mainpage.docu b/Doc/mainpage.docu
index ad8fa8e9..75d4663c 100644
--- a/Doc/mainpage.docu
+++ b/Doc/mainpage.docu
@@ -87,14 +87,6 @@ repeatedly replacing each vertex' position by the center of gravity
-\section python_and_om OpenMesh Python interface
-OpenMesh itself is written in C++. We also provide a python interface
-to use OpenMesh. A detailed description of the interface can be found
-in the following tutorial:
-\li \subpage python_tutorial
-
-
-
\subpage additional_information
\li \ref mesh_first_to_read
diff --git a/Doc/python_tutorial.docu b/Doc/python_tutorial.docu
deleted file mode 100644
index 8649d4f9..00000000
--- a/Doc/python_tutorial.docu
+++ /dev/null
@@ -1,288 +0,0 @@
-/** \page python_tutorial Python Tutorial
-
-This tutorial will introduce the basic concepts behind the %OpenMesh Python
-Bindings. We will cover the following topics:
-
-\li How to build the Python Bindings
-\li How to create an empty mesh
-\li How to add vertices and faces to a mesh
-\li How to navigate on a mesh using iterators and circulators
-\li How to add and remove custom properties
-\li How to read and write meshes from files
-
-In addition, we will briefly discuss some of the differences between the Python
-Bindings and the original C++ implementation of %OpenMesh.
-
-
-
-\section python_build Building the Python Bindings
-
-The Python Bindings depend on the following libraries:
-
-\li Python (2.7 or later)
-\li Boost Python (1.54.0 or later)
-
-\note Make sure that your Boost Python and Python versions match, i.e. that
-Boost Python was linked against the correct Python version.
-
-The Python Bindings are automatically built with %OpenMesh. The generated files are written to the
-Build/python subdirectory of the build tree. For more information on how to build %OpenMesh see
-\ref compiling.
-
-If CMake does not find your Python installation (or finds the wrong one) you can
-explicitly specify an installation by setting the following variables:
-
-\verbatim
-PYTHON_LIBRARY - Path to the python library
-PYTHON_INCLUDE_DIR - Path to where Python.h is found
-\endverbatim
-
-Similarly, if CMake does not find your Boost Python installation, set the
-following variables:
-
-\verbatim
-BOOST_ROOT - Preferred installation prefix
-BOOST_INCLUDEDIR - Preferred include directory e.g. /include
-BOOST_LIBRARYDIR - Preferred library directory e.g. /lib
-\endverbatim
-
-
-
-\section python_start Getting Started
-
-To use the %OpenMesh Python Bindings we first need to import the openmesh module:
-
-\dontinclude python_tutorial.py
-\skipline from
-
-The module provides two mesh classes: One for polygonal meshes (PolyMesh) and
-one for triangle meshes (TriMesh). You should use triangle meshes whenever
-possible, since they are usually more efficient. In addition, some algorithms
-are only implemented for triangle meshes while triangle meshes inherit the full
-functionality of polygonal meshes.
-
-The following code creates a new triangle mesh:
-
-\skipline mesh
-
-
-
-\section python_add Adding Items to a Mesh
-
-We can add a new vertex to the mesh by calling the add_vertex() member function.
-This function gets a coordinate and returns a handle to the newly inserted
-vertex.
-
-\skipline vh0
-\until vh4
-
-To add a new face to the mesh we have to call add_face(). This function gets the
-handles of the vertices that make up the new face and returns a handle to the
-newly inserted face:
-
-\skipline fh0
-\until fh2
-
-We can also use a Python list to add a face to the mesh:
-
-\skipline vh_list
-\until fh3
-
-
-
-\section python_iterators Iterators and Circulators
-
-Now that we have added a couple of vertices to the mesh, we can iterate over
-them and print out their indices:
-
-\skipline for
-\until vh.idx()
-
-We can also iterate over halfedges, edges and faces by calling mesh.halfedges(),
-mesh.edges() and mesh.faces() respectively:
-
-\skipline iterate
-\until fh.idx()
-
-To iterate over the items adjacent to another item we can use one of the
-circulator functions. For example, to iterate over the vertices adjacent to
-another vertex we can call mesh.vv() and pass the handle of the center vertex:
-
-\skipline for
-\until vh.idx()
-
-We can also iterate over the adjacent halfedges, edges and faces:
-
-\skipline iterate
-\until fh.idx()
-
-To iterate over the items adjacent to a face we can use the following functions:
-
-\skipline iterate
-\until fh.idx()
-
-
-
-\section python_props Properties
-
-%OpenMesh allows us to dynamically add custom properties to a mesh. We can add
-properties to vertices, halfedges, edges, faces and the mesh itself. To
-add a property to a mesh (and later access its value) we have to use a property
-handle of the appropriate type:
-
-\li VPropHandle (for vertex properties)
-\li HPropHandle (for halfedge properties)
-\li EPropHandle (for edge properties)
-\li FPropHandle (for face properties)
-\li MPropHandle (for mesh properties)
-
-The following code shows how to add a vertex property to a mesh:
-
-\skipline prop_handle
-\until mesh
-
-The second parameter of the function add_property() is optional. The parameter
-is used to specify a name for the new property. This name can later be used
-to retrieve a handle to the property using the get_property_handle() member
-function.
-
-Now that we have added a vertex property to the mesh we can set and get its
-value. Here we will use the property to store the center of gravity of each
-vertex' neighborhood:
-
-\skipline for
-\until mesh.set_property
-
-Properties use Python's type system. This means that we can use the same
-property to store values of different types (e.g. store both strings and
-integers using the same vertex property). Properties are initialized to the
-Python built-in constant None.
-
-To remove a property we have to call remove_property() with the appropriate
-property handle:
-
-\skipline mesh.remove_property
-
-
-
-\section python_propman Property Managers
-
-Another way to add and remove a property is to use a property manager. A
-Property manager encapsulates a property and manages its lifecycle. A Property
-manager also provides a number of convenience functions to access the enclosed
-property.
-
-There are four different types of property managers. One for each type of mesh
-item:
-
-\li VPropertyManager (for vertex properties)
-\li HPropertyManager (for halfedge properties)
-\li EPropertyManager (for edge properties)
-\li FPropertyManager (for face properties)
-
-Property managers automatically add a new property to a mesh when they are
-initialized. Thus the following code not only creates a new vertex property
-manager, but also adds a new vertex property to the mesh:
-
-\skipline prop_man
-
-Property managers allow us to conveniently set the property value for an entire
-range of mesh items:
-
-\skipline prop_man
-
-They also allow us to use the subscript operator to set and get property values.
-Here we will once again use a property to store the center of gravity of each
-vertex' neighborhood:
-
-\skipline for
-\until prop_man[vh] /= valence
-
-Properties that are encapsulated by a property manager are automatically removed
-from the mesh when the property manager goes out of scope (i.e. the property
-manager is garbage collected).
-
-
-
-\section python_io Read and write meshes from files
-
-You can read and write meshes from files using the read_mesh() and write_mesh()
-functions:
-
-\skipline mesh
-\until write_mesh(mesh, "bunny.obj")
-
-The file type is automatically deduced from the file extension. %OpenMesh
-currently supports four file types: .off, .obj, .stl and .om
-
-The behaviour of the I/O functions can be controlled by passing an instance of
-the Options class to either read_mesh() or write_mesh(). The class controls the
-behaviour of the I/O functions by means of enabled/disabled bits in a bitset:
-
-\skipline mesh
-\until print "something went wrong"
-
-Other available option bits include:
-
--# mode bits - control binary reading/writing
- - Options.Binary
- - Options.MSB
- - Options.LSB
- - Options.Swap (MSB|LSB)
--# property bits - controls which standard properties to read/write
- - Options.VertexNormal
- - Options.VertexTexCoord
- - Options.VertexColor
- - Options.FaceNormal
- - Options.FaceColor
- - Options.ColorAlpha
- - Options.ColorFloat
-
-\note You have to pass an instance of the Options class to the I/O functions,
-i.e. you cannot directly pass one of the option bits. For example, directly
-passing Options.Binary to either one of the functions will cause an error.
-
-When reading a file the options are used as hints, i.e. depending on the format
-we can help the reader to interpret the data correctly.
-
-\note If you want to read a property from a file the property must have been
-requested prior to reading the file.
-
-When writing the mesh the mode bits control whether to use the binary variant of
-the respective file format and the desired byte-ordering.
-
-
-
-\section python_examples Additional Code Examples
-
-You can use our unit tests to learn more about the %OpenMesh Python Bindings.
-They are located in the src/Python/Unittests subdirectory.
-
-
-
-\section python_cpp Python and C++
-
-The interface of the Python Bindings is to a large extent identical to the
-interface of the original C++ implementation of %OpenMesh. You should therefore
-be able to use the C++ documentation as a reference for the Python Bindings. In
-particular, the classes KernelT, PolyMeshT and TriMeshT provide a good overview
-of the available mesh member functions. That being said, there are a number of
-small differences. For example, whenever the C++ implementation returns a
-reference to an object that is managed by %OpenMesh, the Python Bindings will
-return a copy of that object. This is due to the fact that Python does not have
-a language feature that is analogous to C++ references. One example of such a
-function is the point() member function of the PolyMesh and TriMesh classes.
-Unlike its C++ counterpart, the function does not return a reference to the
-requested point. It instead returns a copy of the point. This implies that you
-have to use the set_point() member function to change the value of a point. The
-same applies to the following functions: normal(), color(), property(),
-status(), etc.
-
-
-
- The complete source looks like this:
-
-\include python_tutorial.py
-
-
-**/
diff --git a/README.md b/README.md
index d8a82b67..657df304 100644
--- a/README.md
+++ b/README.md
@@ -10,6 +10,9 @@ https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh.git
The gitlab site can be found here:
https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh
+The python bindings can be found here:
+https://www.graphics.rwth-aachen.de:9000/OpenMesh/openmesh-python
+
## Installing
Unpack the tar-ball to a suitable place.
diff --git a/src/Python/Bindings.cc b/src/Python/Bindings.cc
deleted file mode 100644
index 61acd6f4..00000000
--- a/src/Python/Bindings.cc
+++ /dev/null
@@ -1,152 +0,0 @@
-#include "Python/Bindings.hh"
-#include "Python/Vector.hh"
-#include "Python/Mesh.hh"
-#include "Python/PropertyManager.hh"
-#include "Python/InputOutput.hh"
-#include "Python/Decimater.hh"
-
-#include
-
-namespace OpenMesh {
-namespace Python {
-
-/**
- * Expose mesh items to %Python.
- */
-void expose_items() {
- class_("Vertex");
- class_("Halfedge");
- class_("Edge");
- class_("Face");
-}
-
-/**
- * Expose item and property handles to %Python.
- */
-void expose_handles() {
- class_("BaseHandle", init >())
- .def("idx", &BaseHandle::idx)
- .def("is_valid", &BaseHandle::is_valid)
- .def("reset", &BaseHandle::reset)
- .def("invalidate", &BaseHandle::invalidate)
- .def(self == self)
- .def(self != self)
- .def(self < self)
- ;
-
- class_ >("VertexHandle", init >());
- class_ >("HalfedgeHandle", init >());
- class_ >("EdgeHandle", init >());
- class_ >("FaceHandle", init >());
-
- class_, bases >("BasePropHandle", init >());
-
- class_, bases > >("VPropHandle", init >())
- .def(init&>());
- class_, bases > >("HPropHandle", init >())
- .def(init&>());
- class_, bases > >("EPropHandle", init >())
- .def(init&>());
- class_, bases > >("FPropHandle", init >())
- .def(init&>());
- class_, bases > >("MPropHandle", init >())
- .def(init&>());
-}
-
-
-/**
- * Expose the StatusBits enum and StatusInfo class to %Python.
- */
-void expose_status_bits_and_info() {
- using OpenMesh::Attributes::StatusBits;
- using OpenMesh::Attributes::StatusInfo;
-
- enum_("StatusBits")
- .value("DELETED", OpenMesh::Attributes::DELETED)
- .value("LOCKED", OpenMesh::Attributes::LOCKED)
- .value("SELECTED", OpenMesh::Attributes::SELECTED)
- .value("HIDDEN", OpenMesh::Attributes::HIDDEN)
- .value("FEATURE", OpenMesh::Attributes::FEATURE)
- .value("TAGGED", OpenMesh::Attributes::TAGGED)
- .value("TAGGED2", OpenMesh::Attributes::TAGGED2)
- .value("FIXEDNONMANIFOLD", OpenMesh::Attributes::FIXEDNONMANIFOLD)
- .value("UNUSED", OpenMesh::Attributes::UNUSED)
- ;
-
- class_("StatusInfo")
- .def("deleted", &StatusInfo::deleted)
- .def("set_deleted", &StatusInfo::set_deleted)
- .def("locked", &StatusInfo::locked)
- .def("set_locked", &StatusInfo::set_locked)
- .def("selected", &StatusInfo::selected)
- .def("set_selected", &StatusInfo::set_selected)
- .def("hidden", &StatusInfo::hidden)
- .def("set_hidden", &StatusInfo::set_hidden)
- .def("feature", &StatusInfo::feature)
- .def("set_feature", &StatusInfo::set_feature)
- .def("tagged", &StatusInfo::tagged)
- .def("set_tagged", &StatusInfo::set_tagged)
- .def("tagged2", &StatusInfo::tagged2)
- .def("set_tagged2", &StatusInfo::set_tagged2)
- .def("fixed_nonmanifold", &StatusInfo::fixed_nonmanifold)
- .def("set_fixed_nonmanifold", &StatusInfo::set_fixed_nonmanifold)
- .def("bits", &StatusInfo::bits)
- .def("set_bits", &StatusInfo::set_bits)
- .def("is_bit_set", &StatusInfo::is_bit_set)
- .def("set_bit", &StatusInfo::set_bit)
- .def("unset_bit", &StatusInfo::unset_bit)
- .def("change_bit", &StatusInfo::change_bit)
- ;
-}
-
-BOOST_PYTHON_MODULE(openmesh) {
- expose_items();
- expose_handles();
- expose_status_bits_and_info();
-
- expose_vec("Vec2f");
- expose_vec("Vec3f");
- expose_vec("Vec4f");
- expose_vec("Vec2d");
- expose_vec("Vec3d");
- expose_vec("Vec4d");
-
- expose_mesh("PolyMesh");
- expose_mesh("TriMesh");
-
- expose_iterator("VertexIter");
- expose_iterator("HalfedgeIter");
- expose_iterator("EdgeIter");
- expose_iterator("FaceIter");
-
- expose_circulator("VertexVertexIter");
- expose_circulator("VertexIHalfedgeIter");
- expose_circulator("VertexOHalfedgeIter");
- expose_circulator("VertexEdgeIter");
- expose_circulator("VertexFaceIter");
-
- expose_circulator("FaceVertexIter");
- expose_circulator("FaceHalfedgeIter");
- expose_circulator("FaceEdgeIter");
- expose_circulator("FaceFaceIter");
-
- expose_circulator("HalfedgeLoopIter");
-
- typedef IteratorWrapperT VertexIterWrapper;
- typedef IteratorWrapperT HalfedgeIterWrapper;
- typedef IteratorWrapperT EdgeIterWrapper;
- typedef IteratorWrapperT FaceIterWrapper;
-
- expose_property_manager, VertexHandle, VertexIterWrapper>("VPropertyManager");
- expose_property_manager, HalfedgeHandle, HalfedgeIterWrapper>("HPropertyManager");
- expose_property_manager, EdgeHandle, EdgeIterWrapper>("EPropertyManager");
- expose_property_manager, FaceHandle, FaceIterWrapper>("FPropertyManager");
-
- expose_io();
-
- expose_decimater("PolyMesh");
- expose_decimater("TriMesh");
-}
-
-} // namespace Python
-} // namespace OpenMesh
diff --git a/src/Python/Bindings.hh b/src/Python/Bindings.hh
deleted file mode 100644
index 0d37cf5c..00000000
--- a/src/Python/Bindings.hh
+++ /dev/null
@@ -1,48 +0,0 @@
-/** @file */
-
-#ifndef OPENMESH_PYTHON_BINDINGS_HH
-#define OPENMESH_PYTHON_BINDINGS_HH
-
-#include
-#include
-#include
-#include
-
-#include "OpenMesh/Core/IO/MeshIO.hh"
-#include "OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh"
-#include "OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh"
-
-using namespace boost::python;
-
-namespace OpenMesh {
-
-/**
- * This namespace contains classes and functions that are used to expose
- * %OpenMesh to %Python.
- */
-namespace Python {
-
-/**
- * Return value policy for functions that return references to objects that are
- * managed by %OpenMesh.
- */
-#define OPENMESH_PYTHON_DEFAULT_POLICY return_value_policy()
-
-struct MeshTraits : public OpenMesh::DefaultTraits {
- /** Use double precision points */
- typedef OpenMesh::Vec3d Point;
-
- /** Use double precision normals */
- typedef OpenMesh::Vec3d Normal;
-
- /** Use RGBA colors */
- typedef OpenMesh::Vec4f Color;
-};
-
-typedef OpenMesh::TriMesh_ArrayKernelT TriMesh;
-typedef OpenMesh::PolyMesh_ArrayKernelT PolyMesh;
-
-} // namespace OpenMesh
-} // namespace Python
-
-#endif
diff --git a/src/Python/CMakeLists.txt b/src/Python/CMakeLists.txt
deleted file mode 100644
index cafb785b..00000000
--- a/src/Python/CMakeLists.txt
+++ /dev/null
@@ -1,215 +0,0 @@
-IF(NOT DEFINED OPENMESH_BUILD_PYTHON_BINDINGS)
- SET(OPENMESH_BUILD_PYTHON_BINDINGS TRUE CACHE BOOL "Enable or disable building the Python Bindings.")
-ENDIF()
-
-IF(NOT DEFINED OPENMESH_BUILD_PYTHON_UNIT_TESTS)
- SET(OPENMESH_BUILD_PYTHON_UNIT_TESTS FALSE CACHE BOOL "Enable or disable building the Python unit tests.")
-ENDIF()
-
-IF(NOT DEFINED OPENMESH_PYTHON_VERSION)
- SET(OPENMESH_PYTHON_VERSION "2.7" CACHE STRING "Choose the Python version that is used to build the Python Bindings.")
-ENDIF()
-
-IF(OPENMESH_BUILD_PYTHON_BINDINGS)
- # Create log file
- SET(PYTHONLOG "${CMAKE_CURRENT_BINARY_DIR}/PythonLog.txt")
- FILE(WRITE ${PYTHONLOG} "")
-
- # Look for the python libs
- MESSAGE(STATUS "Looking for PythonLibs")
- FIND_PACKAGE(PythonLibs ${OPENMESH_PYTHON_VERSION} QUIET)
-
- IF(PYTHONLIBS_FOUND)
- MESSAGE(STATUS "Looking for PythonLibs -- found")
-
- # Determine the name of the python component
- STRING(REGEX MATCH "^[0-9]+\\.[0-9]+" PYTHON_VERSION_MAJOR_MINOR ${PYTHONLIBS_VERSION_STRING})
- STRING(REGEX REPLACE "\\." "" PYTHON_VERSION_MAJOR_MINOR ${PYTHON_VERSION_MAJOR_MINOR})
- STRING(REGEX MATCH "^[0-9]" PYTHON_VERSION_MAJOR ${PYTHON_VERSION_MAJOR_MINOR})
-
- MESSAGE(STATUS "Looking for Boost Python")
-
- SET(BOOST_PYTHON_COMPONENT_NAMES "python-py${PYTHON_VERSION_MAJOR_MINOR}" "python${PYTHON_VERSION_MAJOR}" "python")
-
- FOREACH(NAME ${BOOST_PYTHON_COMPONENT_NAMES})
- IF(NOT Boost_FOUND)
- FILE(APPEND ${PYTHONLOG} "Looking for component ${NAME}\n")
- FIND_PACKAGE(Boost QUIET COMPONENTS ${NAME})
- ENDIF()
- ENDFOREACH()
-
- FILE(APPEND ${PYTHONLOG} "\n")
-
- IF(Boost_FOUND)
- MESSAGE(STATUS "Looking for Boost Python -- found")
- MESSAGE(STATUS "Checking the Boost Python configuration")
-
- SET(CMAKE_TRY_COMPILE_CONFIGURATION "Release")
-
- TRY_COMPILE(
- COMPILE_WORKS
- ${CMAKE_CURRENT_BINARY_DIR}
- ${CMAKE_CURRENT_SOURCE_DIR}/Example/
- Example
- CMAKE_FLAGS
- "-DINCLUDE_DIRECTORIES:STRING=${PYTHON_INCLUDE_DIRS};${Boost_INCLUDE_DIRS}"
- "-DLINK_DIRECTORIES:STRING=${Boost_LIBRARY_DIRS}"
- "-DLINK_LIBRARIES:STRING=${PYTHON_LIBRARIES};${Boost_LIBRARIES}"
- OUTPUT_VARIABLE OUTPUT_TRY_COMPILE
- )
-
- FILE(APPEND ${PYTHONLOG} "INCLUDE_DIRECTORIES: ${PYTHON_INCLUDE_DIRS};${Boost_INCLUDE_DIRS}\n")
- FILE(APPEND ${PYTHONLOG} "LINK_DIRECTORIES: ${Boost_LIBRARY_DIRS}\n")
- FILE(APPEND ${PYTHONLOG} "LINK_LIBRARIES: ${PYTHON_LIBRARIES};${Boost_LIBRARIES}\n\n")
- FILE(APPEND ${PYTHONLOG} "${OUTPUT_TRY_COMPILE}")
-
- IF(COMPILE_WORKS)
- # Look for the python interpreter to check if the example works
-
- # strip version string of any characters (e.g. rc1 # '+') than 0-9 and .
- STRING(REGEX REPLACE "(rc[0-9]+)|[^ 0-9 | \\.]" "" PYTHONLIBS_VERSION_STRING_STRIPPED ${PYTHONLIBS_VERSION_STRING})
- FIND_PACKAGE(PythonInterp ${PYTHONLIBS_VERSION_STRING_STRIPPED} QUIET)
-
- IF(PYTHONINTERP_FOUND)
-
- IF(MSVC)
- SET(PYTHON_WORKING_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_TRY_COMPILE_CONFIGURATION}")
- ELSE()
- SET(PYTHON_WORKING_DIR "${CMAKE_CURRENT_BINARY_DIR}")
- ENDIF()
-
- EXECUTE_PROCESS(
- COMMAND ${PYTHON_EXECUTABLE} -c "from example import *; greet(); planet = World()"
- WORKING_DIRECTORY ${PYTHON_WORKING_DIR}
- RESULT_VARIABLE PYTHON_WORKS
- OUTPUT_QUIET
- ERROR_QUIET
- )
-
- IF(PYTHON_WORKS EQUAL 0)
-
- ### EVERYTHING WORKS ###
-
- MESSAGE(STATUS "Checking the Boost Python configuration -- done")
-
- IF(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" AND ${Boost_VERSION} VERSION_LESS 105600)
- MESSAGE("There are known issues with Clang and Boost Python 1.55 and below.")
- MESSAGE("Please consider updating Boost Python.")
- ENDIF()
-
- SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Build/python/)
- FILE(MAKE_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
-
- FILE(GLOB SOURCES *.cc *hh)
-
- INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ../)
- LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
-
- ADD_LIBRARY(openmesh SHARED ${SOURCES})
-
- install(TARGETS openmesh DESTINATION ${ACG_PROJECT_LIBDIR}/python )
-
- TARGET_LINK_LIBRARIES(
- openmesh
- OpenMeshCore
- OpenMeshTools
- ${Boost_LIBRARIES}
- ${PYTHON_LIBRARIES}
- )
-
- SET_TARGET_PROPERTIES(
- openmesh
- PROPERTIES
- PREFIX ""
- DEBUG_POSTFIX ""
- RELEASE_POSTFIX ""
- )
-
- IF(APPLE)
- SET_TARGET_PROPERTIES(openmesh PROPERTIES SUFFIX ".so")
- IF (NOT (CMAKE_MAJOR_VERSION LESS 3))
- SET_TARGET_PROPERTIES(openmesh PROPERTIES MACOSX_RPATH TRUE)
- ENDIF()
- ENDIF()
-
- IF(WIN32)
- SET_TARGET_PROPERTIES(openmesh PROPERTIES SUFFIX ".pyd")
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
-
- SET(OUTPUTS openmesh.exp openmesh.lib openmesh.pyd)
-
- FOREACH(FILE ${OUTPUTS})
- ADD_CUSTOM_COMMAND(
- TARGET openmesh POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy
- ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${FILE}
- ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
- )
- ENDFOREACH()
- ENDIF()
-
- IF(OPENMESH_BUILD_PYTHON_UNIT_TESTS)
- SET(UNITTEST_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Python-Unittests/)
-
- # Copy unit tests
- FILE(GLOB UNITTESTS Unittests/*.py)
- FOREACH(TEST ${UNITTESTS})
- FILE(COPY ${TEST} DESTINATION ${UNITTEST_OUTPUT_DIRECTORY})
- ENDFOREACH()
-
- # Copy test files
- FILE(GLOB TESTFILES ${PROJECT_SOURCE_DIR}/src/Unittests/TestFiles/*(.off|.obj|.mtl|.stl|.ply|.om))
- FOREACH(FILE ${TESTFILES})
- FILE(COPY ${FILE} DESTINATION ${UNITTEST_OUTPUT_DIRECTORY})
- ENDFOREACH()
-
- # Copy library
- IF(WIN32)
- FOREACH(FILE ${OUTPUTS})
- ADD_CUSTOM_COMMAND(
- TARGET openmesh POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy
- ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${FILE}
- ${UNITTEST_OUTPUT_DIRECTORY}
- )
- ENDFOREACH()
- ELSE()
- ADD_CUSTOM_COMMAND(
- TARGET openmesh POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy
- ${CMAKE_BINARY_DIR}/Build/python/openmesh.so
- ${UNITTEST_OUTPUT_DIRECTORY}
- )
- ENDIF()
-
- ADD_TEST(
- NAME Python_tests
- WORKING_DIRECTORY ${UNITTEST_OUTPUT_DIRECTORY}
- COMMAND ${PYTHON_EXECUTABLE} -m unittest discover --verbose
- )
- ENDIF()
-
- ELSE()
- MESSAGE("Checking the Boost Python configuration failed!")
- MESSAGE("Reason: An error occurred while running a small Boost Python test project.")
- MESSAGE("Make sure that your Python and Boost Python libraries match.")
- MESSAGE("Skipping Python Bindings.")
- ENDIF()
- ELSE()
- MESSAGE("Checking the Boost Python configuration failed!")
- MESSAGE("Reason: Python Interpreter ${PYTHONLIBS_VERSION_STRING} not found.")
- MESSAGE("Skipping Python Bindings.")
- ENDIF()
- ELSE()
- MESSAGE("Checking the Boost Python configuration failed!")
- MESSAGE("Reason: Building a small Boost Python test project failed.")
- MESSAGE("Make sure that your Python and Boost Python libraries match.")
- MESSAGE("Skipping Python Bindings.")
- ENDIF()
- ELSE()
- MESSAGE("Boost Python not found! Skipping Python Bindings.")
- ENDIF()
- ELSE()
- MESSAGE("PythonLibs not found! Skipping Python Bindings.")
- ENDIF()
-ENDIF()
diff --git a/src/Python/Circulator.hh b/src/Python/Circulator.hh
deleted file mode 100644
index 5a11e4e2..00000000
--- a/src/Python/Circulator.hh
+++ /dev/null
@@ -1,98 +0,0 @@
-#ifndef OPENMESH_PYTHON_CIRCULATOR_HH
-#define OPENMESH_PYTHON_CIRCULATOR_HH
-
-#include "Python/Bindings.hh"
-
-namespace OpenMesh {
-namespace Python {
-
-/**
- * Wrapper for circulators.
- *
- * This class template is used to wrap circulators for %Python. It implements
- * %Python's iterator protocol (the magic methods \_\_iter\_\_ and
- * \_\_next\_\_).
- *
- * @tparam Circulator A circulator type.
- */
-template
-class CirculatorWrapperT {
- public:
-
- /**
- * Constructor
- *
- * @param _mesh The mesh that contains the items to iterate over.
- * @param _center The handle to the center item.
- */
- CirculatorWrapperT(PolyMesh& _mesh, CenterEntityHandle _center) :
- circulator_(_mesh, _center) {
- }
-
- /**
- * Constructor
- *
- * @param _mesh The mesh that contains the items to iterate over.
- * @param _center The handle to the center item.
- */
- CirculatorWrapperT(TriMesh& _mesh, CenterEntityHandle _center) :
- circulator_(_mesh, _center) {
- }
-
- /**
- * Implementation of %Python's \_\_iter\_\_ magic method.
- *
- * @return This circulator.
- */
- CirculatorWrapperT iter() const {
- return *this;
- }
-
- /**
- * Implementation of %Python's \_\_next\_\_ magic method.
- *
- * @return The next item. Raises a %Python StopIteration exception if
- * there are no more items.
- */
- typename Circulator::value_type next() {
- if (circulator_.is_valid()) {
- typename Circulator::value_type res = *circulator_;
- ++circulator_;
- return res;
- }
- else {
- PyErr_SetString(PyExc_StopIteration, "No more data.");
- boost::python::throw_error_already_set();
- }
- return typename Circulator::value_type();
- }
-
- private:
- Circulator circulator_;
-};
-
-/**
- * Expose a circulator type to %Python.
- *
- * @tparam Circulator A circulator type.
- *
- * @param _name The name of the circulator type to be exposed.
- *
- * @note Circulators are wrapped by CirculatorWrapperT before they are exposed
- * to %Python, i.e. they are not exposed directly. This means that circulators
- * that are passed from %Python to C++ are instances of CirculatorWrapperT.
- */
-template
-void expose_circulator(const char *_name) {
- class_ >(_name, init())
- .def(init())
- .def("__iter__", &CirculatorWrapperT::iter)
- .def("__next__", &CirculatorWrapperT::next)
- .def("next", &CirculatorWrapperT::next)
- ;
-}
-
-} // namespace OpenMesh
-} // namespace Python
-
-#endif
diff --git a/src/Python/Decimater.hh b/src/Python/Decimater.hh
deleted file mode 100644
index c0825231..00000000
--- a/src/Python/Decimater.hh
+++ /dev/null
@@ -1,297 +0,0 @@
-#ifndef OPENMESH_PYTHON_DECIMATER_HH
-#define OPENMESH_PYTHON_DECIMATER_HH
-
-#include "Python/Bindings.hh"
-#include "OpenMesh/Tools/Decimater/ModBaseT.hh"
-#include "OpenMesh/Tools/Decimater/ModAspectRatioT.hh"
-#include "OpenMesh/Tools/Decimater/ModEdgeLengthT.hh"
-#include "OpenMesh/Tools/Decimater/ModHausdorffT.hh"
-#include "OpenMesh/Tools/Decimater/ModIndependentSetsT.hh"
-#include "OpenMesh/Tools/Decimater/ModNormalDeviationT.hh"
-#include "OpenMesh/Tools/Decimater/ModNormalFlippingT.hh"
-#include "OpenMesh/Tools/Decimater/ModProgMeshT.hh"
-#include "OpenMesh/Tools/Decimater/ModQuadricT.hh"
-#include "OpenMesh/Tools/Decimater/ModRoundnessT.hh"
-#include "OpenMesh/Tools/Decimater/DecimaterT.hh"
-
-#include
-
-namespace OpenMesh {
-namespace Python {
-
-#define INIT_MESH_REF init()[with_custodian_and_ward<1,2>()]
-
-BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(decimate_overloads, decimate, 0, 1)
-BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(decimate_to_faces_overloads, decimate_to_faces, 0, 2)
-BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(set_max_err_overloads, set_max_err, 1, 2)
-BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(set_min_roundness_overloads, set_min_roundness, 1, 2)
-
-
-template
-void expose_module_handle(const char *_name) {
- class_(_name)
- .def("is_valid", &Handle::is_valid)
- ;
-}
-
-template
-list infolist(Module& _self) {
- const typename Module::InfoList& infos = _self.infolist();
- list res;
- for (size_t i = 0; i < infos.size(); ++i) {
- res.append(infos[i]);
- }
- return res;
-}
-
-template
-void expose_decimater(const char *_name) {
-
- typedef Decimater::ModBaseT ModBase;
- typedef Decimater::ModAspectRatioT ModAspectRatio;
- typedef Decimater::ModEdgeLengthT ModEdgeLength;
- typedef Decimater::ModHausdorffT ModHausdorff;
- typedef Decimater::ModIndependentSetsT ModIndependentSets;
- typedef Decimater::ModNormalDeviationT ModNormalDeviation;
- typedef Decimater::ModNormalFlippingT ModNormalFlipping;
- typedef Decimater::ModProgMeshT ModProgMesh;
- typedef Decimater::ModQuadricT ModQuadric;
- typedef Decimater::ModRoundnessT ModRoundness;
-
- typedef Decimater::ModHandleT ModAspectRatioHandle;
- typedef Decimater::ModHandleT ModEdgeLengthHandle;
- typedef Decimater::ModHandleT ModHausdorffHandle;
- typedef Decimater::ModHandleT ModIndependentSetsHandle;
- typedef Decimater::ModHandleT ModNormalDeviationHandle;
- typedef Decimater::ModHandleT ModNormalFlippingHandle;
- typedef Decimater::ModHandleT ModProgMeshHandle;
- typedef Decimater::ModHandleT ModQuadricHandle;
- typedef Decimater::ModHandleT ModRoundnessHandle;
-
- typedef Decimater::BaseDecimaterT BaseDecimater;
- typedef Decimater::DecimaterT Decimater;
-
- typedef typename ModProgMesh::Info Info;
- typedef std::vector InfoList;
-
- bool (BaseDecimater::*add1)(ModAspectRatioHandle&) = &Decimater::add;
- bool (BaseDecimater::*add2)(ModEdgeLengthHandle&) = &Decimater::add;
- bool (BaseDecimater::*add3)(ModHausdorffHandle&) = &Decimater::add;
- bool (BaseDecimater::*add4)(ModIndependentSetsHandle&) = &Decimater::add;
- bool (BaseDecimater::*add5)(ModNormalDeviationHandle&) = &Decimater::add;
- bool (BaseDecimater::*add6)(ModNormalFlippingHandle&) = &Decimater::add;
- bool (BaseDecimater::*add7)(ModProgMeshHandle&) = &Decimater::add;
- bool (BaseDecimater::*add8)(ModQuadricHandle&) = &Decimater::add;
- bool (BaseDecimater::*add9)(ModRoundnessHandle&) = &Decimater::add;
-
- bool (BaseDecimater::*remove1)(ModAspectRatioHandle&) = &Decimater::remove;
- bool (BaseDecimater::*remove2)(ModEdgeLengthHandle&) = &Decimater::remove;
- bool (BaseDecimater::*remove3)(ModHausdorffHandle&) = &Decimater::remove;
- bool (BaseDecimater::*remove4)(ModIndependentSetsHandle&) = &Decimater::remove;
- bool (BaseDecimater::*remove5)(ModNormalDeviationHandle&) = &Decimater::remove;
- bool (BaseDecimater::*remove6)(ModNormalFlippingHandle&) = &Decimater::remove;
- bool (BaseDecimater::*remove7)(ModProgMeshHandle&) = &Decimater::remove;
- bool (BaseDecimater::*remove8)(ModQuadricHandle&) = &Decimater::remove;
- bool (BaseDecimater::*remove9)(ModRoundnessHandle&) = &Decimater::remove;
-
- ModAspectRatio& (BaseDecimater::*module1)(ModAspectRatioHandle&) = &Decimater::module;
- ModEdgeLength& (BaseDecimater::*module2)(ModEdgeLengthHandle&) = &Decimater::module;
- ModHausdorff& (BaseDecimater::*module3)(ModHausdorffHandle&) = &Decimater::module;
- ModIndependentSets& (BaseDecimater::*module4)(ModIndependentSetsHandle&) = &Decimater::module;
- ModNormalDeviation& (BaseDecimater::*module5)(ModNormalDeviationHandle&) = &Decimater::module;
- ModNormalFlipping& (BaseDecimater::*module6)(ModNormalFlippingHandle&) = &Decimater::module;
- ModProgMesh& (BaseDecimater::*module7)(ModProgMeshHandle&) = &Decimater::module;
- ModQuadric& (BaseDecimater::*module8)(ModQuadricHandle&) = &Decimater::module;
- ModRoundness& (BaseDecimater::*module9)(ModRoundnessHandle&) = &Decimater::module;
-
- // Decimater
- // ----------------------------------------
-
- char buffer[64];
- snprintf(buffer, sizeof buffer, "%s%s", _name, "Decimater");
-
- class_(buffer, INIT_MESH_REF)
- .def("decimate", &Decimater::decimate, decimate_overloads())
- .def("decimate_to", &Decimater::decimate_to)
- .def("decimate_to_faces", &Decimater::decimate_to_faces, decimate_to_faces_overloads())
-
- .def("initialize", &Decimater::initialize)
- .def("is_initialized", &Decimater::is_initialized)
-
- .def("add", add1)
- .def("add", add2)
- .def("add", add3)
- .def("add", add4)
- .def("add", add5)
- .def("add", add6)
- .def("add", add7)
- .def("add", add8)
- .def("add", add9)
-
- .def("remove", remove1)
- .def("remove", remove2)
- .def("remove", remove3)
- .def("remove", remove4)
- .def("remove", remove5)
- .def("remove", remove6)
- .def("remove", remove7)
- .def("remove", remove8)
- .def("remove", remove9)
-
- .def("module", module1, return_value_policy())
- .def("module", module2, return_value_policy())
- .def("module", module3, return_value_policy())
- .def("module", module4, return_value_policy())
- .def("module", module5, return_value_policy())
- .def("module", module6, return_value_policy())
- .def("module", module7, return_value_policy())
- .def("module", module8, return_value_policy())
- .def("module", module9, return_value_policy())
- ;
-
- // ModBase
- // ----------------------------------------
-
- snprintf(buffer, sizeof buffer, "%s%s", _name, "ModBase");
-
- class_(buffer, no_init)
- .def("name", &ModBase::name, OPENMESH_PYTHON_DEFAULT_POLICY)
- .def("is_binary", &ModBase::is_binary)
- .def("set_binary", &ModBase::set_binary)
- .def("initialize", &ModBase::initialize) // TODO VIRTUAL
- .def("collapse_priority", &ModBase::collapse_priority) // TODO VIRTUAL
- .def("preprocess_collapse", &ModBase::preprocess_collapse) // TODO VIRTUAL
- .def("postprocess_collapse", &ModBase::postprocess_collapse) // TODO VIRTUAL
- .def("set_error_tolerance_factor", &ModBase::set_error_tolerance_factor) // TODO VIRTUAL
- ;
-
- // ModAspectRatio
- // ----------------------------------------
-
- snprintf(buffer, sizeof buffer, "%s%s", _name, "ModAspectRatio");
-
- class_, boost::noncopyable>(buffer, INIT_MESH_REF)
- .def("aspect_ratio", &ModAspectRatio::aspect_ratio)
- .def("set_aspect_ratio", &ModAspectRatio::set_aspect_ratio)
- ;
-
- snprintf(buffer, sizeof buffer, "%s%s", _name, "ModAspectRatioHandle");
- expose_module_handle(buffer);
-
- // ModEdgeLength
- // ----------------------------------------
-
- snprintf(buffer, sizeof buffer, "%s%s", _name, "ModEdgeLength");
-
- class_, boost::noncopyable>(buffer, INIT_MESH_REF)
- .def("edge_length", &ModEdgeLength::edge_length)
- .def("set_edge_length", &ModEdgeLength::set_edge_length)
- ;
-
- snprintf(buffer, sizeof buffer, "%s%s", _name, "ModEdgeLengthHandle");
- expose_module_handle(buffer);
-
- // ModHausdorff
- // ----------------------------------------
-
- snprintf(buffer, sizeof buffer, "%s%s", _name, "ModHausdorff");
-
- class_, boost::noncopyable>(buffer, INIT_MESH_REF)
- .def("tolerance", &ModHausdorff::tolerance)
- .def("set_tolerance", &ModHausdorff::set_tolerance)
- ;
-
- snprintf(buffer, sizeof buffer, "%s%s", _name, "ModHausdorffHandle");
- expose_module_handle(buffer);
-
- // ModIndependentSets
- // ----------------------------------------
-
- snprintf(buffer, sizeof buffer, "%s%s", _name, "ModIndependentSets");
-
- class_, boost::noncopyable>(buffer, INIT_MESH_REF);
-
- snprintf(buffer, sizeof buffer, "%s%s", _name, "ModIndependentSetsHandle");
- expose_module_handle(buffer);
-
- // ModNormalDeviation
- // ----------------------------------------
-
- snprintf(buffer, sizeof buffer, "%s%s", _name, "ModNormalDeviation");
-
- class_, boost::noncopyable>(buffer, INIT_MESH_REF)
- .def("normal_deviation", &ModNormalDeviation::normal_deviation)
- .def("set_normal_deviation", &ModNormalDeviation::set_normal_deviation)
- ;
-
- snprintf(buffer, sizeof buffer, "%s%s", _name, "ModNormalDeviationHandle");
- expose_module_handle(buffer);
-
- // ModNormalFlipping
- // ----------------------------------------
-
- snprintf(buffer, sizeof buffer, "%s%s", _name, "ModNormalFlipping");
-
- class_, boost::noncopyable>(buffer, INIT_MESH_REF)
- .def("max_normal_deviation", &ModNormalFlipping::max_normal_deviation)
- .def("set_max_normal_deviation", &ModNormalFlipping::set_max_normal_deviation)
- ;
-
- snprintf(buffer, sizeof buffer, "%s%s", _name, "ModNormalFlippingHandle");
- expose_module_handle(buffer);
-
- // ModProgMesh
- // ----------------------------------------
-
- class_("Info", no_init)
- .def_readwrite("v0", &Info::v0)
- .def_readwrite("v1", &Info::v1)
- .def_readwrite("vl", &Info::vl)
- .def_readwrite("vr", &Info::vr)
- ;
-
- snprintf(buffer, sizeof buffer, "%s%s", _name, "ModProgMesh");
-
- class_, boost::noncopyable>(buffer, INIT_MESH_REF)
- .def("pmi", &infolist)
- .def("infolist", &infolist)
- .def("write", &ModProgMesh::write)
- ;
-
- snprintf(buffer, sizeof buffer, "%s%s", _name, "ModProgMeshHandle");
- expose_module_handle(buffer);
-
- // ModQuadric
- // ----------------------------------------
-
- snprintf(buffer, sizeof buffer, "%s%s", _name, "ModQuadric");
-
- class_, boost::noncopyable>(buffer, INIT_MESH_REF)
- .def("set_max_err", &ModQuadric::set_max_err, set_max_err_overloads())
- .def("unset_max_err", &ModQuadric::unset_max_err)
- .def("max_err", &ModQuadric::max_err)
- ;
-
- snprintf(buffer, sizeof buffer, "%s%s", _name, "ModQuadricHandle");
- expose_module_handle(buffer);
-
- // ModRoundness
- // ----------------------------------------
-
- snprintf(buffer, sizeof buffer, "%s%s", _name, "ModRoundness");
-
- class_, boost::noncopyable>(buffer, INIT_MESH_REF)
- .def("set_min_angle", &ModRoundness::set_min_angle)
- .def("set_min_roundness", &ModRoundness::set_min_roundness, set_min_roundness_overloads())
- .def("unset_min_roundness", &ModRoundness::unset_min_roundness)
- .def("roundness", &ModRoundness::roundness)
- ;
-
- snprintf(buffer, sizeof buffer, "%s%s", _name, "ModRoundnessHandle");
- expose_module_handle(buffer);
-}
-
-} // namespace OpenMesh
-} // namespace Python
-
-#endif
diff --git a/src/Python/Example/CMakeLists.txt b/src/Python/Example/CMakeLists.txt
deleted file mode 100644
index 03c278ef..00000000
--- a/src/Python/Example/CMakeLists.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(Example)
-
-FILE(GLOB SOURCES *.cc *hh)
-
-INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES})
-LINK_DIRECTORIES(${LINK_DIRECTORIES})
-
-ADD_LIBRARY(example SHARED ${SOURCES})
-TARGET_LINK_LIBRARIES(example ${LINK_LIBRARIES})
-
-SET_TARGET_PROPERTIES(
- example
- PROPERTIES
- PREFIX ""
- DEBUG_POSTFIX ""
- RELEASE_POSTFIX ""
-)
-
-IF(APPLE)
- SET_TARGET_PROPERTIES(example PROPERTIES SUFFIX ".so")
- IF (NOT (CMAKE_MAJOR_VERSION LESS 3))
- SET_TARGET_PROPERTIES(example PROPERTIES MACOSX_RPATH TRUE)
- ENDIF()
-ENDIF()
-
-IF(WIN32)
- SET_TARGET_PROPERTIES(example PROPERTIES SUFFIX ".pyd")
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
-ENDIF()
diff --git a/src/Python/Example/Example.cc b/src/Python/Example/Example.cc
deleted file mode 100644
index ed1f4b81..00000000
--- a/src/Python/Example/Example.cc
+++ /dev/null
@@ -1,22 +0,0 @@
-#include
-
-char const * greet() {
- return "hello, world";
-}
-
-struct World {
- void set(std::string msg) { this->msg = msg; }
- std::string greet() { return msg; }
- std::string msg;
-};
-
-BOOST_PYTHON_MODULE(example) {
- using namespace boost::python;
-
- def("greet", greet);
-
- class_("World")
- .def("greet", &World::greet)
- .def("set", &World::set)
- ;
-}
diff --git a/src/Python/InputOutput.hh b/src/Python/InputOutput.hh
deleted file mode 100644
index 054452c9..00000000
--- a/src/Python/InputOutput.hh
+++ /dev/null
@@ -1,115 +0,0 @@
-#ifndef OPENMESH_PYTHON_INPUTOUTPUT_HH
-#define OPENMESH_PYTHON_INPUTOUTPUT_HH
-
-#include "Python/Bindings.hh"
-
-namespace OpenMesh {
-namespace Python {
-
-const IO::Options::Flag FLAG_DEFAULT = IO::Options::Default;
-const IO::Options::Flag FLAG_BINARY = IO::Options::Binary;
-const IO::Options::Flag FLAG_MSB = IO::Options::MSB;
-const IO::Options::Flag FLAG_LSB = IO::Options::LSB;
-const IO::Options::Flag FLAG_SWAP = IO::Options::Swap;
-const IO::Options::Flag FLAG_VERTEXNORMAL = IO::Options::VertexNormal;
-const IO::Options::Flag FLAG_VERTEXCOLOR = IO::Options::VertexColor;
-const IO::Options::Flag FLAG_VERTEXTEXCOORD = IO::Options::VertexTexCoord;
-const IO::Options::Flag FLAG_EDGECOLOR = IO::Options::EdgeColor;
-const IO::Options::Flag FLAG_FACENORMAL = IO::Options::FaceNormal;
-const IO::Options::Flag FLAG_FACECOLOR = IO::Options::FaceColor;
-const IO::Options::Flag FLAG_FACETEXCOORD = IO::Options::FaceTexCoord;
-const IO::Options::Flag FLAG_COLORALPHA = IO::Options::ColorAlpha;
-const IO::Options::Flag FLAG_COLORFLOAT = IO::Options::ColorFloat;
-
-BOOST_PYTHON_FUNCTION_OVERLOADS(read_mesh_overloads, IO::read_mesh, 3, 4)
-BOOST_PYTHON_FUNCTION_OVERLOADS(write_mesh_overloads, IO::write_mesh, 2, 4)
-
-/**
- * Expose the input/output functions and options to Python.
- */
-void expose_io() {
-
- //======================================================================
- // Functions
- //======================================================================
-
- bool (*read_mesh_poly )(PolyMesh&, const std::string& ) = &IO::read_mesh;
- bool (*read_mesh_poly_options)(PolyMesh&, const std::string&, IO::Options&, bool) = &IO::read_mesh;
- bool (*read_mesh_tri )(TriMesh&, const std::string& ) = &IO::read_mesh;
- bool (*read_mesh_tri_options )(TriMesh&, const std::string&, IO::Options&, bool) = &IO::read_mesh;
-
- bool (*write_mesh_poly)(const PolyMesh&, const std::string&, IO::Options, std::streamsize) = &IO::write_mesh;
- bool (*write_mesh_tri )(const TriMesh&, const std::string&, IO::Options, std::streamsize) = &IO::write_mesh;
-
- def("read_mesh", read_mesh_poly);
- def("read_mesh", read_mesh_poly_options, read_mesh_overloads());
- def("read_mesh", read_mesh_tri);
- def("read_mesh", read_mesh_tri_options, read_mesh_overloads());
-
- def("write_mesh", write_mesh_poly, write_mesh_overloads());
- def("write_mesh", write_mesh_tri, write_mesh_overloads());
-
- //======================================================================
- // Options
- //======================================================================
-
- scope scope_options = class_("Options")
- .def(init())
- .def("cleanup", &IO::Options::cleanup)
- .def("clear", &IO::Options::clear)
- .def("is_empty", &IO::Options::is_empty)
- .def("check", &IO::Options::check)
- .def("is_binary", &IO::Options::is_binary)
- .def("vertex_has_normal", &IO::Options::vertex_has_normal)
- .def("vertex_has_color", &IO::Options::vertex_has_color)
- .def("vertex_has_texcoord", &IO::Options::vertex_has_texcoord)
- .def("edge_has_color", &IO::Options::edge_has_color)
- .def("face_has_normal", &IO::Options::face_has_normal)
- .def("face_has_color", &IO::Options::face_has_color)
- .def("face_has_texcoord", &IO::Options::face_has_texcoord)
- .def("color_has_alpha", &IO::Options::color_has_alpha)
- .def("color_is_float", &IO::Options::color_is_float)
-
- .def(self == self)
- .def(self != self)
- .def(self -= IO::Options::Flag())
- .def(self += IO::Options::Flag())
-
- .def_readonly("Default", &FLAG_DEFAULT)
- .def_readonly("Binary", &FLAG_BINARY)
- .def_readonly("MSB", &FLAG_MSB)
- .def_readonly("LSB", &FLAG_LSB)
- .def_readonly("Swap", &FLAG_SWAP)
- .def_readonly("VertexNormal", &FLAG_VERTEXNORMAL)
- .def_readonly("VertexColor", &FLAG_VERTEXCOLOR)
- .def_readonly("VertexTexCoord", &FLAG_VERTEXTEXCOORD)
- .def_readonly("EdgeColor", &FLAG_EDGECOLOR)
- .def_readonly("FaceNormal", &FLAG_FACENORMAL)
- .def_readonly("FaceColor", &FLAG_FACECOLOR)
- .def_readonly("FaceTexCoord", &FLAG_FACETEXCOORD)
- .def_readonly("ColorAlpha", &FLAG_COLORALPHA)
- .def_readonly("ColorFloat", &FLAG_COLORFLOAT)
- ;
-
- enum_("Flag")
- .value("Default", IO::Options::Default)
- .value("Binary", IO::Options::Binary)
- .value("MSB", IO::Options::MSB)
- .value("LSB", IO::Options::LSB)
- .value("Swap", IO::Options::Swap)
- .value("VertexNormal", IO::Options::VertexNormal)
- .value("VertexColor", IO::Options::VertexColor)
- .value("VertexTexCoord", IO::Options::VertexTexCoord)
- .value("EdgeColor", IO::Options::EdgeColor)
- .value("FaceNormal", IO::Options::FaceNormal)
- .value("FaceColor", IO::Options::FaceColor)
- .value("FaceTexCoord", IO::Options::FaceTexCoord)
- .value("ColorAlpha", IO::Options::ColorAlpha)
- .value("ColorFloat", IO::Options::ColorFloat)
- ;
-}
-
-} // namespace OpenMesh
-} // namespace Python
-
-#endif
diff --git a/src/Python/Iterator.hh b/src/Python/Iterator.hh
deleted file mode 100644
index 848653ad..00000000
--- a/src/Python/Iterator.hh
+++ /dev/null
@@ -1,121 +0,0 @@
-#ifndef OPENMESH_PYTHON_ITERATOR_HH
-#define OPENMESH_PYTHON_ITERATOR_HH
-
-#include "Python/Bindings.hh"
-
-namespace OpenMesh {
-namespace Python {
-
-/**
- * Wrapper for mesh item iterators.
- *
- * This class template is used to wrap mesh item iterators for %Python. It
- * implements %Python's iterator protocol (the magic methods \_\_iter\_\_ and
- * \_\_next\_\_).
- *
- * @tparam Iterator An iterator type.
- * @tparam n_items A member function pointer that points to the mesh function
- * that returns the number of items to iterate over (e.g. n_vertices).
- */
-template
-class IteratorWrapperT {
- public:
-
- /**
- * Constructor
- *
- * @param _mesh The mesh that contains the items to iterate over.
- * @param _hnd The handle of the first item to iterate over.
- * @param _skip Specifies if deleted/hidden elements are skipped.
- */
- IteratorWrapperT(const PolyMesh& _mesh, typename Iterator::value_type _hnd, bool _skip = false) :
- mesh_(_mesh), n_items_(n_items),
- iterator_(_mesh, _hnd, _skip),
- iterator_end_(_mesh, typename Iterator::value_type(int((_mesh.*n_items)()))) {
- }
-
- /**
- * Constructor
- *
- * @param _mesh The mesh that contains the items to iterate over.
- * @param _hnd The handle of the first item to iterate over.
- * @param _skip Specifies if deleted/hidden elements are skipped.
- */
- IteratorWrapperT(const TriMesh& _mesh, typename Iterator::value_type _hnd, bool _skip = false) :
- mesh_(_mesh), n_items_(n_items),
- iterator_(_mesh, _hnd, _skip),
- iterator_end_(_mesh, typename Iterator::value_type(int((_mesh.*n_items)()))) {
- }
-
- /**
- * Implementation of %Python's \_\_iter\_\_ magic method.
- *
- * @return This iterator.
- */
- IteratorWrapperT iter() const {
- return *this;
- }
-
- /**
- * Implementation of %Python's \_\_next\_\_ magic method.
- *
- * @return The next item. Raises a %Python StopIteration exception if
- * there are no more items.
- */
- typename Iterator::value_type next() {
- if (iterator_ != iterator_end_) {
- typename Iterator::value_type res = *iterator_;
- ++iterator_;
- return res;
- }
- else {
- PyErr_SetString(PyExc_StopIteration, "No more data.");
- boost::python::throw_error_already_set();
- }
- return typename Iterator::value_type();
- }
-
- /**
- * Implementation of %Python's \_\_len\_\_ magic method.
- *
- * @return The number of items in the mesh.
- */
- unsigned int len() const {
- return (mesh_.*n_items_)();
- }
-
- private:
- const OpenMesh::PolyConnectivity& mesh_;
- size_t (OpenMesh::ArrayKernel::*n_items_)() const;
- Iterator iterator_;
- Iterator iterator_end_;
-};
-
-/**
- * Expose an iterator type to %Python.
- *
- * @tparam Iterator An iterator type.
- * @tparam n_items A member function pointer that points to the mesh function
- * that returns the number of items to iterate over (e.g. n_vertices).
- *
- * @param _name The name of the iterator type to be exposed.
- *
- * @note %Iterators are wrapped by IteratorWrapperT before they are exposed to
- * %Python, i.e. they are not exposed directly. This means that iterators
- * that are passed from %Python to C++ are instances of IteratorWrapperT.
- */
-template
-void expose_iterator(const char *_name) {
- class_ >(_name, init >())
- .def(init >())
- .def("__iter__", &IteratorWrapperT::iter)
- .def("__next__", &IteratorWrapperT::next)
- .def("__len__", &IteratorWrapperT::len)
- .def("next", &IteratorWrapperT::next)
- ;
-}
-
-} // namespace OpenMesh
-} // namespace Python
-
-#endif
diff --git a/src/Python/Mesh.hh b/src/Python/Mesh.hh
deleted file mode 100644
index 257bd6cf..00000000
--- a/src/Python/Mesh.hh
+++ /dev/null
@@ -1,931 +0,0 @@
-#ifndef OPENMESH_PYTHON_MESH_HH
-#define OPENMESH_PYTHON_MESH_HH
-
-#include "Python/Bindings.hh"
-#include "Python/Iterator.hh"
-#include "Python/Circulator.hh"
-
-#include
-
-namespace OpenMesh {
-namespace Python {
-
-BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(garbage_collection_overloads, garbage_collection, 0, 3)
-BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(add_property_overloads, add_property, 1, 2)
-
-BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(copy_all_properties_overloads, copy_all_properties, 2, 3)
-
-BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(delete_vertex_overloads, delete_vertex, 1, 2)
-BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(delete_edge_overloads, delete_edge, 1, 2)
-BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(delete_face_overloads, delete_face, 1, 2)
-BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(is_boundary_overloads, is_boundary, 1, 2)
-
-BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(find_feature_edges_overloads, find_feature_edges, 0, 1)
-BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(update_normal_overloads, update_normal, 1, 2)
-BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(update_halfedge_normals_overloads, update_halfedge_normals, 0, 1)
-BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(calc_halfedge_normal_overloads, calc_halfedge_normal, 1, 2)
-
-/**
- * Set the status of an item.
- *
- * @tparam Mesh A mesh type.
- * @tparam PropHandle A handle type.
- *
- * @param _self The mesh instance that is to be used.
- * @param _h The handle of the item whose status is to be set.
- * @param _info The status to be set.
- *
- * Depending on @ref OPENMESH_PYTHON_DEFAULT_POLICY, Mesh::status may
- * return by value instead of reference. This function ensures that the
- * status of an item can be changed nonetheless.
- */
-template
-void set_status(Mesh& _self, IndexHandle _h, const OpenMesh::Attributes::StatusInfo& _info) {
- _self.status(_h) = _info;
-}
-
-/**
- * Set the value of a property of an item.
- *
- * @tparam Mesh A mesh type.
- * @tparam PropHandle A property handle type.
- * @tparam IndexHandle The appropriate handle type.
- *
- * @param _self The mesh instance that is to be used.
- * @param _ph The property that is to be set.
- * @param _h The handle of the item whose property is to be set.
- * @param _value The value to be set.
- *
- * Depending on @ref OPENMESH_PYTHON_DEFAULT_POLICY, Mesh::property may
- * return by value instead of reference. This function ensures that the
- * property value of an item can be changed nonetheless.
- */
-template
-void set_property(Mesh& _self, PropHandle _ph, IndexHandle _h, const object& _value) {
- _self.property(_ph, _h) = _value;
-}
-
-/**
- * Set the value of a mesh property.
- *
- * @tparam Mesh A mesh type.
- * @tparam PropHandle A property handle type.
- *
- * @param _self The mesh instance that is to be used.
- * @param _ph The property that is to be set.
- * @param _value The value to be set.
- *
- * Depending on @ref OPENMESH_PYTHON_DEFAULT_POLICY, Mesh::property may
- * return by value instead of reference. This function ensures that the
- * property value of an item can be changed nonetheless.
- */
-template
-void set_property(Mesh& _self, PropHandle _ph, const object& _value) {
- _self.property(_ph) = _value;
-}
-
-/**
- * Thin wrapper for assign_connectivity.
- *
- * @tparam Mesh A mesh type.
- * @tparam OtherMesh A mesh type.
- *
- * @param _self The mesh instance that is to be used.
- * @param _other The mesh from which the connectivity is to be copied.
- */
-template
-void assign_connectivity(Mesh& _self, const OtherMesh& _other) {
- _self.assign_connectivity(_other);
-}
-
-/**
- * Get an iterator.
- */
-template
-IteratorWrapperT get_iterator(Mesh& _self) {
- return IteratorWrapperT(_self, typename Iterator::value_type(0));
-}
-
-/**
- * Get a skipping iterator.
- */
-template
-IteratorWrapperT get_skipping_iterator(Mesh& _self) {
- return IteratorWrapperT(_self, typename Iterator::value_type(0), true);
-}
-
-/**
- * Get a circulator.
- *
- * @tparam Mesh A Mesh type.
- * @tparam Circulator A circulator type.
- * @tparam CenterEntityHandle The appropriate handle type.
- *
- * @param _self The mesh instance that is to be used.
- * @param _handle The handle of the item to circulate around.
- */
-template
-CirculatorWrapperT get_circulator(Mesh& _self, CenterEntityHandle _handle) {
- return CirculatorWrapperT(_self, _handle);
-}
-
-/**
- * Garbage collection using lists instead of vectors to keep track of a set of
- * handles.
- *
- * @tparam Mesh A Mesh type.
- *
- * @param _self The mesh instance that is to be used.
- * @param _vh_to_update The list of vertex handles to be updated.
- * @param _hh_to_update The list of halfedge handles to be updated.
- * @param _fh_to_update The list of face handles to be updated.
- * @param _v Remove deleted vertices?
- * @param _e Remove deleted edges?
- * @param _f Remove deleted faces?
- */
-template
-void garbage_collection(Mesh& _self, list& _vh_to_update, list& _hh_to_update, list& _fh_to_update, bool _v = true, bool _e = true, bool _f = true) {
- // Convert list of handles to vector of pointers
- stl_input_iterator vh_begin(_vh_to_update);
- stl_input_iterator vh_end;
- std::vector vh_vector;
- vh_vector.insert(vh_vector.end(), vh_begin, vh_end);
-
- // Convert list of handles to vector of pointers
- stl_input_iterator hh_begin(_hh_to_update);
- stl_input_iterator hh_end;
- std::vector hh_vector;
- hh_vector.insert(hh_vector.end(), hh_begin, hh_end);
-
- // Convert list of handles to vector of pointers
- stl_input_iterator fh_begin(_fh_to_update);
- stl_input_iterator fh_end;
- std::vector fh_vector;
- fh_vector.insert(fh_vector.end(), fh_begin, fh_end);
-
- // Call garbage collection
- _self.garbage_collection(vh_vector, hh_vector, fh_vector, _v, _e, _f);
-}
-
-/**
- * Add a new face from a %Python list of vertex handles.
- *
- * @tparam Mesh A Mesh type.
- *
- * @param _self The mesh instance that is to be used.
- * @param _vhandles The list of vertex handles.
- */
-template
-FaceHandle add_face(Mesh& _self, const list& _vhandles) {
- stl_input_iterator begin(_vhandles);
- stl_input_iterator end;
-
- std::vector vector;
- vector.insert(vector.end(), begin, end);
-
- return _self.add_face(vector);
-}
-
-/**
- * This function template is used to expose mesh member functions that are only
- * available for a specific type of mesh (i.e. they are available for polygon
- * meshes or triangle meshes, but not both).
- *
- * @tparam Class A boost::python::class type.
- *
- * @param _class The boost::python::class instance for which the member
- * functions are to be defined.
- */
-template
-void expose_type_specific_functions(Class& _class) {
- // See the template specializations below
-}
-
-/**
- * Function template specialization for polygon meshes.
- */
-template <>
-void expose_type_specific_functions(class_& _class) {
- typedef PolyMesh::Scalar Scalar;
- typedef PolyMesh::Point Point;
- typedef PolyMesh::Normal Normal;
- typedef PolyMesh::Color Color;
-
- FaceHandle (PolyMesh::*add_face_3_vh)(VertexHandle, VertexHandle, VertexHandle ) = &PolyMesh::add_face;
- FaceHandle (PolyMesh::*add_face_4_vh)(VertexHandle, VertexHandle, VertexHandle, VertexHandle) = &PolyMesh::add_face;
- FaceHandle (*add_face_list)(PolyMesh&, const list&) = &add_face;
-
- void (PolyMesh::*split_eh_pt)(EdgeHandle, const Point&) = &PolyMesh::split;
- void (PolyMesh::*split_eh_vh)(EdgeHandle, VertexHandle) = &PolyMesh::split;
- void (PolyMesh::*split_fh_pt)(FaceHandle, const Point&) = &PolyMesh::split;
- void (PolyMesh::*split_fh_vh)(FaceHandle, VertexHandle) = &PolyMesh::split;
-
- Normal (PolyMesh::*calc_face_normal_pt)(const Point&, const Point&, const Point&) const = &PolyMesh::calc_face_normal;
-
- _class
- .def("add_face", add_face_3_vh)
- .def("add_face", add_face_4_vh)
- .def("add_face", add_face_list)
-
- .def("split", split_eh_pt)
- .def("split", split_eh_vh)
- .def("split", split_fh_pt)
- .def("split", split_fh_vh)
-
- .def("split_copy", &PolyMesh::split_copy)
-
- .def("calc_face_normal", calc_face_normal_pt)
-
- .def("insert_edge", &PolyMesh::insert_edge)
- ;
-}
-
-/**
- * Function template specialization for triangle meshes.
- */
-template <>
-void expose_type_specific_functions(class_& _class) {
- typedef TriMesh::Scalar Scalar;
- typedef TriMesh::Point Point;
- typedef TriMesh::Normal Normal;
- typedef TriMesh::Color Color;
-
- FaceHandle (TriMesh::*add_face_3_vh)(VertexHandle, VertexHandle, VertexHandle) = &TriMesh::add_face;
- FaceHandle (*add_face_list)(TriMesh&, const list&) = &add_face;
-
- VertexHandle (TriMesh::*split_eh_pt)(EdgeHandle, const Point&) = &TriMesh::split;
- void (TriMesh::*split_eh_vh)(EdgeHandle, VertexHandle) = &TriMesh::split;
- VertexHandle (TriMesh::*split_fh_pt)(FaceHandle, const Point&) = &TriMesh::split;
- void (TriMesh::*split_fh_vh)(FaceHandle, VertexHandle) = &TriMesh::split;
-
- VertexHandle (TriMesh::*split_copy_eh_pt)(EdgeHandle, const Point&) = &TriMesh::split_copy;
- void (TriMesh::*split_copy_eh_vh)(EdgeHandle, VertexHandle) = &TriMesh::split_copy;
- VertexHandle (TriMesh::*split_copy_fh_pt)(FaceHandle, const Point&) = &TriMesh::split_copy;
- void (TriMesh::*split_copy_fh_vh)(FaceHandle, VertexHandle) = &TriMesh::split_copy;
-
- HalfedgeHandle (TriMesh::*vertex_split_pt)(Point, VertexHandle, VertexHandle, VertexHandle) = &TriMesh::vertex_split;
- HalfedgeHandle (TriMesh::*vertex_split_vh)(VertexHandle, VertexHandle, VertexHandle, VertexHandle) = &TriMesh::vertex_split;
-
- _class
- .def("add_face", add_face_3_vh)
- .def("add_face", add_face_list)
-
- .def("split", split_eh_pt)
- .def("split", split_eh_vh)
- .def("split", split_fh_pt)
- .def("split", split_fh_vh)
-
- .def("split_copy", split_copy_eh_pt)
- .def("split_copy", split_copy_eh_vh)
- .def("split_copy", split_copy_fh_pt)
- .def("split_copy", split_copy_fh_vh)
-
- .def("opposite_vh", &TriMesh::opposite_vh)
- .def("opposite_he_opposite_vh", &TriMesh::opposite_he_opposite_vh)
-
- .def("vertex_split", vertex_split_pt)
- .def("vertex_split", vertex_split_vh)
-
- .def("is_flip_ok", &TriMesh::is_flip_ok)
- .def("flip", &TriMesh::flip)
- ;
-}
-
-
-/**
- * Expose a mesh type to %Python.
- *
- * @tparam Mesh A mesh type.
- *
- * @param _name The name of the mesh type to be exposed.
- */
-template
-void expose_mesh(const char *_name) {
- using OpenMesh::Attributes::StatusInfo;
-
- typedef typename Mesh::Scalar Scalar;
- typedef typename Mesh::Point Point;
- typedef typename Mesh::Normal Normal;
- typedef typename Mesh::Color Color;
-
- //======================================================================
- // KernelT Function Pointers
- //======================================================================
-
- // Get the i'th item
- VertexHandle (Mesh::*vertex_handle_uint )(unsigned int) const = &Mesh::vertex_handle;
- HalfedgeHandle (Mesh::*halfedge_handle_uint)(unsigned int) const = &Mesh::halfedge_handle;
- EdgeHandle (Mesh::*edge_handle_uint )(unsigned int) const = &Mesh::edge_handle;
- FaceHandle (Mesh::*face_handle_uint )(unsigned int) const = &Mesh::face_handle;
-
- // Delete items
- void (Mesh::*garbage_collection_bools)(bool, bool, bool) = &Mesh::garbage_collection;
- void (*garbage_collection_lists_bools)(Mesh&, list&, list&, list&, bool, bool, bool) = &garbage_collection;
-
- // Vertex connectivity
- HalfedgeHandle (Mesh::*halfedge_handle_vh)(VertexHandle) const = &Mesh::halfedge_handle;
- HalfedgeHandle (Mesh::*halfedge_handle_fh)(FaceHandle ) const = &Mesh::halfedge_handle;
-
- // Halfedge connectivity
- FaceHandle (Mesh::*face_handle_hh )(HalfedgeHandle) const = &Mesh::face_handle;
- HalfedgeHandle (Mesh::*prev_halfedge_handle_hh)(HalfedgeHandle) const = &Mesh::prev_halfedge_handle;
- EdgeHandle (Mesh::*edge_handle_hh )(HalfedgeHandle) const = &Mesh::edge_handle;
-
- // Edge connectivity
- HalfedgeHandle (Mesh::*halfedge_handle_eh_uint)(EdgeHandle, unsigned int) const = &Mesh::halfedge_handle;
-
- // Set halfedge
- void (Mesh::*set_halfedge_handle_vh_hh)(VertexHandle, HalfedgeHandle) = &Mesh::set_halfedge_handle;
- void (Mesh::*set_halfedge_handle_fh_hh)(FaceHandle, HalfedgeHandle ) = &Mesh::set_halfedge_handle;
-
- // Handle -> Item
- const typename Mesh::Vertex& (Mesh::*vertex )(VertexHandle ) const = &Mesh::vertex;
- const typename Mesh::Halfedge& (Mesh::*halfedge)(HalfedgeHandle) const = &Mesh::halfedge;
- const typename Mesh::Edge& (Mesh::*edge )(EdgeHandle ) const = &Mesh::edge;
- const typename Mesh::Face& (Mesh::*face )(FaceHandle ) const = &Mesh::face;
-
- // Item -> Handle
- VertexHandle (Mesh::*handle_v)(const typename Mesh::Vertex& ) const = &Mesh::handle;
- HalfedgeHandle (Mesh::*handle_h)(const typename Mesh::Halfedge&) const = &Mesh::handle;
- EdgeHandle (Mesh::*handle_e)(const typename Mesh::Edge& ) const = &Mesh::handle;
- FaceHandle (Mesh::*handle_f)(const typename Mesh::Face& ) const = &Mesh::handle;
-
- // Get value of a standard property (point, normal, color)
- const typename Mesh::Point& (Mesh::*point_vh )(VertexHandle ) const = &Mesh::point;
- const typename Mesh::Normal& (Mesh::*normal_vh)(VertexHandle ) const = &Mesh::normal;
- const typename Mesh::Normal& (Mesh::*normal_hh)(HalfedgeHandle) const = &Mesh::normal;
- const typename Mesh::Normal& (Mesh::*normal_fh)(FaceHandle ) const = &Mesh::normal;
- const typename Mesh::Color& (Mesh::*color_vh )(VertexHandle ) const = &Mesh::color;
- const typename Mesh::Color& (Mesh::*color_hh )(HalfedgeHandle) const = &Mesh::color;
- const typename Mesh::Color& (Mesh::*color_eh )(EdgeHandle ) const = &Mesh::color;
- const typename Mesh::Color& (Mesh::*color_fh )(FaceHandle ) const = &Mesh::color;
-
- // Get value of a standard property (texture coordinate)
- const typename Mesh::TexCoord1D& (Mesh::*texcoord1D_vh)(VertexHandle ) const = &Mesh::texcoord1D;
- const typename Mesh::TexCoord1D& (Mesh::*texcoord1D_hh)(HalfedgeHandle) const = &Mesh::texcoord1D;
- const typename Mesh::TexCoord2D& (Mesh::*texcoord2D_vh)(VertexHandle ) const = &Mesh::texcoord2D;
- const typename Mesh::TexCoord2D& (Mesh::*texcoord2D_hh)(HalfedgeHandle) const = &Mesh::texcoord2D;
- const typename Mesh::TexCoord3D& (Mesh::*texcoord3D_vh)(VertexHandle ) const = &Mesh::texcoord3D;
- const typename Mesh::TexCoord3D& (Mesh::*texcoord3D_hh)(HalfedgeHandle) const = &Mesh::texcoord3D;
-
- // Get value of a standard property (status)
- const StatusInfo& (Mesh::*status_vh)(VertexHandle ) const = &Mesh::status;
- const StatusInfo& (Mesh::*status_hh)(HalfedgeHandle) const = &Mesh::status;
- const StatusInfo& (Mesh::*status_eh)(EdgeHandle ) const = &Mesh::status;
- const StatusInfo& (Mesh::*status_fh)(FaceHandle ) const = &Mesh::status;
-
- // Set value of a standard property (point, normal, color)
- void (Mesh::*set_normal_vh)(VertexHandle, const typename Mesh::Normal&) = &Mesh::set_normal;
- void (Mesh::*set_normal_hh)(HalfedgeHandle, const typename Mesh::Normal&) = &Mesh::set_normal;
- void (Mesh::*set_normal_fh)(FaceHandle, const typename Mesh::Normal&) = &Mesh::set_normal;
- void (Mesh::*set_color_vh )(VertexHandle, const typename Mesh::Color& ) = &Mesh::set_color;
- void (Mesh::*set_color_hh )(HalfedgeHandle, const typename Mesh::Color& ) = &Mesh::set_color;
- void (Mesh::*set_color_eh )(EdgeHandle, const typename Mesh::Color& ) = &Mesh::set_color;
- void (Mesh::*set_color_fh )(FaceHandle, const typename Mesh::Color& ) = &Mesh::set_color;
-
- // Set value of a standard property (texture coordinate)
- void (Mesh::*set_texcoord1D_vh)(VertexHandle, const typename Mesh::TexCoord1D&) = &Mesh::set_texcoord1D;
- void (Mesh::*set_texcoord1D_hh)(HalfedgeHandle, const typename Mesh::TexCoord1D&) = &Mesh::set_texcoord1D;
- void (Mesh::*set_texcoord2D_vh)(VertexHandle, const typename Mesh::TexCoord2D&) = &Mesh::set_texcoord2D;
- void (Mesh::*set_texcoord2D_hh)(HalfedgeHandle, const typename Mesh::TexCoord2D&) = &Mesh::set_texcoord2D;
- void (Mesh::*set_texcoord3D_vh)(VertexHandle, const typename Mesh::TexCoord3D&) = &Mesh::set_texcoord3D;
- void (Mesh::*set_texcoord3D_hh)(HalfedgeHandle, const typename Mesh::TexCoord3D&) = &Mesh::set_texcoord3D;
-
- // Set value of a standard property (status)
- void (*set_status_vh)(Mesh&, VertexHandle, const StatusInfo&) = &set_status;
- void (*set_status_hh)(Mesh&, HalfedgeHandle, const StatusInfo&) = &set_status;
- void (*set_status_eh)(Mesh&, EdgeHandle, const StatusInfo&) = &set_status;
- void (*set_status_fh)(Mesh&, FaceHandle, const StatusInfo&) = &set_status;
-
- // Property management - add property
- void (Mesh::*add_property_vph)(VPropHandleT