pyhull is a Python wrapper to Qhull (http://www.qhull.org/) for the computation of the convex hull, Delaunay triangulation and Voronoi diagram.
Useful low-level functions are implemented for direct import in the base package and can be called as pyhull.qconvex, pyhull.qdelauany, etc.
Similar to qconvex command in command-line qhull.
Similar to qdelaunay command in command-line qhull.
Generalized helper method to perform a qhull based command.
- Command to perform. Supported commands are qconvex, qdelaunay and qvoronoi.
- Options to be provided for qhull command. See specific methods for info on supported options. Up to two options separated by spaces are supported.
- Sequence of points as input to qhull command.
Similar to qvoronoi command in command-line qhull.
This module implements a ConvexHull class.
Convex hull for a set of points.
Returns the simplices of the convex hull.
This module implements a DelaunayTri class representing a Delaunay triangulation of a set of points.
Delaunay triangulation for a set of points.
Returns the simplices of the triangulation.
This module defines a class representing an arbitrary Simplex in arbitrary dimensional space.
A generalized simplex object. See http://en.wikipedia.org/wiki/Simplex.
Returns a copy of the vertex coordinates in the simplex.
Checks if a point is in the simplex using the standard barycentric coordinate system algorithm.
Taking an arbitrary vertex as an origin, we compute the basis for the simplex from this origin by subtracting all other vertices from the origin. We then project the point into this coordinate system and determine the linear decomposition coefficients in this coordinate system. If the coeffs satisfy that all coeffs >= 0 and sum(coeffs) <= 1, the composition is in the facet.
For example, take a tetrahedron. For a tetrahedron, let’s label the vertices as O, A, B anc C. Let’s call our point coordinate as X. We form the composition matrix M with vectors OA, OB and OB, transponse it, and solve for M’.a = OX where a are the coefficients.
If (a >= 0).all() and sum(a) <= 1, X is in the tetrahedron. Note that in reality, the test needs to provide a tolerance (set to 1e-8 by default) for numerical errors.
This module implements a VoronoiTess class representing a Voronoi tessellation of a set of points.
Voronoi tessellation for a set of points.