bundles / scipy 1.17.1 / scipy / spatial / _qhull / Delaunay
class
scipy.spatial._qhull:Delaunay
source: /scipy/spatial/_qhull.cpython-314-x86_64-linux-gnu.so
Signature
class Delaunay ( points , furthest_site = False , incremental = False , qhull_options = None ) Members
Summary
Delaunay tessellation in N dimensions.
Extended Summary
Parameters
points: ndarray of floats, shape (npoints, ndim)Coordinates of points to triangulate
furthest_site: bool, optionalWhether to compute a furthest-site Delaunay triangulation. Default: False
incremental: bool, optionalAllow adding new points incrementally. This takes up some additional resources.
qhull_options: str, optionalAdditional options to pass to Qhull. See Qhull manual for details. Option "Qt" is always enabled. Default:"Qbb Qc Qz Qx Q12" for ndim > 4 and "Qbb Qc Qz Q12" otherwise. Incremental mode omits "Qz".
Attributes
points: ndarray of double, shape (npoints, ndim)Coordinates of input points.
simplices: ndarray of ints, shape (nsimplex, ndim+1)Indices of the points forming the simplices in the triangulation. For 2-D, the points are oriented counterclockwise.
neighbors: ndarray of ints, shape (nsimplex, ndim+1)Indices of neighbor simplices for each simplex. The kth neighbor is opposite to the kth vertex. For simplices at the boundary, -1 denotes no neighbor.
equations: ndarray of double, shape (nsimplex, ndim+2)[normal, offset] forming the hyperplane equation of the facet on the paraboloid (see Qhull documentation for more).
paraboloid_scale, paraboloid_shift: floatScale and shift for the extra paraboloid dimension (see Qhull documentation for more).
transform: ndarray of double, shape (nsimplex, ndim+1, ndim)Affine transform from
xto the barycentric coordinatesc. This is defined byT c = x - rAt vertex
j,c_j = 1and the other coordinates zero.For simplex
i,transform[i,:ndim,:ndim]contains inverse of the matrixT, andtransform[i,ndim,:]contains the vectorr.If the simplex is degenerate or nearly degenerate, its barycentric transform contains NaNs.
vertex_to_simplex: ndarray of int, shape (npoints,)Lookup array, from a vertex, to some simplex which it is a part of. If qhull option "Qc" was not specified, the list will contain -1 for points that are not vertices of the tessellation.
convex_hull: ndarray of int, shape (nfaces, ndim)Vertices of facets forming the convex hull of the point set. The array contains the indices of the points belonging to the (N-1)-dimensional facets that form the convex hull of the triangulation.
coplanar: ndarray of int, shape (ncoplanar, 3)Indices of coplanar points and the corresponding indices of the nearest facet and the nearest vertex. Coplanar points are input points which were not included in the triangulation due to numerical precision issues.
If option "Qc" is not specified, this list is not computed.
vertex_neighbor_vertices: tuple of two ndarrays of int; (indptr, indices)Neighboring vertices of vertices. The indices of neighboring vertices of vertex
kareindices[indptr[k]:indptr[k+1]].furthest_siteTrue if this was a furthest site triangulation and False if not.
Raises
: QhullErrorRaised when Qhull encounters an error condition, such as geometrical degeneracy when options to resolve are not enabled.
: ValueErrorRaised if an incompatible array is given as input.
Notes
The tessellation is computed using the Qhull library Qhull library.
Examples
Triangulation of a set of points:import numpy as np points = np.array([[0, 0], [0, 1.1], [1, 0], [1, 1]]) from scipy.spatial import Delaunay tri = Delaunay(points)✓
import matplotlib.pyplot as plt
✓plt.triplot(points[:,0], points[:,1], tri.simplices) plt.plot(points[:,0], points[:,1], 'o')✗
plt.show()
✓
tri.simplices
✗points[tri.simplices]
✗tri.neighbors[1]
✓points[tri.simplices[1,1]]
✗p = np.array([(0.1, 0.2), (1.5, 0.5), (0.5, 1.05)])
✓tri.find_simplex(p)
✗p_valids = np.array([(0.1, 0.2), (0.5, 1.05)])
✓tri.simplices[tri.find_simplex(p_valids)]
✗b = tri.transform[1,:2].dot(np.transpose(p - tri.transform[1,2]))
✓np.c_[np.transpose(b), 1 - b.sum(axis=0)]
✗Aliases
-
scipy.spatial.Delaunay