public class QuadTree<T>
extends java.lang.Object
implements java.io.Serializable
QuadTree recursively subdivides a space into four rectangles. Each node of a QuadTree subdivides the space covered by the rectangle of its parent node into four smaller rectangles covering the upper left, upper right, lower left and lower right quadrant of the parent rectangle.
Constructor and Description |
---|
QuadTree()
Creates a new instance.
|
QuadTree(java.awt.geom.Rectangle2D.Double bounds) |
Modifier and Type | Method and Description |
---|---|
void |
add(T o,
java.awt.geom.Rectangle2D.Double bounds) |
java.util.Collection<T> |
findContains(java.awt.geom.Point2D.Double p) |
java.util.Collection<T> |
findInside(java.awt.geom.Rectangle2D.Double r) |
java.util.Collection<T> |
findIntersects(java.awt.geom.Rectangle2D.Double r) |
java.util.Collection<T> |
findIntersects(java.awt.geom.Rectangle2D r) |
void |
remove(T o) |
void |
reorganize() |
public QuadTree()
public QuadTree(java.awt.geom.Rectangle2D.Double bounds)
public void add(T o, java.awt.geom.Rectangle2D.Double bounds)
public void reorganize()
public void remove(T o)
public java.util.Collection<T> findContains(java.awt.geom.Point2D.Double p)
public java.util.Collection<T> findIntersects(java.awt.geom.Rectangle2D r)
public java.util.Collection<T> findIntersects(java.awt.geom.Rectangle2D.Double r)
public java.util.Collection<T> findInside(java.awt.geom.Rectangle2D.Double r)