AngusJohnson / Clipper2

Polygon Clipping and Offsetting - C++, C# and Delphi
Boost Software License 1.0
1.34k stars 248 forks source link

Migration from Clipper to Clipper2 #803

Closed lukaszszyman closed 3 months ago

lukaszszyman commented 3 months ago

Hello, I want to migrate an old code that used Clipper cpp lib to Clipper2. In the old code was used the following:

scale = 1000000000.0f
ClipperLib::CleanPolygons(_paths, 0.01*scale);

I see there is a method called SimplifyPaths in clipper.h file. Is it the correct replacement? I tried it and it returns different results compared to the old lib (if I didn't make a mistake trying).

AngusJohnson commented 3 months ago

Clipper2 does a much better job of removing 'touching' polygons from solutions, so the old CleanPolygons function should no longer be required. If, however, you're using CleanPolygons without also performing a boolean clipping op, then use the Union op instead.

AngusJohnson commented 3 months ago

ps: In future, please post these sorts of question in Discussion (see here).