Menu

Degenerate Intersections

Terence_13
2022-03-13
2022-03-15
  • Terence_13

    Terence_13 - 2022-03-13

    Hi Angus,

    I got a use case where I need to create the union of individual quadratic tiles perfectly overlapping in their vertices. In my quest for a clipping algorithm that can do that perfectly without any glitches and edge cases, only Polybool worked so far. Hormann & Martinez & Clipper1 all work "sort off", but got plenty of edge cases rendering them unusable. Just tried if ClipperLib2 can do it...no luck. Is this something you would expect Clipper2Lib to ultimately be able to do, or is this a limitation that cannot be easily overcome?

    In case you wonder why I got this strange use case: The NOAA is redoing all nautical charts, to be tiles in a chessboard as you can see in their interactive ENC viewer . And as I cannot load all charts at once (>2GB) in the App I am making, I am merging the outlines of all maps near the current position of the boat, before I take the resulting polygon as clipper on the earth continent/ocean subjects (in order to cut a hole into the earth surface before I load the navigation maps into those holes). Unbelievable how hard it is to find an algo to do a task that appears intuitively so simple....

     

    Last edit: Terence_13 2022-03-13
  • Angus Johnson

    Angus Johnson - 2022-03-14

    Just tried if ClipperLib2 can do it...no luck. Is this something you would expect Clipper2Lib to ultimately be able to do,

    Bummer! And YES!!! Though I'm not sure what you mean by glitches. If you're meaning that the solution is technically correct (as I expect) but there are polygons in the solution that touch each other and could be simplified, then this is something that's on the "road map" for future but not promised.

    If you are getting results from Clipper2 that aren't technically correct, I'd be keen to see a (preferably small) data sample that demonstrates this so it can be fixed ASAP.

     
  • Terence_13

    Terence_13 - 2022-03-14

    EDITED (red outline was not result union but rather later process step clipping against earth features)

    Hmm...you might be right that it is technically correct. GREAT work! Clipping against the earth polygon features is a bit glitchy (see bottom left corner in Clipper2Lib picture)...need to investigate this further. See attachment.

    This is really difficult to reproduce and provide you samples with as the individual tiles are randomly "unified". A difficult situation is e.g. when 8 tiles have been merged in 3x3 tiles, and the last tile fills a hole in the middle vs top right corner tile missing. If you see in the attached picture something unexpected, maybe you are able to synthesize a test dataset (3x3, or 4x4 tiles), and merge them in all permutations?)

     

    Last edit: Terence_13 2022-03-14
  • Terence_13

    Terence_13 - 2022-03-14

    Update: All good. Indeed Clipper2Lib works now for the "union of tiles" case described above. The glitches I saw where related to a minor bug in the tessellation library I use (fixed now). Combination of those glitches and the fact that Clipper2Lib does (not yet) merge touching polygons in the solution threw me off. Congrats: that is a major improvement to Clipper1!

    Bold red outline in the attached picture indicates the union solution polygon.

     

    Last edit: Terence_13 2022-03-14
    • Angus Johnson

      Angus Johnson - 2022-03-15

      Great, thanks for the update.

      Also, I might be putting the merging of touching solution polygons on the priority list (to tackle before final release of Clipper2). That may delay things a bit but hopefully not too much.

       
      • Niki Spahiev

        Niki Spahiev - 2022-03-15

        On 15.03.22 г. 2:32 ч., Angus Johnson wrote:

        Great, thanks for the update.

        Also, I might be putting the merging of touching solution polygons on
        the priority list (to tackle before final release of Clipper2). That may
        delay things a bit but hopefully not too much.

        Please make merging optional. It's important for motion planing.

        best regards,

        Niki

         
MongoDB Logo MongoDB