Habrador / Computational-geometry

Computational Geometry Unity library with implementations of intersection algorithms, triangulations like delaunay, voronoi diagrams, polygon clipping, bezier curves, ear clipping, convex hulls, mesh simplification, etc
https://www.habrador.com/
MIT License
1.24k stars 150 forks source link

JarvisMarshArlorithm2D: must test for points starvation #4

Open eplesse opened 3 years ago

eplesse commented 3 years ago

Hello Erik. First, thanks for your great job . I mainly used your jarvisMarhsallAlgorithm2D. I wanted to raise your attention upon the following trap in which I have fallen quite often (I deal with hundrerds of various 2d Shapes points and need to build convex hull of each shape). Even if I did not spent much time to understand precisely the algorithm, I had to change line 54 of JarvisMarchAlgorithm2D.cs like this:

 while (true && points.Count > 0)

Since all points may habe been removed by code at line 125 and that and radom access in points in made line 61

This has been enough for my needs but It might need your insight

Anyway, thanks again. This has been really usefull for me.

Emmanuel