Skip to content
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

Geometry2D polygon boolean operations still use old Clipper1 library #90103

Closed
smix8 opened this issue Apr 1, 2024 · 0 comments · Fixed by #90153
Closed

Geometry2D polygon boolean operations still use old Clipper1 library #90103

smix8 opened this issue Apr 1, 2024 · 0 comments · Fixed by #90153

Comments

@smix8
Copy link
Contributor

smix8 commented Apr 1, 2024

Tested versions

4.3dev

System information

Windows 10

Issue description

I create this issue so the upgrade does not get forgotten again.

The Geometry2D class (and the Sprite2D editor as the only other user for that matter) still use older Clipper1 library for the polygon operations.

Clipper2 is part of Godot since version 4.2 as it was needed for the 2D navigation mesh baking.

According to the developer (and own testing) there is no reason to not upgrade:

  • The code is cleaner and faster
  • Clipper2 is easier to use with simple functions that handle all common uses
  • Floating point coordinates no longer need to be converted to integers before passing them into the library
  • And micro self-intersections and polygons with touching edges are now rarely seen in solutions

Clipper2 is a lot faster and scales better with complexity than Clipper1 which means runtime Geometry2D ops are less likely to cause performance issues and have less errors.

clipper_performance

Steps to reproduce

Replace Clipper1 code found in core/math/geometry_2d.cpp with Clipper2 functions and look out for regressions in the results.

The functions that need the upgrade are _polypaths_do_operation() and _polypath_offset().

Minimal reproduction project (MRP)

N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants