PyMesh is a code base developed by Qingnan Zhou for his PhD research at New York University. It is a rapid prototyping platform focused on geometry processing. PyMesh is written with both C++ and Python, where computational intensive functionalities are realized in C++, and Python is used for creating minimalistic and easy to use interfaces.
(Model source: Bust of Sappho)
Perhaps the easiest way of trying out PyMesh is through docker:
docker run -it pymesh/pymesh Python 3.6.4 (default, Feb 17 2018, 09:32:33) [GCC 4.9.2] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import pymesh
For example, to run meshstat.py:
docker run -it --rm -v `pwd`:/models pymesh/pymesh meshstat.py -x /models/model.obj
This command mounts your current working directory to the
in a docker container and executes the
meshstat.py script on the mesh file
model.obj in the current directory.
To retrieve the code:
git clone https://github.com/PyMesh/PyMesh.git cd PyMesh git submodule update --init
PyMesh has the following required dependencies:
The following C++ libraries are required. They are included in
PyMesh also has a number of optional dependencies:
- Carve: A fast, robust constructive solid geometry library.
- CGAL: The Computational Geometry Algorithms Library.
- Clipper: An open source freeware library for clipping and offsetting lines and polygons.
- Cork: A 3D boolean/CSG library.
- Draco: An open-source library for compressing and decompressing 3D geometric meshes and point clouds
- Geogram: A programming library of geometric algorithms
- libigl: A simple C++ geometry processing library.
- MMG: Robust, open source & multidisciplinary software for remeshing.
- Qhull: Engine for convex hulls, Delaunay triangulations, Voronoi diagrams computations.
- Quartet: A tetrahedral mesh generator that does isosurface stuffing with an acute tetrahedral tile.
- TBB: Thread building blocks from Intel.
- Tetgen: Tetrahedral mesh generation engine.
- Triangle: A two-Dimensional quality mesh generator and Delaunay triangulator.
All of the optional libraries are included in
Specify Dependency Locations
All dependencies are included as git submodules in the
It is recommended to build these dependencies directly (see Build section).
However, it is possible to use an existing dependency installed on your system.
If the dependent library is not installed in standard locations
/opt/local), one needs to set environment variables that
point to the correct directories. PyMesh check the following environment
- Eigen: Set
EIGEN_PATHto the directory containing the
- CGAL: Set
CGAL_PATHto the directory containing
- Boost: Set
BOOST_INCto the directory containing boost.
- GMP: Set
GMP_LIBto the directories containing GMP header and library.
- Boost: Set
- libigl: Set
includedirectory of libigl sources.
- Cork: Set
CORK_PATHto the install directory of Cork.
- Tetgen: Set
TETGEN_PATHto the install directory of Tetgen.
- Triangle: Set
TRIANGLE_PATHto the install directory of Triangle.
- Qhull: Set
QHULL_PATHto the install directory of Qhull.
- Clipper: Set
CLIPPER_PATHto the install directory of Clipper.
- Carve: Set
CARVE_PATHto the install directory of Carve.
- Geogram: Set
GEOGRAM_PATHto the install directory of Geogram.
- Quartet: Set
QUARTET_PATHto the install directory of Quartet.
- Draco: Set
Draco_PATHto the install directory of Draco.
- MMG: Set
MMG_PATHto the install directory of MMG.
$PYMESH_PATH be the root directory of the repository.
The first step is to compile the optional third party dependencies:
cd $PYMESH_PATH/third_party mkdir build cd build cmake .. make make install
Third party dependencies will be installed in
Now we can build the main project. It is recommended to build out of source:
cd $PYMESH_PATH mkdir build cd build cmake ..
To build the PyMesh library:
make make tests
Make sure all unit tests are passed before using the library.
The output of building PyMesh consists a set of C++ libraries and a python module. Installing the C++ library is currently not available. However, installing the python package can be done:
./setup.py build # This an alternative way of calling cmake/make ./setup.py install
To check PyMesh is installed correctly, run the following python unit tests::
python -c "import pymesh; pymesh.test()"
Once again, make sure all unit tests are passed, and report any unit test failures.