RectClip versus Intersect with a rectangular path #383
Replies: 3 comments 2 replies
-
Hi again Chris.
Certainly part of why it's faster, but not so much intended behaviour but something I hadn't considered 😱.
Yes, I would expect so (unless the rectangular clip window is much smaller that the subject bounds).
It's not really a bug, but something that I'll need to give quite a bit more thought.
That may be best for the time being. |
Beta Was this translation helpful? Give feedback.
-
PS: The results from RectClip are still accurate, they're just no in their simplest forms:
Having said that, I do hope to improve that. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I'm chopping up complex polygons (i.e. with both positive and negative contours so the region covered has holes) from other Clipper2 operations into several simple polygons (i.e. each is a single positive contour) that I can feed to some existing code. As 1.0.5 was the latest Clipper2 release on Nuget until yesterday, I was doing this by defining two rectangular contours that together contained the whole shape and had a shared edge going through the middle of a hole, and calling the
Intersect
function, which would give me two chunks of the original polygon, so as the hole in question (and any others that happened to be split) was on the outer contour of the new shapes, it would be represented by a dent in these contours rather than a negative contour. This worked great for all the data I've needed it to work on so far.Now Clipper2 1.1.1 is on Nuget, though, I've tried using
RectClip
instead as it's faster. However, unlikeIntersect
, when a former hole ends up on the new outer perimeter, it's still represented by a negative contour rather than a baked-in dent. I imagine this might be intended behaviour and part of whyRectClip
is faster, and I could work around it by passing the result to another Clipper2 function (which would presumably negate the speedup), but wanted to check it was expected behaviour rather than a bug before giving up on this optimisation and using my existing code.Beta Was this translation helpful? Give feedback.
All reactions