aewallin / openvoronoi

2D voronoi diagram for point and line-segment sites using incremental topology-oriented algorithm. C++ with python bindings. Licensed under LGPL2.1.

Home Page:http://www.anderswallin.net/cam/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

support for polyline sites

esigra opened this issue · comments

It seems like polyline sites are almost supported. I attach the example SVG generated by the polygon example, where all 6 line-segment sites are yellow: polygon.svg.txt
What is missing is merging polygons around line-segment sites that belong to the same polyline (by removing the edges that have been generated between those polygons).

See this modification of the polygon example:
lake-owners.svg.txt

I classified the 6 line-segments into two polylines; 2 of them are still yellow and the 4 others are now blue. I removed all the edges that were created between line-segment sites of the same colour.

What I just did manually in the SVG is what the program could do to support poly-line sites.

Think of the example SVG as a drawing of a lake with different shore owners, where the program has calculated the property boundary through the lake. (Or an island with different shore owners, where the program has calculated the property boundaries through the surrounding water.)

Here's the pictures above, but rendered:
polygon.svg:
image

lake-owners.svg:
image

I think you can do this by simply generating the Voronoi diagram first and then removing edges in your program.

I don't really see why this should be a core functionality of the library itself.