This module implements a ConvexHull class.
Bases: object
Convex hull for a set of points.
Initializes a ConvexHull from points.
This module implements a DelaunayTri class representing a Delaunay triangulation of a set of points.
Bases: object
Delaunay triangulation for a set of points.
Initializes a DelaunayTri from points.
This module defines classes for computing halfspace intersections
Bases: object
A halfspace defined by dot(normal, coords) + offset <= 0
Initializes a Halfspace.
Returns a Halfspace defined by a list of vectors parallel to the bounding hyperplane.
Bases: object
Uses qhalf to calculate the vertex representation of the intersection of a set of halfspaces
Returns a list of vertex indices for each halfspace e.g: facets_by_halfspace[0] is the list of indices ov vertices incident to halfspace 0
This module defines a class representing an arbitrary Simplex in arbitrary dimensional space.
Bases: object
A generalized simplex object. See http://en.wikipedia.org/wiki/Simplex.
Initializes a Simplex from coordinates.
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.
Bases: object
Voronoi tessellation for a set of points.
Initializes a VoronoiTess from points.
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.
Similar to qvoronoi command in command-line qhull.
Generalized helper method to perform a qhull based command.
- cmd:
- Command to perform. Supported commands are qconvex, qdelaunay and qvoronoi.
- options:
- Options to be provided for qhull command. See specific methods for info on supported options. Up to two options separated by spaces are supported.
- points:
- Sequence of points as input to qhull command.
Similar to qvoronoi command in command-line qhull.