Module voronoi

Module voronoi 

Source
Expand description

Voronoi diagrams

This module provides implementations for Voronoi diagrams in 2D and higher dimensions. A Voronoi diagram is a partition of a space into regions around a set of points, where each region consists of all points closer to one input point than to any other input point.

§Implementation

This module uses the Qhull library (via qhull-rs) for computing Voronoi diagrams.

§Examples

use scirs2_spatial::voronoi::Voronoi;
use scirs2_core::ndarray::array;

// Create a set of 2D points
let points = array![
    [0.0, 0.0],
    [1.0, 0.0],
    [0.0, 1.0],
    [1.0, 1.0]
];

// Compute Voronoi diagram
let vor = Voronoi::new(&points.view(), false).unwrap();

// Get the Voronoi vertices
let vertices = vor.vertices();
println!("Voronoi vertices: {:?}", vertices);

// Get the Voronoi regions
let regions = vor.regions();
println!("Voronoi regions: {:?}", regions);

// Get the Voronoi ridges
let ridges = vor.ridge_vertices();
println!("Voronoi ridges: {:?}", ridges);

Structs§

Voronoi
A structure for representing Voronoi diagrams

Functions§

voronoi
Compute a Voronoi diagram from a set of points