Edit - New solution flipping curves
When a curve changes side, the curve vectors are opposite and that makes the triangles flip sides.
To correct this, we need an additional unflipping method:

The flipping method:
- For each vertex, calculates whether it's flipped or not comparing to the previous vertex (dot product negative means opposite direction vectors)
- Whenever a triangle is flipped from the previous, we accumulate 1.
- The odd values will then need to be flipped while the even values are ok


Old suggestions:
For N points, indices N and -1 don't exist. You're sampling nothing at the start and end.
Alternative solution
Anything against using the curve normal? It works in a very similar way, although not exactly following the bends.

Bend solution
You will need to treat special cases:
- Start point
- End point
- Straight segments
In this example, I solve the start and end points by using "Offset point in line", which repeats the index when the end of the line is reached.
But this example doesn't treat straight segments:
