GeoLab is a pure Python library for geometric computing based on NumPy arrays and SciPy sparse matrices. GeoLab provides a halfedge data structure for manifold and orientable meshes with arbitrary polygonal faces. Moreover, GeoLab provides plotting functions and a GUI environment based on MayaVi and TraitsUI for the development of custom 3D interactive applications.
GeoLab data structures are specifically designed for vectorized computing with NumPy and SciPy and for fast visualization with MayaVi.
GeoLab code is open source.
GeoLab requires NumPy, SciPy, Matplotlib, and MayaVi to run.
An environment with all dependencies can be created as:
conda create -n <env_name> -c anaconda mayavi scipy
conda activate <env_name>
pip install geolabTODO
MIT
In Python, import GeoLab as
import geolab as geoTo open an obj file, type
v, f = geo.read_mesh('file_name.obj')Here v is an array containing the coordinate of vertices and f the list of faces.
The halfedges can be built as
h = geo.halfedges(f)To get, for instance, the origin of halfedges, type
origin = geo.navigate_halfedges(h, 'o')The origin of the next halfedge can be get as
next_origin = geo.navigate_halfedges(h, 'n-o')while the face of the previous of the twin of the next halfedge as
next_twin_previous_face = geo.navigate_halfedges(h, 'n-t-p-f')and so on...
A plotter can be initialized as
plotter = geo.plotter()To add the faces of a mesh to the plot type
plotter.plot_faces(v, f)and for edges type
plotter.plot_edges(v, h)Finally, to show the plot type
plotter.show()