A quadtree is a geometric data structure for storing points in two-dimensional space. Quadtrees recursively partition a space into four quadrants.
Questions tagged [quadtree]
380 questions
9
votes
8 answers
Creating a generic list of objects in C#
By way of an intro, I'm creating a basic Quadtree engine for personal learning purposes. I'm wanting this engine to have the capability of working with many different types of shapes (at the moment I'm going with circles and squares) that will all…

Djentleman
- 1,137
- 5
- 13
- 28
8
votes
3 answers
Quadtree traversal
I'm trying to implement a forward iterator for a quadtree. Unfortunately I don't seem to be able to find any resource about traversal in a quadtree.
Can anybody point me in the right direction?

Matt Mils
- 81
- 1
- 2
8
votes
1 answer
Constructing a quadtree such that there is only one level difference between adjacent nodes (LOD)
I'm trying to build a quadtree which subdivides a region based on a position and a maximum depth. I want to use this to implement level of detail in terrain. In other words I have a position (x, y), a region (x, y, width), and I pass it to some…

crazymage
- 128
- 2
- 6
8
votes
6 answers
Quadtree vs Red-Black tree for a game in C++?
I have been looking for a quadtree/quadtree node implementation on the net for ages. There is some basic stuff but nothing that I would be able to really use it a game.
My purpose is to store objects in a game for processing things such as collision…

Brock Woolf
- 46,656
- 50
- 121
- 144
8
votes
2 answers
What is an infinite scaleless quadtree called?
2D spatial indexing question:
What do you call a data structure that is essentially an infinite* quadtree whose nodes contain neither absolute coordinates nor absolute scales -- in which the coordinate system of each node has been normalized to the…

Todd Lehman
- 2,880
- 1
- 26
- 32
7
votes
1 answer
Best solution for 2D occlusion culling
In my 2D game, I have static and dynamic objects. There can be multiple cameras. My problem: Determine objects that intersect with the current camera's view rectangle.
Currently, I simply iterate over all existing objects (not caring wheter dynamic…

Hamilton
- 79
- 1
- 2
7
votes
3 answers
How does a QuadTree work for non-square areas?
I understand how quad trees work on square images (by splitting the image until the section is a single colour, which is stored in the leaf node).
What happens if the image has one dimension longer that the other, you may end up with a 2x1 pixel…

user559142
- 12,279
- 49
- 116
- 179
7
votes
1 answer
QuadTrees - how to update when internal items are moving
I've implemented a working QuadTree. It subdivides 2-d space in order to accomodate items, identified by their bounding box (x,y,width,height) on the smallest possible quad (up to a minimum area).
My code is based on this implementation (mine is in…

kikito
- 51,734
- 32
- 149
- 189
6
votes
1 answer
Quad trees pertaining to 2d collision
I've been studying this:
https://github.com/mikechambers/ExamplesByMesh/blob/master/JavaScript/QuadTree/src/QuadTree.js
and I believe I understand the general idea about quad trees, although I do have two questions about how they work, and the…

David Zorychta
- 13,039
- 6
- 45
- 81
6
votes
2 answers
Data Structure for Spatial Agent Based Modeling
What are some good data structures for keeping track of agents in a two-dimensional, spatial simulation?
I've seen some references to quadtrees (which I understand) and kd-trees (which I don't understand very well).
I'm looking for something through…

Peter
- 4,021
- 5
- 37
- 58
6
votes
1 answer
Quadtree Removal
I am writing a removal method for a quad tree.
Now when you remove an item in a node, you will need to check its siblings to see if you need to collapse the nodes and merge them into one.
For checking the siblings, should I store a pointer to the…

darksky
- 20,411
- 61
- 165
- 254
6
votes
2 answers
Are there any examples of quadtrees being used in HTML5 Canvas?
Quadtrees are used as an optimisation in games and elsewhere for spatial organisation of entities http://en.wikipedia.org/wiki/Quadtree.
Are there any examples of quadtrees being used for HTML5 Canvas?

Sycren
- 539
- 2
- 5
- 15
6
votes
2 answers
Pure Python Quadtree Implementation
All,
There are a few examples on implementing a quadtree using Python but my question is, does anyone know of a class written in pure python as in a single .py file that I can easily include in my project? The three most popular packages are listed…

aeupinhere
- 2,883
- 6
- 31
- 39
6
votes
4 answers
Trying to understand Quadtree concept and apply it to storing coloring info of an image
I've read so many articles, but none seem to answer this question. Or maybe I'm just not understanding. I'm attempting to build a quadtree so that it can represent an image. The leaf nodes are to hold pixels, and non-leaf nodes will hold the average…

Snowman
- 31,411
- 46
- 180
- 303
6
votes
1 answer
Quadtree explanation and C implementation
Please explain quadtrees and provide simple code (preferably in C) for insertion and searching.

algo-geeks
- 5,280
- 10
- 42
- 54