pub struct Voronoi { /* private fields */ }Expand description
A structure for representing Voronoi diagrams
The Voronoi diagram of a set of points is a partition of space into regions, one for each input point, such that all points in a region are closer to that input point than to any other.
Implementations§
Source§impl Voronoi
impl Voronoi
Sourcepub fn new(
points: &ArrayView2<'_, f64>,
furthestsite: bool,
) -> SpatialResult<Self>
pub fn new( points: &ArrayView2<'_, f64>, furthestsite: bool, ) -> SpatialResult<Self>
Create a new Voronoi diagram from a set of points
§Arguments
points- Input points, shape (npoints, n_dim)furthestsite- Whether to compute a furthest-site Voronoi diagram
§Returns
- Result containing a Voronoi instance or an error
§Examples
use scirs2_spatial::voronoi::Voronoi;
use scirs2_core::ndarray::array;
let points = array![
[0.0, 0.0],
[1.0, 0.0],
[0.0, 1.0],
[1.0, 1.0]
];
let vor = Voronoi::new(&points.view(), false).unwrap();Sourcepub fn ridgepoints(&self) -> &[[usize; 2]]
pub fn ridgepoints(&self) -> &[[usize; 2]]
Get the ridge points
§Returns
- Vector of pairs of point indices, representing the points separated by each Voronoi ridge
Sourcepub fn ridge_vertices(&self) -> &[Vec<i64>]
pub fn ridge_vertices(&self) -> &[Vec<i64>]
Get the ridge vertices
§Returns
- Vector of vertex indices representing the vertices that form each ridge
Sourcepub fn regions(&self) -> &[Vec<i64>]
pub fn regions(&self) -> &[Vec<i64>]
Get the Voronoi regions
§Returns
- Vector of vertex indices representing the vertices that form each region
Sourcepub fn point_region(&self) -> &Array1<i64>
pub fn point_region(&self) -> &Array1<i64>
Sourcepub fn is_furthest_site(&self) -> bool
pub fn is_furthest_site(&self) -> bool
Check if this is a furthest-site Voronoi diagram
§Returns
- true if this is a furthest-site Voronoi diagram, false otherwise
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Voronoi
impl RefUnwindSafe for Voronoi
impl Send for Voronoi
impl Sync for Voronoi
impl Unpin for Voronoi
impl UnwindSafe for Voronoi
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.