org.jhotdraw.geom
Class QuadTree<T>
java.lang.Object
org.jhotdraw.geom.QuadTree<T>
public class QuadTree<T>
- extends java.lang.Object
A QuadTree allows to quickly find an object on a two-dimensional space.
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.
- Version:
- 2.0 2006-12-06 Renamed from QuadTree2DDouble to QuadTree because
this class isn't a Shape2D class.
1.0 2006-01-14 Derived from class QuadTree.
- Author:
- Werner Randelshofer
Constructor Summary |
QuadTree()
Creates a new instance. |
QuadTree(java.awt.geom.Rectangle2D.Double bounds)
|
Method Summary |
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()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
QuadTree
public QuadTree()
- Creates a new instance.
QuadTree
public QuadTree(java.awt.geom.Rectangle2D.Double bounds)
add
public void add(T o,
java.awt.geom.Rectangle2D.Double bounds)
reorganize
public void reorganize()
remove
public void remove(T o)
findContains
public java.util.Collection<T> findContains(java.awt.geom.Point2D.Double p)
findIntersects
public java.util.Collection<T> findIntersects(java.awt.geom.Rectangle2D r)
findIntersects
public java.util.Collection<T> findIntersects(java.awt.geom.Rectangle2D.Double r)
findInside
public java.util.Collection<T> findInside(java.awt.geom.Rectangle2D.Double r)