Orientation compared to Clipper 1 #93
Replies: 12 comments 10 replies
-
TLDR version : results now are seemingly reversed from what went before. Offset does not allow for reverse solution to be set. |
Beta Was this translation helpful? Give feedback.
-
That may be true, and may be reversed yet once I have another look and am convinced that current implementation breaks convention.
Fair point, and easly fixed by adding in a ReverseSolution property to ClipperOffset too. |
Beta Was this translation helpful? Give feedback.
-
I had a second discussion open for open path clipping; that seems to have gone MIA. |
Beta Was this translation helpful? Give feedback.
-
I should also note that I provide all the background so that the request has context behind it. Not to intentionally bore or frustrate, so the TLDR may be unduly terse/concise. |
Beta Was this translation helpful? Give feedback.
-
Phil, please lets try and sort this out one step at a time. [Edit: I've deleted some comments I made because I misunderstood the tone of Phil's posts. And sorry Phil for that misunderstanding 😢.] I will look at the orientation of open paths again and compare this with Clipper1. However, the current changes to orientation really haven't changed the clipping process, just whether the results of clipping will or won't be reversed. But I will take this more slowly now. |
Beta Was this translation helpful? Give feedback.
-
I'm sorry - I think my tone is misconstrued. I'm just trying to figure out what the right answer is, not intending to blame or annoy. The detail is there to back-up my observations and explain why I'm lost in the weeds, and why the change is impacting me. I suspect it might be that I need to change something on my side, but with the changes as they are I don't understand what knob to turn :D TLDR again : I'm frustrated that I can't figure this out on my own, certainly not with you and your efforts, and I'm trying to provide enough detail that people smarter than me can point me in the right direction |
Beta Was this translation helpful? Give feedback.
-
Difficult topics should first be allowed to soften for a while. A solution will be found later. |
Beta Was this translation helpful? Give feedback.
-
Hi again Phil. You've probably noticed that I've just made major changes to how the library handles orientation. Clipping solutions of closed paths should now always be Positive except when Clipper's ReverseSolution property is set true. |
Beta Was this translation helpful? Give feedback.
-
Hi again Phil! |
Beta Was this translation helpful? Give feedback.
-
That's correct. The orientation of paths in offsetting solutions should match orientations in the input paths.
If the orientation is opposite to what you want, just set ClipperOffset's |
Beta Was this translation helpful? Give feedback.
-
I'm still working to mentally map out the relationship between IsPositive in this usage model and the IsClockwise approach from before. I am seeing signs that the code is producing the right overall shape, but the orientation isn't always what I'm expecting and I think it's needing me to adjust my post-process code in places to re-orient the shapes. More in the next day or so. |
Beta Was this translation helpful? Give feedback.
-
Alright, so now I'm reasonably confident things are as they should be. I'm getting some weird orientation quirkiness on my side, but I think that's largely from legacy re-spin of contours and I'll work to remove those and clean things up over time. Nice work, Angus, and sorry the review took a while. Lots of things to poke at this end to see if anything exploded. I've got more to do through the rest of this week, but nothing looks/smells funny at the moment. |
Beta Was this translation helpful? Give feedback.
-
This comes from #83 and I'm still rather bothered by the change. It seems to break expectations compared to Clipper 1 and I'm struggling to retain that old behavior.
My first expectation is that all outers have a consistent representation coming out of Clipper. It might not be my first choice of representation, but a lot of code was built on the observed behavior from Clipper 1, for better or worse, and having some mode that gives outers the same orientation, with cutters being the opposite orientation, would be very helpful for migration; up until recently I was using Clipper 2 without any issues; the recent changes have broken a lot in my local libraries and, staring at the problem, I am struggling to see how to start repairing it all if there's no migration option. I don't dismiss the reason for the change at all, but I really don't understand it. I saw no problems with the prior implementation for my use cases.
I've tried the preprocessor REVERSE_ORIENTATION, which provided no relief, and the property ReverseSolution doesn't exist for offset. Offsetting as well as clipping seems to have changed, which makes the situation more awkward again : I don't always run the offset through a Clipper instance, for example, when doing clean-up :
I feed this through an offset to remove any slivers and gaps. There are some constants below, but in the library code, these values are changeable based on need :
In the old code, this yielded :
In the new code, though, I get :
Even with REVERSE_ORIENTATION specified, I get a different result than I was looking for.:
I am contemplating further abusing the Z callback to allow me to track original point order through the computation, which may also help me workaround the orientation changes elsewhere in Clipper, so that I would forcibly respin things back into compliance, but am not sure whether I would win in all cases due to the need to track origin polygon index in various scenarios.
Beta Was this translation helpful? Give feedback.
All reactions