-
Notifications
You must be signed in to change notification settings - Fork 10
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
Tripy-1.0.0 unable to process polygons supported in version 0.0.3 #3
Comments
I seem to be having the same problem.
I ran it over this set of points:
And received multiple instances where the new Because of this change, the The top image is the image produced by version 0.0.3 of code, while the bottom image is the version produced by version 1.0.0. Was the intended solution here to create a more robust comparison between the area of the triangle and the sum of the area of the smaller triangles? This check seems to break when provided numbers such as the points provided above. |
Pardon my belated reply - I only saw this issue report recently. The goal was to reduce the potential for error when it comes to certain narrow triangles that can result from earclipping. In certain cases these can lead to very inaccurate results in v0.0.3. An example of a working case is:
Which leads to the expected outcome: But scale it all down tenfold and you get:
Which leads to erroneous output: It was found that the strict comparison in v0.0.3 would lead to this problem in cases like these, leading to triangles being excluded that shouldn't be. I thought that comparing within a small range epsilon would solve the problem, and indeed in all the tests I ran with the v1.0.0 code this worked. However, clearly it doesn't work in all real world cases (I learned that generating interesting, non-trivial polygons is itself quite non-trivial). You'll notice both of the examples above are compared to a barycenter-based method of triangulation not currently used in Tripy but which is based on https://github.com/lionfish0/earclip. That method appears to be immune to the edge cases that earclipping can run into - however, it is also 3x-6x slower. (I suspect one could improve that with numpy, though in the end an optimized version may still be slower than earclipping.) I hoped that we could keep the speed of the present method instead of adding the complexity of barycenters, but if the edge cases in earclipping cannot be contained systematically it may be good to move to that instead. |
One big difference is that https://github.com/lionfish0/earclip. defines epsilon as 0.0000001 which is far higher than the value in tripy. Setting epsilon to higher value also in tripy seems to work much better. |
Hi,
We discovered with some colleagues by using different version of tripy that it was not able anymore to process some polygons that were supported in version 0.0.3.
Here is an example to reproduce the case.
It produces the following images:
As you can see in the second images, tripy was not able to produce any triangles.
I was reading the PR #2 and saw that you introduced some changes to handle some edge cases.
Is this a side effect ? Should the library be able to process this polygon (or not) ?
Should it at least produce some of the triangles ?
The text was updated successfully, but these errors were encountered: