PyMesh — Geometry Processing Library for Python

PyMesh is a rapid prototyping platform focused on geometry processing. It provides a set of common mesh processing functionalities and interfaces with a number of state-of-the-art open source packages to combine their power seamlessly under a single developing environment.

_images/pymesh_teaser.jpg

Mesh process should be simple in python. PyMesh promotes human readable, minimalistic interface and works with native python data structures such as numpy.ndarray.

Load mesh from file:

>>> import pymesh
>>> mesh = pymesh.load_mesh("cube.obj");

Access mesh vertices:

>>> mesh.vertices
array([[-1., -1.,  1.],
       ...
       [ 1.,  1.,  1.]])
>>> type(mesh.vertices)
<type 'numpy.ndarray'>

Compute Gaussian curvature for each vertex:

>>> mesh.add_attribute("vertex_gaussian_curvature");
>>> mesh.get_attribute("vertex_gaussian_curvature");
array([ 1.57079633,  1.57079633,  1.57079633,  1.57079633,  1.57079633,
        1.57079633,  1.57079633,  1.57079633])

Features:

  • Read/write 2D and 3D mesh in .obj, .off, .ply, .stl, .mesh (MEDIT), .msh (Gmsh) and .node/.face/.ele (Tetgen) formats.
  • Support load and save per vertex/face/voxel scalar and vector fields.
  • Local mesh processing such edge collapse/split, duplicated vertex/face removal etc.
  • Mesh boolean support from CGAL, Cork, Carve, Clipper (2D only) and libigl.
  • Mesh generation support from CGAL, Triangle, TetGen and Quartet.
  • Wire network and inflation of wire networks.
  • Finite element matrix assembly. (supports Laplacian, stiffness, mass, etc.)

Indices and tables