Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] - [Matrix1Utils][d3dfunc] Quadtree

Author
Message
Neuro Fuzzy
16
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 6th Jul 2011 11:24 Edited at: 6th Jul 2011 11:31



Basically... A quadtree is used to separate space, and organize objects. It's used a lot in situations where points are clustered together.

I'm feeling especially lazy right now, and honestly it's better to write your own quadtree code than to learn how I do it, so I'll drop this code here with admittedly little information for you.You can press the spacebar or click to add points. if it goes too fast, limit the framerate. There's one bug with the code where you'll sometimes see subtrees with nothing in them - That's bad.

[edit]
also:
A quadtree is good for grouped points. In this demo, every point eventually tends to spread out, and become homogeneously distributed across the screen. That doesn't exercise the benefits of a quadtree. if you comment out the code responsible for moving the points, you can see the grouping much better (like so


[edit2]
also, this is kinda old code of mine. I'm just posting it because I figure other people could use it xD
That means I'm not immediately familiar with the code.


Why does blue text appear every time you are near?

Login to post a reply

Server time is: 2024-04-20 12:38:27
Your offset time is: 2024-04-20 12:38:27