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

clip_polyline_with_polygon inconsitency #88513

Open
Arkelen7777 opened this issue Feb 18, 2024 · 1 comment
Open

clip_polyline_with_polygon inconsitency #88513

Arkelen7777 opened this issue Feb 18, 2024 · 1 comment

Comments

@Arkelen7777
Copy link

Tested versions

  • Reproductible in 4.2.1, 4.1.1, 3.4.4

System information

Godot v4.2.1.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1050 (NVIDIA; 31.0.15.3623) - Intel(R) Core(TM) i3-4160 CPU @ 3.60GHz (4 Threads)

Issue description

The function clip_polyline_with_polygon gives inconsistent results regarding the position of the polyline and the polygon involved in the clipping.
When the triangle is above the horizontal line and they cross exactly at one point the clipping results in 2 lines. Which is good.
Whereas the result is 0 (no clipping/no crossing) when the triangle is below the horizontal line even though they cross at exactly one point.

Steps to reproduce

The MRP set up a simple scene with 2 polygons and 2 lines where polygons and lines cross. In one situation the clipping works but not in the other one.
Prints display points informations to show the inconsistency where both clipping result should be 2.

Minimal reproduction project (MRP)

TestClipPolyline.zip

@rburing
Copy link
Member

rburing commented Apr 6, 2024

Thanks for the clear MRP! Updating Clipper1 to Clipper2 as in #90153 fixes the direction of the clipped lines, and it makes the clipping of the line by the lower triangle result in one line, the original line. So it still doesn't fix this issue, but it's a small step in the right direction.

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

No branches or pull requests

3 participants