public class KdTree extends Object
This implementation supports detecting and snapping points which are closer than a given tolerance value. If the same point (up to tolerance) is inserted more than once a new node is not created but the count of the existing node is incremented.
| Constructor and Description |
|---|
KdTree()
Creates a new instance of a KdTree
with a snapping tolerance of 0.0.
|
KdTree(double tolerance)
Creates a new instance of a KdTree, specifying a snapping distance tolerance.
|
| Modifier and Type | Method and Description |
|---|---|
KdNode |
insert(Point p)
Inserts a new point in the kd-tree, with no data.
|
KdNode |
insert(Point p,
Object data)
Inserts a new point into the kd-tree.
|
boolean |
isEmpty()
Tests whether the index contains any items.
|
List |
query(BoundingBox queryEnv)
Performs a range search of the points in the index.
|
void |
query(BoundingBox queryEnv,
List result)
Performs a range search of the points in the index.
|
public KdTree()
public KdTree(double tolerance)
tolerance - the tolerance distance for considering two points equalpublic KdNode insert(Point p)
p - the point to insertpublic KdNode insert(Point p, Object data)
p - the point to insertdata - a data item for the pointpublic boolean isEmpty()
public List query(BoundingBox queryEnv)
queryEnv - the range rectangle to querypublic void query(BoundingBox queryEnv, List result)
queryEnv - the range rectangle to queryresult - a list to accumulate the result nodes intoCopyright © 2015 Revolution Systems Inc.. All rights reserved.