Skip to content

Hultan/voronoi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VORONOI

Package for generating Voronoi diagrams.

Documentation

Configuration options:

  • Width and height
  • Distance method : Euclidean or Manhattan
  • Number of seed points
  • Seed point radius and color
  • Render seed point or not
  • Color scheme : Random or grey scale

Usage

func main() {
    v := voronoi.NewVoronoi(
        voronoi.WithSize(800, 600),
        voronoi.WithSeed(100, 5, BLACK, true),
        voronoi.WithScheme(voronoi.ColorSchemeRandom),
        voronoi.WithMethod(voronoi.DistanceMethodManhattan),
    )
	v := voronoi.NewVoronoi(c)
	v.Generate()
	err := v.SaveToPng("/home/per/temp/voronoi.png", voronoi.ImageFormatPNG)
	if err != nil {
		_, _ = fmt.Fprintf(os.Stderr, "Failed to save to file : %v", err)
	}
}

Links

Todo

Screenshots

Euclidean distance: screenshot Manhattan distance: screenshot

About

Generate Voronoi diagrams

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages