Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Triangle strip and degenerate triangles

My question could be stupid but I didn't find good example of triangle strip utilization:

http://i.stack.imgur.com/KL8jk.png

With vertices like that:

A: -0.5f, -0.5f,  // Bottom left.
B: -0.5f,  0.5f,  // Top left.
C:  0.5f, -0.5f,  // Bottom Right.
D:  0.5f,  0.5f   // Top right.
----------------------------------
B--D
|\ |
| \|    
A--C    

Sometimes, in examples, we can find this configuration:

  • A, B, C, C, B, D

or this:

  • A, B, C, D

What is right? I've tried both and both works.

Now I would like to use degenerate triangle to merge two square.

B--D    F--H    
|\ |    |\ |    
| \|    | \|    
A--C    E--G    

Here is what I've got:

ABCD + DEEF + EFGH

But here again, I've got some artifacts sometimes.

like image 607
LongDuZboub Avatar asked Sep 10 '13 09:09

LongDuZboub


People also ask

What is a degenerate triangle?

A degenerate triangle has all three of its vertices lying on the same straight line, so the triangle is squashed completely flat.

Are degenerate triangles triangles?

A degenerate triangle is the "triangle" formed by three collinear points. It doesn't look like a triangle, it looks like a line segment. A parabola may be thought of as a degenerate ellipse with one vertex at an infinitely distant point.

How do triangle strips work?

A triangle strip is a series of connected triangles. Because the triangles are connected, the application does not need to repeatedly specify all three vertices for each triangle. For example, you need only seven vertices to define the following triangle strip.

Why are triangle strips efficient?

The primary reason to use triangle strips is to reduce the amount of data needed to create a series of triangles. The number of vertices stored in memory is reduced from 3N to N + 2, where N is the number of triangles to be drawn. This allows for less use of disk space, as well as making them faster to load into RAM.


1 Answers

If you use backface culling, the two configurations would not produce the same result. In the ABCD case, BCD is counterclockwise, whereas in the ABCCBD case, CBD is counterclockwise. The right way to draw two quads would depend on whether you care about orientation. I would suggest ABCDDEEFGH.

like image 187
JWWalker Avatar answered Oct 03 '22 09:10

JWWalker