Sign in to follow this  

Visibility Tests For QuadTree

This topic is 3872 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

Hi, I have a level 2 quad tree (16 nodes). What I want to do is to determine which node(s) in the quad tree to actually render. The view rectangle that I have setup can only span either 1, 2 or 4 nodes. Any help appreciated. MAMEman.

Share this post


Link to post
Share on other sites
When you're inserting a rectangle into the quadtree, you look for the smallest node that it fits in. Now, you're looking for all nodes that touch your screen rectangle. Basically, what you should do is check against a node to see if it collides with the screen rectangle. If it does, add it to the list of visible nodes and continue checking it's child nodes. By the end, you should have a list containing all (partially) visible nodes.

Share this post


Link to post
Share on other sites
Hmmm... Thanks Captain P. I'm not really sure how your infos could be put into practice given my implementation. However I was maybe thinking along the lines of doing some sort of point test to determine which octant(s) that I should render. But I'm not to sure on how to actually implement it.

Share this post


Link to post
Share on other sites
Captain P,

NOW I actually understand what you are getting at!. When you mentioned
Quote:

inserting a rectangle into the quadtree

I thought that you meant inserting the rectangle as an object, d'oh. But now I know you simply placing the view rectangle at the root and recursively search the tree for the least bounding square that contains the view rectangle. Anyways I understand now and have a pretty fast rendering routine for my terrain.

Thanks ;)

MAMEman.


Share this post


Link to post
Share on other sites

This topic is 3872 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