{"id":17932949,"url":"https://github.com/andreesteve/voronoice","last_synced_at":"2025-07-11T02:33:51.275Z","repository":{"id":44325662,"uuid":"328074438","full_name":"andreesteve/voronoice","owner":"andreesteve","description":"A nice and fast way to construct 2D Voronoi Diagrams","archived":false,"fork":false,"pushed_at":"2023-11-07T10:52:51.000Z","size":468,"stargazers_count":40,"open_issues_count":5,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-10T13:48:39.533Z","etag":null,"topics":["rust","voronoi"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andreesteve.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-09T04:33:34.000Z","updated_at":"2025-07-01T03:49:58.000Z","dependencies_parsed_at":"2024-10-28T21:47:21.179Z","dependency_job_id":null,"html_url":"https://github.com/andreesteve/voronoice","commit_stats":{"total_commits":110,"total_committers":4,"mean_commits":27.5,"dds":0.07272727272727275,"last_synced_commit":"f2ec9256e1a3bef7fd9802550a8a42d24920294b"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/andreesteve/voronoice","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreesteve%2Fvoronoice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreesteve%2Fvoronoice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreesteve%2Fvoronoice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreesteve%2Fvoronoice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreesteve","download_url":"https://codeload.github.com/andreesteve/voronoice/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreesteve%2Fvoronoice/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264713036,"owners_count":23652707,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rust","voronoi"],"created_at":"2024-10-28T21:34:30.438Z","updated_at":"2025-07-11T02:33:50.893Z","avatar_url":"https://github.com/andreesteve.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Voronoice\n\n[![Crate](https://img.shields.io/crates/v/voronoice.svg)](https://crates.io/crates/voronoice)\n[![API](https://docs.rs/voronoice/badge.svg)](https://docs.rs/voronoice)\n![Build](https://github.com/andreesteve/voronoice/actions/workflows/build.yml/badge.svg)\n\nA nice and fast way to construct 2D [Voronoi diagrams](https://en.wikipedia.org/wiki/Voronoi_diagram) written in Rust.\n\nVoronoice builds Voronoi diagrams by first obtaining its [Delaunay triangulation](https://en.wikipedia.org/wiki/Delaunay_triangulation), through the really fast [delaunator](https://docs.rs/delaunator/*/delaunator) crate and then extracting its dual Voronoi diagram.\n\n## Example\n\n```rust\nuse voronoice::*;\n\n// voronoi sites\nlet sites = vec![\n    Point { x: 0.0, y: 0.0 }, Point { x: 1.0, y: 0.0 }, Point { x: 0.0, y: 1.0 }\n];\n\n// builds a voronoi diagram from the set of sites above, bounded by a square of size 4\nlet my_voronoi = VoronoiBuilder::default()\n    .set_sites(sites)\n    .set_bounding_box(BoundingBox::new_centered_square(4.0))\n    .set_lloyd_relaxation_iterations(5)\n    .build()\n    .unwrap();\n\n// inspect cells through iterators\nmy_voronoi.iter_cells().for_each(|cell| {\n    println!(\"Vertices of cell: {:?}\", cell.vertices().collect::\u003cVec\u003c\u0026Point\u003e\u003e())\n});\n\n// or probe cells individually\nlet my_cell = my_voronoi.cell(1);\nprintln!(\"Second cell has site {:?}, voronoi vertices {:?} and delaunay triangles {:?}\",\n    my_cell.site_position(),\n    my_cell.vertices().collect::\u003cVec\u003c\u0026Point\u003e\u003e(),\n    my_cell.triangles().collect::\u003cVec\u003cusize\u003e\u003e());\n\n// or, for graphical applications, that benefit from index buffers\n// you can access the raw, indexed data\nlet all_voronoi_cell_vertices = my_voronoi.vertices();\nlet indexed_voronoi_cells = my_voronoi.cells();\nprintln!(\"The first vertex position for the first voronoi cell is at {:?}\",\n    all_voronoi_cell_vertices[indexed_voronoi_cells[0][0]]);\n```\n\n## Documentation\n\nOn [docs.rs](https://docs.rs/voronoice/*/voronoice/).\n\n## Performance\n\nHere are some generation times on a 3.5GHz Core i7 from 2012.\n\n| Number of points | Time         |\n| -----------------|--------------|\n|      1,000       | 150 µs       |\n|     10,000       | 1.5 ms       |\n|    100,000       | 18 ms        |\n|  1,000,000       | 270 ms       |\n|  5,000,000       | 1.6 s        |\n| 10,000,000       | 3.5 s        |\n\nA comparison benchmark with other Rust Voronoi diagram generating libraries can be found [here](https://github.com/andreesteve/voronoi-benchmark-rs).\n\n# Examples\n\n## [svg](examples/svg.rs)\n\n```cargo run --example svg -- -s10 -l2 -z0.8 -o example.svg --render-labels false```\n\nGenerates a SVG image to visualize the Voronoi-Delaunay graph. Provide ```--help``` to see other options.\n\n![Example of SVG Voronoi](examples/assets/example.svg)\n\n## [image](examples/image.rs)\n\n```cargo run --release --example image -- examples/assets/mona_noice_small.jpg 300```\n\n Generates a color averaged image by overlaying a Voronoi diagram\n\n![Original image](examples/assets/mona_noice.jpg)\n![Image after voronoi cell averaging](examples/assets/mona_noice_voronoi.jpg)\n\n## Others\n\n* [voronoice-inspector](https://github.com/andreesteve/voronoice-inspector) - an interactive tool to render and inspect Voronoi diagrams","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreesteve%2Fvoronoice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreesteve%2Fvoronoice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreesteve%2Fvoronoice/lists"}