Sign in to follow this  

quadtree tutorial confused

This topic is 4861 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello. I was reading quadtrees tutorial( http://www.gamedev.net/reference/articles/article1303.asp ) and didn't undertstand the connection between these three: "unsigned int uiVertexStrip1[8]; unsigned int uiVertexStrip2[8]; unsigned int uiVertexStrip3[8]; unsigned int uiVertexStrip4[8];" "As we said each leaf would hold 16 triangles, we have 4 arrays, named uiVertexStrip1 to uiVertexStrip 4. Each of these arrays holds 4 indexed triangles in the form of a triangle strip." "The Leaf Width is the number of triangles across in each leaf. As we said each leaf will be one cell by one cell, we also said each cell contains 16 triangles. In our case, seeing as cells are 16x16 triangles, the Leaf Width will be 4. Grid Width is the width of the grid in triangles. As each cell is 4 triangles across, 16 cells x 4 is 64." The first thing I couldn't understand is how can a cell be of 16 triangles? Maybe like this(dots are vertices): . . . . . . . . . . . . . . . . but this is 18 triangles. I guess it can only be like this so it can be 16 triangles(doesn't look like a cell to me but I guess thats what the author meant): . . . . . . . . . . . . . . . or . . . . . . . . . . . . . . . If so, why are uiVertexStripX arrays are of 8 elements each when it says in the tutorial that each uiVertexStripX will contain 4 indexed triangles. And to do this we only need 6 elements in each array. Why 8? Argh. Also, why author uses 4 separate strip arrays instead of one? [Edited by - id_roman on August 25, 2004 6:48:29 PM]

Share this post


Link to post
Share on other sites
Example:

. . .
. . .
. . .
. . .
. . .

or

0 1 2
3 4 5
6 7 8
9 10 11
12 13 14

"Each of these arrays holds 4 indexed triangles in the form of a triangle strip."
Ok. Lets fill the arrays:
uiVertexStrip1 {0,1,3,4,2,5} 6 elements not 8 as declared
uiVertexStrip2 {3,4,6,7,5,8} 6 elements not 8 as declared
uiVertexStrip3 {6,7,9,10,8,11} 6 elements not 8 as declared
uiVertexStrip4 {9,10,12,13,11,14} 6 elements not 8 as declared

Hello?

[Edited by - id_roman on August 25, 2004 6:55:20 PM]

Share this post


Link to post
Share on other sites
AFAICT, the implementation is a little off. Most of the counts are wrong and some of the implementation only works in specific cases. The whole strip thing seemed a little odd, since he didn't go into why he needed them. I can imagine the code was a part of a larger setup and some of the implementational details showed through as noise in his explanation.

-Morten-

Share this post


Link to post
Share on other sites

This topic is 4861 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this