Menu

#123 Offset by 0 returns almost empty result

*
closed
nobody
None
1
2015-02-11
2015-01-18
No

I'm supplying a set of polygons to OffsetPolygons() with delta = 0, so I would expect that the input is returned unmodified. However, it's mostly missing.

(Note that the issue also happens with delta != 0)

This set of polygons comes directly from the result of a Clipper ctDifference operation, without any modification, so I'd expect it's valid in terms of winding order, overlaps etc.
I tested this on 6.2.7 C++ but I also reproduced it using 6.2.1.

1 Attachments

Discussion

  • Alessandro Ranellucci

    It looks like the issue is in ClipperOffset::FixOrientations(). It I disable the call to it inside ClipperOffset::Execute(), the returned polygons are almost equal to the output of a plain ctUnion operation, which is the expected behavior.

     
  • Alessandro Ranellucci

    So, Clipper checks whether the polygon that happens to be at the corner with lowest coordinates is CW or CCW, and then reverses the entire input set it it's detected to be a hole.
    In this case, input polygons contain some very narrow polygons that should be CCW but probably because of rounding issues got their winding order reversed. It's the old rounding story, so nothing new and not a true Clipper bug since it's documented and user should cope with it. However in this case the behavior of FixOrientations() produced unexpected behavior as it reversed the entire polygon set while many polygons that were not contained in other polygons had the correct CCW orientation.

    Ideally, FixOrientations() should only reverse polygons according to their nesting level. Or, simpler, documentation should explicitly state that the check is only performed on the polygon that has the minor coordinates.

     
  • Angus Johnson

    Angus Johnson - 2015-02-06

    Hi Alessandro.
    I'm afraid I can't duplicate this problem. The orientations all seem fine to me producing a correctly formed cogwheel image (tested with offsets of 0, +1 and -1).

     
  • Angus Johnson

    Angus Johnson - 2015-02-11
    • status: open --> closed
     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB