SFML community forums

General => SFML projects => Topic started by: CH43 on July 19, 2018, 07:03:25 pm

Title: Voronoi diagram
Post by: CH43 on July 19, 2018, 07:03:25 pm
Hey!
So i want to programm a voronoi diagram.
I dont have any problems with the theory and stuff. The problem is the wikipedia entry where they illustrate it with radial growth like this:
https://upload.wikimedia.org/wikipedia/commons/d/d9/Voronoi_growth_euclidean.gif

So now of course i also want to make an animation like that. But i dont really get how the Polygon-Circle Shapes are being made(The lines where the Circles meet and form a partial circle if you know what i mean). I thought about a Circle as Convex Shape, calculating the "Voronoi Lines" and recalculating the convex Shapes(Problem here is, that i would need to calculate a Circle in the first place). That just doesn't seem so right/elegant...Is there some kind of efficient/more elegant way of doint it?
Someone here with a better Idea?
Title: Re: Voronoi diagram
Post by: Hapax on July 19, 2018, 08:40:11 pm
You could use Selba Ward's Pie Chart (https://github.com/Hapaxia/SelbaWard/wiki/Pie-Chart) or Ring (https://github.com/Hapaxia/SelbaWard/wiki/Ring) to draw a sector of a circle.

Was the sector your problem?
Title: Re: Voronoi diagram
Post by: CH43 on July 19, 2018, 09:06:45 pm
Awesome! I think that should do it, thanks! :)

Yeah, i didnt know how to draw a circle without segments. But im still interested on how to calculate/program that by myself(well, i know how to calculate a segment but i guess you know what i mean :P).
Title: Re: Voronoi diagram
Post by: Hapax on July 20, 2018, 08:10:38 pm
Just realised that you might actually need the segment of a circle (edge piece with a flat line), which those classes don't do. Yet. It's not something I'd considered but now is something I'd like to add to Selba Ward - eventually ;D

The sector that I mentioned previously is a 'pizza slice'.