quadtree

Storing objects for locating by x,y coordinates

I'm trying to determine a fast way of storing a set of objects, each of which have an x and y coordinate value, such that I can quickly retrieve all objects within a certain rectangle or circle. For small sets of objects (~100) the naive approach of simply storing them in a list, and iterating through it, is relatively quick. However, f...

Quadtree vs Red-Black tree for a game in C++?

Hi everyone, 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 detection. I am not 100% certain that a quadtree is the best data structure...

Spatial Indexing

I want to create a large database of GPS coordinates that can be queried by saying "Return all coordinates that are within 'n' metres of [this coordinate]". I would like to know how to implement Quadtree Indexing in Sqlserver2008? I want to write a .net module that calls the query which uses quad tree so that i can retrieve the objects...

problem with quadTree & union

hi! i have the following quadtree-like structure, in which each cell can either be a inner node or a leaf. if it is a leaf, it can store a color. if it is a inner node, it stores pointers to four children (which can be either leaf or inner node): class RenderBucketCell{ public: RenderBucketCell(); RenderBucketCell(float R, floa...

Quadtree detects collision inaccurately

Hi, I am trying to implement a quadtree of rectangles (instead of points) to be used for collision detection. For some reason, overlap/intersection/collision is not always detected. I suspect this has something to do with the way an inserted collider looks for nearby colliders (see the "COLLISION A" and "COLLISION B" sections of Quadtr...

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 unit square (0,0)-(1,1), and in which the top-level node is not fixed absolutely? It's a...

Efficient way of locating and/or selecting graphic object in a fixed grid

I have a panel that is filled with a large number of circles (Ellipse2D). The circles are stored in a 2 dimensional array (rows and columns). My goal is to be able to "paint" the circles as I drag the mouse over them. I will eventually want to use selection shapes that will change the color of all the circles contained within the selec...

Are any of these quad-tree libraries any good?

It appears that a certain project of mine will require the use of quad-trees, something that I have never worked with before. From what I have read they should allow substantial performance enhancements than a brute-force attempt at the problem would yield. Are any of these python modules any good? Quadtree 0.1.2 <= No: unable to execu...

Building a Quadtree

I'm attempting to use a quadtree (a 4-ary tree) to hold the information in a given BMP. I'm struggling to figure out how to build the tree given any BMP. Basically the structure is such that every leaf represents a pixel. Each Node has 4 pointers each of which point to one of the four remaining quadrants in the image. Thus each node d...

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 Lua instead of C#) : http://www.codeproject.com/KB/recipes/QuadTree.aspx I've been able ...

a compression/packing problem

Hi everyone, I have a problem: Given an array nxm that contains 0's or 1's, I need group the 0 values into rectangles. At the beginning, I was used a simple quadtree, but different nodes in the same level of the tree have the same value. I'm not totally sure if the R-tree works for my problem or another data structure because I just will...

How do I... Quadtrees!

How can I go about creating a quadtree in PHP, is it even possible? I would like a "grid like" layout. So each "node" has 4 "exits" - north, south, east and west. Does anyone have some sample PHP code of a Quadtree because I couldn't find any documentation specifically for PHP :( I'll be your best friend... (possibly some Rep in th...

Smallest bounding quadtree node

I'm writing an integer-based quadtree structure which builds up from the node, and not down. To do this, I need to discover the next largest node which contains all my elements. If I have a preexisting node defined, then try to add an item outside of that node's bounds, it needs to create a larger node to encompass them both. I have (wha...

Decent (r-tree, quad-tree or similar) library in ruby for searching spatial data

I have a database of 20k+ cities with latitude and longitude and I need to make lot of nearest point queries (which city is the nearest to certain lat,long point) against this dataset. I guess an R-Tree or QuadTree would be a perfect data structure for this, but I haven't been able to find a working ruby implementation. Do you know any...