I was getting the ‘Degenerate triangles may have been created’ error during contour triangulation and traced it back to a problem with the RemoveDegenerateSegments method in VoxelContour.cs removing the wrong parts.
This was causing some very odd vertices when it trimmed the tail of one vertex and the start of the next, but was masked in most cases by the triangulate error catching.
I think it should also have after removal:
Or equivalent subloop to re-check the newly shifted pair, since it’d otherwise go to the next index at the same time as shifting the indexed list back by removing and miss out a pair entirely.
(only an issue if 3 or more identical xz vertices in a row are passed in)
The original removeDegenerateSegments from the recast C++ source doesn’t seem to account for this part, so I don’t know if 3 identical is ruled out before this or if it’s just overlooked there too.