Skip to content

st3penta/voronoi-golang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Voronoi Golang

Golang implementation of the voronoi diagram

Overview

This is a graphical representation of a voronoi diagram written in Go.

Demo:
demo gif

Usage

Run the bin without any parameters: ./voronoi
Some parameters may be customized here, in this case you can run the source (go run .) or rebuild (go build .) and run the bin ./voronoi

Hotkeys

Space: restarts the simulation generating a new set of seeds
Enter: starts/stops the simulation

Something about the algorithm used

This solution implements an approximated (but enough accurate) algorithm to solve the voronoi diagram problem.
Basically it works by extending the cells starting from the seed points: at each iteration, the size of the cell is incremented and each point laying in this incremental perimeter is assigned to the cell (unless it is already assigned to a closed seed).
Each cell is extended until no more points can be assigned to it. At that point the cell is flagged as inactive and ignored in the following iterations.
The algorithm goes on until there are no more active cells, meaning all the points in the canvas have been assigned to a cell.

Why this kind of solution?

Because it is in a sweet spot between the simple but highly inefficient brute force algorithm (that for each point in the canvas finds its nearest seed,) and the Fortune's Algorithm, efficient but complex

About

Golang implementation of the voronoi diagram

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages