You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When preventOverlappingLines is set to true, DrawPolygonMode prevents placing new vertices that overlap with the polygon. However, it is possible to create a self-intersection that is not detected, as demonstrated here:
Screencast.from.2024-11-20.06-35-51.webm
Notice that the polygon was successfully created, despite it having a self-intersection. This is because the current implementation doesn't check for intersection of the closing line segment of the polygon (between the last placed vertex, and the first vertex).
Expected Behavior
The self-intersection created above shouldn't be possible when preventOverlappingLines is turned on. Intersection needs to be checked on the final line segment.
Steps to Reproduce
See screen capture above - with preventOverlappingLines turned on, it is still possible to create a self-intersecting polygon.
I'm not sure what the best solution here is, so would be grateful for some guidance before I attempt a PR to fix it. We could check that the whole tentative polygon has no intersections, but you will notice that in the example above it is still possible to make the polygon valid by placing a new vertex near the bottom left of the enclosed area - so it doesn't seem quite correct to block placement of the vertex.
The alternative would be to check the entire polygon on Enter/double-click - in which case the question is what the behaviour should be if a self-intersection is found at that stage: remove last placed vertex and don't complete?
Module
Description
When
preventOverlappingLines
is set totrue
,DrawPolygonMode
prevents placing new vertices that overlap with the polygon. However, it is possible to create a self-intersection that is not detected, as demonstrated here:Screencast.from.2024-11-20.06-35-51.webm
Notice that the polygon was successfully created, despite it having a self-intersection. This is because the current implementation doesn't check for intersection of the closing line segment of the polygon (between the last placed vertex, and the first vertex).
Expected Behavior
The self-intersection created above shouldn't be possible when
preventOverlappingLines
is turned on. Intersection needs to be checked on the final line segment.Steps to Reproduce
See screen capture above - with
preventOverlappingLines
turned on, it is still possible to create a self-intersecting polygon.Environment
Logs
No response
The text was updated successfully, but these errors were encountered: