It sounds as if your normals are incorrect. Your algorithm to flip the
triangles to have consistent neighbour orientation is correct?
It might be that you have an incorrect surface to start with e.g. more
than 2 faces per edge or faces on top of each other. Have a look at it
with e.g.
Dear DXplorers,
I am on the verge of giving up on ever fixing a buggy surface rendering of
my artificial-heart pump chamber, but maybe someone can give me an angle I
haven't tried yet.
I generated a set of ~1-mm-spaced nodes to describe the surface, then
formed triangular connections