bundles / scipy latest / scipy / spatial / _qhull / Voronoi
class
scipy.spatial._qhull:Voronoi
source: /scipy/spatial/_qhull.cpython-314-x86_64-linux-gnu.so
Signature
class Voronoi ( points , furthest_site = False , incremental = False , qhull_options = None ) Members
Summary
Voronoi diagrams in N dimensions.
Extended Summary
Parameters
points: ndarray of floats, shape (npoints, ndim)Coordinates of points to construct a Voronoi diagram from
furthest_site: bool, optionalWhether to compute a furthest-site Voronoi diagram. 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. (Default: "Qbb Qc Qz Qx" for ndim > 4 and "Qbb Qc Qz" otherwise. Incremental mode omits "Qz".)
Attributes
points: ndarray of double, shape (npoints, ndim)Coordinates of input points.
vertices: ndarray of double, shape (nvertices, ndim)Coordinates of the Voronoi vertices.
ridge_points: ndarray of ints, shape ``(nridges, 2)``Indices of the points between which each Voronoi ridge lies.
ridge_vertices: list of list of ints, shape ``(nridges, *)``Indices of the Voronoi vertices forming each Voronoi ridge.
regions: list of list of ints, shape ``(nregions, *)``Indices of the Voronoi vertices forming each Voronoi region. -1 indicates vertex outside the Voronoi diagram. When qhull option "Qz" was specified, an empty sublist represents the Voronoi region for a point at infinity that was added internally.
point_region: array of ints, shape (npoints)Index of the Voronoi region for each input point. If qhull option "Qc" was not specified, the list will contain -1 for points that are not associated with a Voronoi region. If qhull option "Qz" was specified, there will be one less element than the number of regions because an extra point at infinity is added internally to facilitate computation.
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 Voronoi diagram is computed using the Qhull library.
Examples
Voronoi diagram for a set of point:import numpy as np points = np.array([[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]) from scipy.spatial import Voronoi, voronoi_plot_2d vor = Voronoi(points)✓
import matplotlib.pyplot as plt fig = voronoi_plot_2d(vor) plt.show()✓

vor.vertices
✓vor.regions vor.ridge_vertices✓
vor.ridge_points
✓Aliases
-
scipy.spatial.Voronoi