How do I derive a Voronoi diagram given its point set and its Delaunay triangulation?

前端 未结 4 2275
栀梦
栀梦 2020-12-13 09:26

I\'m working on a game where I create a random map of provinces (a la Risk or Diplomacy). To create that map, I\'m first generating a series of semi-random points, then fig

4条回答
  •  青春惊慌失措
    2020-12-13 10:14

    The Voronoi diagram is just the dual graph of the Delaunay triangulation.

    • So, the edges of the Voronoi diagram are along the perpendicular bisectors of the edges of the Delaunay triangulation, so compute those lines.
    • Then, compute the vertices of the Voronoi diagram by finding the intersections of adjacent edges.
    • Finally, the edges are then the subsets of the lines you computed which lie between the corresponding vertices.

    Note that the exact code depends on the internal representation you're using for the two diagrams.

提交回复
热议问题