-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clipper2 offset closed and open polylines together as Clipper1 #707
Comments
I'm prepared to concede that this change may have been a mistake. However, the rationale for this change was premised on the understanding that software developers generally inflate lines to a specified width. So, rather than inflating open paths by half the desired line width, users could inflate lines to the desired width. One way out of this would be to introduce a compiler conditional, but I'm not (yet) persuaded that there are more than a handful of Clipper2 users still struggling to adapt to this change. |
The issue is not in adapting to this change, the issue is that old result is impossible to achieve now in one "Execute" operation. It seems the only way to achieve old result is to do 2 Executes separately, on open paths with delta and on closed paths delta*2, and later do Boolean OR of both results. But I am not sure if it is equivalent in terms of performance. And in general I have a feeling that definition of Minkowski sum with a circle is a better rationale than "software developers generally inflate lines to a specified width" :) Old behavior was consistent in this sense. |
OK. If I changed this back now, I'm not sure the best way to do so without creating a headache for those who've adapted to Clipper2's current line offsetting behaviour. I'm open to suggestions. 😉 |
@AngusJohnson |
The problem with the compile switch is that some folks use nuget or similar to get packages for use in their projects. That is already a problem in case the user wants the Z value (the nuget is compiled with the defaults, where USINGZ is not set). Now, you could have a 4-way variation (USINGZ, single-sided offset; USINGZ double-sided offset; single-sided offset; double-sided offset). I wondered if it might be cleaner to have an optional argument in the call that configures the call to be 'double-sided' or 'single-sided'. Default would perhaps be to retain compatibility with the existing code. That or a constructor argument that sets the behavior. |
Minor changes to clipper.export.h Renamed DisposeExportedCPaths64 to DisposeArray64 Renamed DisposeExportedCPathsD to DisposeArrayD Tidied up code documentation
Do I correctly understand that c3839ac has opted to break the existing behavior? |
Yes. I took the plunge 😱😜. |
I am really happy with your decision, but I express my condolences to everyone who was depending on previous behavior of open offset :) |
I'm not entirely looking forward to reacting to this change, having had to accommodate the change in the behavior from Clipper1-Clipper2 back in the day. Given how long the library has had this behavior, a 'legacy' toggle for the old behavior would have been kind to existing users, but I appreciate that may have been unwelcome effort. No hard feelings. |
Changes since ver 1.2.3 include: 1. Important: Offsetting open path behaviour has changed. The delta now behaves as it did in Clipper1 (See Issue #707) 2. Important: Data structures of exported values in clipper.export.h have changed. 3. Minor bugfixes to PolyTree nesting (#679, #687) 4. Numerous minor bugfixes to polygon offsetting (#703, #715, #724) 5. Fixed an obscure bug in polygon clipping caused by horizontal spikes (#720) 6. Significantly improved documentation.
I just want to point out that a change in behaviour like this is at least deserving of a minor version increase. This is not a bugfix, this is a breaking change. Something to consider for future releases. |
1. Fixed a significant offsetting bug introduced in previous update (#733) 2. Fixed a C++ compile error when 32bit compiling (#727) 3. Minor tweak to CMakeLists.txt (C++) (#728) 4. Will now offset 'flat' polygons (Disc.#725) 5. Reminder: recent change in open path offsetting behaviour (#707) 6. Reminder: recent changes to clipper.export.h data structures.
* remotes/origin/main: Minor code tidy Added CLIPPER2_HI_PRECISION option in CMakeLists.txt Additional minor tweaks to cpp/benchmark tests Make googletest not be a git submodule, and instead clone it separately in the CI script (AngusJohnson#745) fix compiler warning of -Wunused-but-set-parameter with -fno-exceptions (AngusJohnson#744) Additional tweaks to GetIntersectPtBenchmark.cpp Additional GetIntersectPtBenchmark tweaks Fixed incorrect code comment Added new GetIntersectPoint benchmark test Updated other benchmark tests. Code formatting only (removed trailing spaces) Fixed minor typecasting issues (AngusJohnson#727) More tweaks to PointInPolygon benchmarking. Allow using external gtest with GTest:: qualified names (AngusJohnson#737) Fixed a significant (though uncommon) bug in polygon clipping (AngusJohnson#736) Fixed bugs in PointInPolygon benchmark testing. Minor tweaks to PointInPolygon benchmark testing. Fixed a minor syntax error tripping some C++ compilers Version 1.3.0 1. Fixed a significant offsetting bug introduced in previous update (AngusJohnson#733) 2. Fixed a C++ compile error when 32bit compiling (AngusJohnson#727) 3. Minor tweak to CMakeLists.txt (C++) (AngusJohnson#728) 4. Will now offset 'flat' polygons (Disc.AngusJohnson#725) 5. Reminder: recent change in open path offsetting behaviour (AngusJohnson#707) 6. Reminder: recent changes to clipper.export.h data structures. Fixed a typo and tweaked documentation Version 1.2.4 Changes since ver 1.2.3 include: 1. Important: Offsetting open path behaviour has changed. The delta now behaves as it did in Clipper1 (See Issue AngusJohnson#707) 2. Important: Data structures of exported values in clipper.export.h have changed. 3. Minor bugfixes to PolyTree nesting (AngusJohnson#679, AngusJohnson#687) 4. Numerous minor bugfixes to polygon offsetting (AngusJohnson#703, AngusJohnson#715, AngusJohnson#724) 5. Fixed an obscure bug in polygon clipping caused by horizontal spikes (AngusJohnson#720) 6. Significantly improved documentation. Additional minor bugfix to ClipperOffset (AngusJohnson#724 & Disc.AngusJohnson#726)
Hi, as we know, Clipper2 offsets open paths differently compared to Clipper1:
https://angusj.com/clipper2/Docs/Units/Clipper.Offset/Classes/ClipperOffset/_Body.htm
Feature request: Is it possible to introduce a special flag that makes Clipper2 offset open paths on the same width as Clipper1?
Because currently we cannot offset closed paths on "delta", and open paths on "delta*2" in the same "Execute" step to simulate Clipper1 result.
In a lot of usecases we used Clipper1 on mixed inputs of Open and Closed paths, and now we have to do this offset separately or come up with workarounds to achieve result of Clipper1.
Honestly I don't even understand why this behavior is changed, because every time I heard about offsetting it was defined as minkowski sum of geometry and circle of radius "delta".
The text was updated successfully, but these errors were encountered: