Triangle strips cause vtkReverseSense to give incorrect output
The vtkReverseSense filter reverses the windings of the cells by reversing the order of their point Ids. This works on polygons, but it does not work for triangle strips that have an even number of triangles. Consider the following strip:
In both the original (red) and the reversed (blue) ordering, the winding is counter-clockwise. In other words, reversing the ordering does not reverse the winding.
For strips with an odd number of triangles, reversing the ordering does reverse the winding. I'll leave it as an exercise for the reader to visualize why this is so.
For even-length triangle strips, the only way to reverse their winding is to decompose them into two or more odd-length strips, and then reverse each of those odd-length strips. Either that, or the strips can simply be decomposed into triangles.
There are two different approaches that could be taken to fix this issue:
-
Add documentation to the vtkReverseSense header that states that it gives incorrect results for triangle strips, and print a warning when vtkReverseSense encounters an even-length triangle strip. The warning can tell people to apply vtkTriangleFilter first.
-
Decompose even-length triangle strips into odd-length triangle strips within vtkReverseSense. The disadvantage of doing this is that users will not expect the reversing of the winding to require a change in the number of cells. Also, it adds a fair bit of complexity to a rarely-used filter.