Java QuadTree Implementation

This is a simple QuadTree implementation in Java.

The code can be found at Github:


PointQuadTree<String> tree = new PointQuadTree<String>(new Point(0, 0), new Dimension(600, 600));
	tree.insert(1, 3, "1");
	tree.insert(11, 32, "2");
	tree.insert(11, 52, "3");
	tree.insert(454, 555, "4");
	tree.insert(353, 555, "5");
	tree.insert(552, 555, "6");
	tree.insert(551, 555, "7");

This code shows how to create a new QuadTree that holds strings. At the creation of the QuadTree the start coordinates and the bounds of the tree must be specified. is an executable application that shows how to work with the QuadTree data. Leftclick will insert a new point. Rightclick will highlight the elements within the identified cell/node.

image:/images/quadtree/quadtree.png is an executable application that show how to use the spatial QuadTree implementation. In this case the quadtree will be used to store some images. The QuadTree has a specific dimension (512x512 in this case). We just add a buch of different images which have different sizes. The tree will try to use the free space as efficent as possible. One usecase for this might be the automatic generation of tilemaps or Sparse Virtual Textures