#voronoi-diagram #geometry #algorithm #fortune #compute #point

voronoi

A library to compute Voronoi diagrams, using Fortune's sweepline algorithm

5 releases

Uses old Rust 2015

0.1.4 Nov 26, 2017
0.1.3 Sep 27, 2017
0.1.2 Sep 27, 2017
0.1.1 Sep 26, 2017
0.1.0 Sep 26, 2017

#6 in #fortune

Download history 35/week @ 2024-03-17 14/week @ 2024-03-24 44/week @ 2024-03-31 21/week @ 2024-04-07 28/week @ 2024-04-14 35/week @ 2024-04-21 24/week @ 2024-04-28 29/week @ 2024-05-05 30/week @ 2024-05-12 24/week @ 2024-05-19 24/week @ 2024-05-26 26/week @ 2024-06-02 12/week @ 2024-06-09 20/week @ 2024-06-16 27/week @ 2024-06-23 1/week @ 2024-06-30

65 downloads per month

MIT license

48KB
1K SLoC

voronoi

This is a Rust implementation of Fortune's Linesweep algorithm for computing Voronoi diagrams.

Online Documentation

Usage

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" }

Example

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);

TODO

  • Handle degeneracies in geometry.rs
  • Match DCEL faces to input points
  • Reimplement the data structures with memory management
  • Balance the trees
  • Benchmark against other implementations

lib.rs:

A Rust implementation of Fortune's Linesweep algorithm for computing Voronoi diagrams.

Dependencies

~1MB
~16K SLoC