pub struct Voronoi { /* private fields */ }
Expand description

The dual Delaunay-Voronoi graph.

To obtain an instance of this type, use VoronoiBuilder.

Implementations

Borrows an immutable reference to the sites associated with the Voronoi graph. This is a reference to the unaltered site-point collection provided for the construction of this Voronoi graph.

Gets a representation of a Voronoi cell based on its site index.

Examples
 use voronoice::*;
 let v = VoronoiBuilder::default()
     .generate_square_sites(10)
     .build()
     .unwrap();
 println!("The following are the positions for the Voronoi cell 0: {:?}",
     v.cell(0).iter_vertices().collect::<Vec<&Point>>());

Gets an iterator to walk through all Voronoi cells. Cells are iterated in order with the vector returned by Self::sites().

Gets a vector of Voronoi cell vectors that index the cell vertex positions.

Consider using Self::iter_cells() or Self::cell() instead for a more ergonomic way of accessing cell information. Use cases for accessing this directly would include graphical applications where you need to build an index buffer for point positions.

Examples
 use voronoice::*;
 let v = VoronoiBuilder::default()
     .generate_square_sites(10)
     .build()
     .unwrap();
 let first_cell = v.cells().first().unwrap();
 let vertices = v.vertices();
 println!("The following are the positions for the Voronoi cell 0: {:?}",
     first_cell.iter().copied().map(|v| &vertices[v]).collect::<Vec<&Point>>());

Gets the a vector of the Voronoi cell vertices. These vertices are indexed by Self::cells(). Consider using Self::iter_cells() or Self::cell() instead for a more ergonomic way of accessing cell information.

For a given Voronoi cell, its vertices are the circumcenters of its associated Delaunay triangles. Values whose indexes are greater than sites.len() - 1 are not actual triangle circumcenters but Voronoi cell vertices added to “close” sites on the convex hull or otherwise used for clipping edges that fell outside the bounding box region.

Please see Self::cells() documentation for examples.

Gets a reference to the underlying delaunay triangulation.

triangulation().triangles is a vector of indices to sites where each triple represents a triangle on the dual Delaunay triangulation associated with this Voronoi graph. All triangles are directed counter-clockwise.

Gets a reference to the bounding box.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Creates a builder with same configurations that produced the original voronoi. Useful for performing Lloyd relaxation or storing the configuration to generate a identical diagram.

Creates a builder with same configurations that produced the original voronoi, consuming it. Useful for performing Lloyd relaxation or storing the configuration to generate a identical diagram.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.