Package jahuwaldt.util
Class PointRegionQuadTree<P extends XYPoint>
- java.lang.Object
-
- jahuwaldt.util.PointRegionQuadTree<P>
-
- Type Parameters:
P
- The type of XYPoint stored in the QuadTree.
public class PointRegionQuadTree<P extends XYPoint> extends java.lang.Object
A QuadTree data structure for storing 2D XYPoint objects.Modified by: Joseph A. Huwaldt
- Version:
- February 5, 2018
- Author:
- Joseph A. Huwaldt, Date: February 5, 2018
-
-
Constructor Summary
Constructors Constructor Description PointRegionQuadTree(P xyPoint, double width, double height)
Create a QuadTree who's upper left coordinate is located at x,y and it's bounding box is described by the height and width.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
insert(P xyPoint)
Insert point at X,Y into tree.java.util.List<P>
queryRange(double x, double y, double width, double height)
Range query of the QuadTree.boolean
remove(P xyPoint)
Remove point at X,Y from tree.
-
-
-
Constructor Detail
-
PointRegionQuadTree
public PointRegionQuadTree(P xyPoint, double width, double height)
Create a QuadTree who's upper left coordinate is located at x,y and it's bounding box is described by the height and width.- Parameters:
xyPoint
- XYPoint representing the min-X, min-Y corner of the bounding box of all the 2D points.width
- Width of the bounding box containing all pointsheight
- Height of the bounding box containing all points
-
-
Method Detail
-
queryRange
public java.util.List<P> queryRange(double x, double y, double width, double height)
Range query of the QuadTree. Return all the points in the quad-tree that fall in the specified bounding box.- Parameters:
x
- The minimum X-coordinate of the region to search for points in.y
- The minimum Y-coordinate of the region to search for points in.width
- The width of the region to search for points in.height
- The height of the region to search for points in.- Returns:
- A collection of points that fall in the search region.
-
insert
public boolean insert(P xyPoint)
Insert point at X,Y into tree.- Parameters:
xyPoint
- The 2D point to insert.- Returns:
- True if the point was successfully inserted.
-
-