mapbox / earcut.hpp

Fast, header-only polygon triangulation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Colinear point creating an issue

pmoulon opened this issue · comments

I have a set of points that is creating an issue, I have a triangulation that provides a face that is having an area equal to 0:

0.0795366 -0.530036
-0.176999  -0.51317
-0.687401 -0.479614
-0.607259   0.73937
-0.244585  0.715526
0.191209 0.206457
0.186494 0.134742
 0.169533 -0.123232

Basically a face is created between the point [6,7,8] (0 area face).

Screen Shot 2019-09-10 at 3 28 44 PM

I would rather prefer to have [4,8,7] and [4,7,6] created instead.

Have you checked it's actually returning the face [6,7,8]? Earcut often filters colinear points, therefore I assume it returns [4,8,6] and ignores 7 completely. You'll find the discussion about this behaviour here: mapbox/earcut#74

Yes it returns the face [6,7,8]. It was bothering me, so I checked faces area and saw one was 0.

Thx you for pointing me to the earcut thread.

By design a face of 0 area should not be returned.