Crates.io | voronoi |
lib.rs | voronoi |
version | 0.1.4 |
source | src |
created_at | 2017-09-26 20:44:34.986273 |
updated_at | 2017-11-26 23:12:06.820303 |
description | A library to compute Voronoi diagrams, using Fortune's sweepline algorithm |
homepage | |
repository | https://github.com/petosegan/rust_voronoi |
max_upload_size | |
id | 33252 |
size | 49,541 |
This is a Rust implementation of Fortune's Linesweep algorithm for computing Voronoi diagrams.
To use, add the following line to Cargo.toml
under [dependencies]
:
voronoi = "0.1.4"
or alternatively,
voronoi = { git = "https://github.com/petosegan/rust_voronoi.git" }
extern crate voronoi;
use voronoi::{voronoi, Point, make_polygons};
const BOX_SIZE: f64 = 800.;
// ...
let vor_pts = vec![Point::new(0.0, 1.0), Point::new(2.0, 3.0), Point::new(10.0, 12.0)];
let vor_diagram = voronoi(vor_pts, BOX_SIZE);
let vor_polys = make_polygons(&vor_diagram);