Quote:Original post by QuinnieQuote:Original post by i_luv_cplusplus
Tell me how you figured out these indices, and I shall be your sex slave :) I can't figure it out
... Note that there may still be some issues regarding the CW and CCW thing
It may not be the most elegant solution, but here is a simple algorithm for generating the indexes while maintaining CW/CCW.
Using you example grid above...
First, generate the indexes as if you are stripping a standard grid:
0, 9, 1, 10, 2, 11, 3, 12, 4, 13, 5, 14, 6, 15, 7, 16, 8, 17, 17, 9, 9, 18, 10, 19, 11, 20, 12, 21, 13, 22, 14, 23, 15, 24, 16, 25, 17, 26, 26, 18, 18, 27, 19, 28, ...
Next, instead of removing vertexes, you move them. According to the diagram, the following vertexes are moved like this: From To 1 2 3 4 5 6 7 8 9 18 17 26 27 36
Finally, replace the indexes of the moved vertexes with the indexes of the vertexes they are moved to: 0, 18, 2, 10, 2, 11, 4, 12, 4, 13, 6, 14, 6, 15, 8, 16, 8, 26, 26, 18, 18, 18, 10, 19, 11, 20, 12, 21, 13, 22, 14, 23, 15, 24, 16, 25, 26, 26, 26, 18, 18, 36, 19, 28, ...
The removed triangles are still in the strip, but are not drawn because they are now degenerate. It results in the same number of triangles, but that is not an issue.