Closed Dsearle2 closed 6 months ago
On further investigation it seems that this is related to issue the previous issue mentioned by EricBeetsOfficial-Opuscope. The infinite loop seems to occur in PlainShape.Split.
Here are a set of points that cause a freeze:
private Vector2[] _points = new Vector2[] { new Vector2(-0.42f, -0.38f) new Vector2(-0.44f, -0.36f) new Vector2(-0.44f, -0.32f) new Vector2(-0.46f, -0.3f) new Vector2(-0.46f, -0.28f) new Vector2(-0.48f, -0.26f) new Vector2(-0.48f, -0.24f) new Vector2(-0.5f, -0.22f) new Vector2(-0.5f, -0.2f) new Vector2(-0.48f, -0.2f) new Vector2(-0.46f, -0.22f) new Vector2(-0.42f, -0.22f) new Vector2(-0.4f, -0.24f) new Vector2(-0.36f, -0.24f) new Vector2(-0.34f, -0.26f) new Vector2(-0.34f, -0.28f) new Vector2(-0.38f, -0.32f) new Vector2(-0.38f, -0.34f) };
Hello.
Thanks for your test.
Do you know a debugging project for this library? Debug Project
I added your test case and it works fine.
You know that this algorithm under the hood uses integer math, so there may be an accuracy problem when running the same data (tests) on different processors. This is because the algorithm for rounding a floating point number to an integer may vary slightly across different cpu architectures. And also you should say what kind of IntGeom object do you have? Is this by default or not? This object has some properties that can affect the float to int convertation process.
It will be better if you give me an array of IntVector. In this case the triangulation will be deterministic in any cpu and I can easily detect a problem.
And Yes this library is not ideal because it in some degenerate cases and self intersections it's not working.
Right now I managed all this problems in other my triangulation library which will be more power full. But for now it's only available for swift.
I am using Triangulation to convert some contours to meshes and I frequently seem to run into situations where the application freezes. I have attached an image of a contour that causes this freezing, if needed I'll try and extract the points used as well but it seems to occur in many cases. I've tried adding limit counters to the while loops to break out of them but the application still freezes so I'm not sure where the problem occurs.
Image of contour that causes freeze (contour in red):![image](https://github.com/iShapeUnity/Triangulation/assets/1111913/e902dc37-633c-46b6-8060-b6ce146cc1cf)