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

Incorrect output for self-intersecting polygon #48

Open
sergeyvin opened this issue Aug 13, 2022 · 0 comments
Open

Incorrect output for self-intersecting polygon #48

sergeyvin opened this issue Aug 13, 2022 · 0 comments

Comments

@sergeyvin
Copy link

Brief intro. My original shape boundaries are polylines (arcs + line segments) . Then shapes are split to positive/negative arc segments + polygon. Arc segments are handled separately. Polygon is triangulated by poly2tri.
The problem is sometimes polygon can be self-intersecting because of cutting arc segments. It happens pretty rare, self-intersection check has the same complexity as triangulation so it is faster to try to triangulate and fail rather than check polygon before.
In most cases poly2tri generates exceptions for self-intersecting polygons.

But there are few cases when triangulation completes successfully but there are triangle even of original polygon. There is workaround to check for polygon bbox but would be great if poly2tri can generate exception in this case as well
Recently reproduced it with very simple example - just one arc path and 11 points.
2987.63 2259.05
2987.63 2254.95
2997.62 2254.95
3006.56 2250.48
3019.17 2244.17
3025.48 2231.56
3029.95 2222.62
3029.95 2212.63
3034.05 2212.63
3029.15 2233.39
3008.39 2254.15

bad_triangulation

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

No branches or pull requests

2 participants
@sergeyvin and others