Jump to content


Reversing the winding order of a tri-strip


3 replies to this topic

#1 Goz

    Senior Member

  • Members
  • PipPipPipPip
  • 574 posts

Posted 02 September 2005 - 09:54 AM

I need to reverse the winding order of an arbitrary length tri-strip. Is there an elegant way to do this?

I though, initially, that i might be able to do it by swapping the 2nd and 3rd vertex indices over but this, unfortunately, breaks the triangle AFTER the next one.

So i considered reversing the tri-strip but this only works for an odd number of triangles ...

Is there an actual way of doing it? Or is it not possible?

Note: I am NOT using DirectX or OpenGL ... degenerates are NOT supported so please don't suggest that. I want to take an arbitrary strip with verts v1, v2, v3 ... vn and reverse its winding order without adding any extra vertices. Is it possible?

#2 Wernaeh

    Senior Member

  • Members
  • PipPipPipPip
  • 368 posts

Posted 02 September 2005 - 01:15 PM

For even-numbered triangle strips, I think inverting each second "interior" edge would work, that is, for 2 connected triangles, invert the edge that connects them.

I'm still thinking about non-even triangle strips, though.

Hope this helps,

Cheers,
- Wernaeh
Some call me mathematician, some just call me computer guy. Yet, I prefer the term professional weirdo :)

#3 Goz

    Senior Member

  • Members
  • PipPipPipPip
  • 574 posts

Posted 02 September 2005 - 02:17 PM

Wernaeh said:

For even-numbered triangle strips, I think inverting each second "interior" edge would work, that is, for 2 connected triangles, invert the edge that connects them.

How does this work? You add one extra vertex per triangle (after the first full 3 verts on the 1st tri) so how can you possibly invert the direction of an edge?

I have no control of the rasteriser im using ... i need to be able to do it from indices only...

Quote

I'm still thinking about non-even triangle strips, though.

Could always just reverse the strip for them ;)

#4 Reedbeta

    DevMaster Staff

  • Administrators
  • 4780 posts
  • LocationBellevue, WA

Posted 02 September 2005 - 07:06 PM

I believe all that's necessary in either case is to swap pairs. E.g. swap indices 0 and 1, 2 and 3, 4 and 5, etc...

0 2 4    1 3 5
| /| /| --> |\ |\ |
|/ |/ |    | \| \|
1 3 5    0 2 4

reedbeta.com - developer blog, OpenGL demos, and other projects





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users