-3

Hey All i'm trying our something in GML (Gamemaker) which doesn't seem like it's tried often. Right now i'm trying to produce a voronoi diagram. I translated an old Action script code that i found on the internet since the syntax is very similar to gml and Javascript. I got it working for the most part and thankfully the script allows it to draw lines to visualize the Voronoi diagram i was able to pull these vertices out from an array ( px,py,ex,ey). However i want to be able to form polygons from these points.

I create a new seed object and give px,py,ex,ey to draw the surrounding edges however some of them do not use the whole points to create a polygon. Here is an Image below.

Voronoi Diagram

As you can see normally, all the edges make up the voronoi diagram however upon closer inspection some "polygons " are not closed and don;t use all the surronding points around it to make up the polygon.

Polygon not closing or reciveing surrounding Points

I'm really at a lost here on what to do ive spent the last 3 days trying to solve this issue but i just can't find a way to produce a cell for 1 Object. Is this normal behavior?

I did find a way to produce delaunay triangulation but even with those triangles and circumcenters list i'm not even sure what to do with them.

delaunay

I read up some JS , Python, C Basic code here

https://rosettacode.org/wiki/Voronoi_diagram

i havent put it into practice yet, but even if i generate the diagram how can i split each cell individually i need the vertices to be split uniquely for one seed object??

Shredderx
  • 45
  • 1
  • 6

1 Answers1

0

You can loop through all edges of the triangles and test if it shared the same edges.

Micromega
  • 12,486
  • 7
  • 35
  • 72