geometry icon indicating copy to clipboard operation
geometry copied to clipboard

self-intersection aware simplify

Open kleunen opened this issue 4 years ago • 2 comments

In case of a polygon and multi-polygon, the current implementation of simplify may generate self-intersecting polygons/multi-polygons. For the tilemaker project I have implemented a self-intersection aware simplify:

https://github.com/kleunen/boost_geometry_simplify

It makes sure that:

  • The simplified inner and outer rings do not contain self-intersection
  • The outer does not overlap the inners
  • In case one inner overlaps another inner, it is combined into a single inner using union
  • In case one polygon in a multipolygon overlaps another polygon, it is combined into a single polygon using a union

The simplification of the ring is performed using this algorithm: https://www.jasondavies.com/simplify/

I believe this would be benificial for the boost geometry project and other projects as well.

Have a try here: https://godbolt.org/z/rhhxjenYP

kleunen avatar Jul 03 '21 17:07 kleunen

Sorry for my late reaction, I noticed this effort already earlier. It sounds awesome! I will have a close look later.

barendgehrels avatar Jul 14 '21 12:07 barendgehrels

Yes, the github repository already has some performance enhancements and bugfixes. So it is best to checkout the example from the github repository.

kleunen avatar Jul 14 '21 13:07 kleunen