How can I get a dictionary of cells from this Voronoi Diagram data?

后端 未结 5 1194
[愿得一人]
[愿得一人] 2021-02-07 13:17

Using the voronoi/delaunay diagram generation library found in this program, which is based on Fortune\'s original implementation of his algorithm, with a random set of points a

5条回答
  •  一个人的身影
    2021-02-07 13:24

    I used Triangle package for generating Dalaunay triangulation: http://www.cs.cmu.edu/~quake/triangle.html

    It works in 2 modes a) as a triangulate.exe utility and b) as a C library To compile it as a utility you just need to compile triangle.c and run:

       triangulate -vZ input.poly 
       #v -voronoy, Z - starting from 0 index
    

    to get voronoi diagram (Refer to the manual about .poly format) I've made an experiment with your input data in such a .poly file:

    # <# of vertices>  <# of attributes> <# of boundary markers (0 or 1)> 
    5 2 0 0
    # Following lines:    [attributes] [boundary marker]
    0 426.484 175.16
    1 282.004 231.388
    2 487.891 353.996
    3 50.8574 5.02996
    4 602.252 288.418
    #One line: <# of segments> <# of boundary markers (0 or 1)>
    5 0
    #Following lines:    [boundary marker]
    0 0 1
    1 1 2
    2 2 3
    3 3 4
    4 4 0
    

    But it just reports input data error.

    • Working with this package I'd say that it often doesn't work with with ïnput data reporting an error. It accepts only input polygons (not random points), and the issue here is that you have self-intersecting input polygon.
    • It doesn't answer your question, reporting just set of points, not a dictionary

提交回复
热议问题