Questions tagged [quadtree]

A quadtree is a geometric data structure for storing points in two-dimensional space. Quadtrees recursively partition a space into four quadrants.

380 questions
-1
votes
2 answers

How to find unique pairs of a quad tree?

I am using a quad tree data structure to find nearby objects on a 2D plane. I have already implemented a working quad tree which returns an array for each object including all of it's neighbours. The problem is, I need each unique pair of objects…
-1
votes
1 answer

How to improve performance of QuadTree code to prevent program from freezing

I'm simulating the collision of two star clusters, so basically doing an N-body problem, in C++. I'm using the Barnes-Hut method to help do this. I've written my QuadTree code and the main code to run the simulation and it works up until the…
Zachary
  • 47
  • 5
-1
votes
1 answer

RecursiveFree Function - Warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]

I have a function which recursively frees: #include "treeStructure.h" void destroyTree (Node* p) { if (p==NULL) return; Node* free_next = p -> child; //getting the address of the following item before p is freed free (p);…
anon2000
  • 57
  • 1
  • 8
-1
votes
1 answer

OCaml Pathfinding in Quadtree maze

I have a quadTree type defined by that : type 'a quadtree = | Empty | Leaf of 'a | Node of 'a quadtree * 'a quadtree * 'a quadtree * 'a quadtree;; Rooms defined by type room = { n : bool; e : bool; s : bool; w : bool; ps : coord; exit :…
-1
votes
2 answers

How to store a bmp file in a QuadTree in C++?

I would like to read and store a BMP file in a QuadTree: An example of the BMP file would be: P1 4 4 1 0 1 1 0 1 0 0 1 1 0 0 1 1 0 0 and the structure of the QuadTree I have thought of is: struct QuadTreeNode{ int size; struct QuadTreeNode…
Wryfyng
  • 31
  • 8
-1
votes
1 answer

When representing 2^n x 2^n matrices using quadtrees

I've just found the definition on my textbook and can't imagine what nexp is supposed to do/mean: data (Eq a, Show a) => QT a = C a | Q (QT a) (QT a) (QT a) (QT a) deriving (Eq, Show) data (Eq a, Num a, Show a) => Mat a = Mat { nexp ::…
gremo
  • 47,186
  • 75
  • 257
  • 421
-1
votes
1 answer

Which data structure should I use to store large 10,000 data set and do fastest search ,and take least memory?

*Suppose I have 10,000 circle(x,y,r) values , and i want to find a point (p1,p2) lies in which circle , to get fastest response for this query what data structure should i use to store those 10,000 circle data. It is a static data ,means one time…
SK17
  • 182
  • 4
  • 15
-1
votes
1 answer

Efficient quadtree implementation in python

For a project I'm working on I'm trying to write some code to detect collisions between non-point particles in a 2D space. My goal is to try to detect collision for a few thousand particles at least a few times per time step which I know is a tall…
-1
votes
1 answer

Flipping QuadTree in recursive abstract code

I'm trying to flip a quad tree about the vertical axis recursively, but without using a particular PL. In which case I've written the following, but I'm 100% it's not actually good, and I can't quite sure I understand it as well. flip(quadtree) { …
kx5
  • 17
  • 2
-1
votes
1 answer

2d space indexing that supports efficient adding and removing static circular regions

I need to quickly set all pixels in a circle (x0,y0,r) to solid or empty on a big, per-pixel map. Like in worms or liero game when you blow up terrain with a bomb. I considered quad tree and simple 2d array, but quad tree seems bad for…
ajuc
  • 590
  • 6
  • 12
-1
votes
2 answers

How do tree searches deal with edge errors in nearest-neighbor searches?

Concerning tree searching algorithms, particularly quad-tree and r-tree, how do they account for edge errors when finding nearest neighbors. I'm not good at explaining this with words so I made some pictures. For the picture the input coordinate to…
wowohweewah
  • 429
  • 5
  • 16
-1
votes
1 answer

Having issue creating recursive constructor

I'm trying to build Quad-tree which receive array of points and split them into 4 cells. those 4 cells(cell1...cell4) are suppose to be created recursively but it doesn't works. What I'm doing wrong? wasted all day trying fix it. I erased some basic…
Dima B
  • 39
  • 7
-1
votes
2 answers

efficient C++ template implementation for 2D range queries

I need to store custom point objects (getX() and getY() are provided) in an efficient way to perform range queries. So i was looking for templated implementations of quadtree, kd-tree or similar. For example like this:…
the_ducky
  • 165
  • 1
  • 12
-1
votes
1 answer

Visualising a QuadTree in Java

I am trying to visualise my QuadTree in Java but I can't seem to get the positioning right. Basically, I want to recursively subdivide the canvas into rectangles if a node exists in the tree for that area. Here is what I have currently: private…
Jonno_FTW
  • 8,601
  • 7
  • 58
  • 90
-1
votes
1 answer

presort data for balanced quadtree

The PMR Rectangle Quadtree is a quadtree which has an list of (Rectangle) objects in each leaf. This is called a bucket. The structure of this quadtree is dependent on the order of inserting the elements. The inventor of that quadtree proposed to…
AlexWien
  • 28,470
  • 6
  • 53
  • 83
1 2 3
25
26