This is a small python library that will read OFF mesh format files into a halfedge data structure. A halfedge data structure has two edges for a given edge in a mesh.
Here I run through some basic manipulations of a mesh.
import halfedge_mesh
# .off are supported
mesh = halfedge_mesh("my_meshes.off")
# Returns a list of Vertex type (in order of file)--similarly for halfedges,
# and facets
mesh.vertices
# The number of facets in the mesh
len(mesh.facets)
# Get the 10th halfedge
mesh.halfedges[10]
# Get the halfedge that starts at vertex 25 and ends at vertex 50
mesh.get_halfedge(25, 50)
Please refer to the documentation for more functionality.
Simply run
python setup.py test
If you would like to see the coverage of the unit tests run
python setup.py test --addopts --cov=halfedge_mesh
Note: this will not work with python 2.6 due to argparse dependency.
In order to run the tests in this project you must have py.test. To install py.test you can either
pip install -U pytest # or
easy_install -U pytest
then you can simply run py.test in the home project directory. Make sure halfedge_mesh is importable, for example by typing once:
pip install -e . # install package using setup.py in editable mode
Email me, Carlos Rojas at [email protected]
Please follow the PEP 8 style guide for python and the writing good commit guideline
Here are some helpful articles git commits, and clean git history.
Halfedge Mesh is released under the MIT License.