Quadtree library for Lua
Samuel Stauffer (email@example.com)
QuadTree.new(left, top, width, height)
Creates and returns a new instance of the QuadTree class with
the given position and size.
Subdivides (splits) the QuadTree into four sub QuadTrees
Adds an object to the QuadTree
Removes an object from the QuadTree with an option to use the previous
coordinates of the object.
Removes all the objects from the QuadTree
Updates an object that's already in the QuadTree, moving
it from its previous location to its current location.
Returns a table of all objects near the given object
The objects used by the QuadTree must support the following properties:
- object.x - current X coordinate
- object.y - current Y coordinate
- object.prev_x - previous X coordinate
- object.prev_y - previous Y coordinate
- object.width - width of object
- object.height - height of object
You can download this project in either
You can also clone the project with Git
$ git clone git://github.com/samuel/lua-quadtree