Skip to content

An example implementation of the algorithm for calculating and rendering the Voronoi diagram.

Notifications You must be signed in to change notification settings

LightHouseSoftware/voronoi_diagram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Voronoi diagram

An example implementation of the algorithm for calculating and rendering the Voronoi diagram.

Voronoi diagram

Example code:

import std.stdio;
import std.random;
import std.format;
import dlib.image;
import voronoi;
import cell;
import point;

void main() {
    uint width = 512; 
    uint height = 512;
    auto img = image(width, height);
    auto sitesColor = Color4f(0.0f, 0.0f, 0.0f);

    Voronoi voronoi = new Voronoi(width, height, 100);
    voronoi.toImage(img);
    //voronoi.drawSites(img, 3, sitesColor, true);
    img.savePNG("voronoi_diagram.png");
}  

Detailed explanation (russian):

About

An example implementation of the algorithm for calculating and rendering the Voronoi diagram.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages