Exposing PreserveCollinear for ClipperOffset and SimplifyPolygons

2014-04-30
2014-05-08
  • Hi Angus,
    as usual a big thanks for your work. I can't avoid starting every time with that.

    Is it possible to expose the PreserveCollinear option for ClipperOffset and SimplifyPolygons? (If you wonder why the latter: I want to remove self-intersections but I need to preserve each single point in the input.)

    • Alessandro
     
  • Angus Johnson
    Angus Johnson
    2014-05-01

    Hi again Alessandro.
    It's possible but I really wonder if more than one or two users would use this.
    The downside is it just further complicates the library, adds to documentation etc.
    Also, where you have the source you can of course make your own custom changes :).
    Angus

     
  • Usage case with SimplifyPolygons() is to get more granular simplification behavior, which is something you might want to do anyway if you decide to develop that feature further. In my case, I needed to prepare a polygon for triangulation so I only needed to split self-intersections but all the input points had to stay. However, I reimplemented my own SimplifyPolygons() since it's actually so... simple.

    Regarding ClipperOffset I think it makes sense to have such a flag as people using #define use_xyz might be storing information they want preserved. I think it would be quite easy to extend ClipperOffset to accept InitOptions for the Clipper object. A two lines change, isn't it?