Hello to the people of the swamp:
It is necessary to follow the path opened by the great masters.
Paul Bourke's routine is perfect for areas without convexity. And very fast.
She generates some small triangles on the edges of the contour.
But looking for a blatantly tilted normal can locate and eliminate these ghost triangles.
Another thing is to do a very professional program to do it automatically so perfect.