math.geom2d.point
Class KDTree2D
- java.lang.Object
-
- math.geom2d.point.KDTree2D
-
public class KDTree2D extends java.lang.ObjectA data structure for storing a great number of points. During construction of the tree, median point in current coordinate is chosen for each step, ensuring the final tree is balanced. The cost for retrieving a point is O(log n).
The cost for building the tree is O(n log^2 n), that can take some time for large points sets.
This implementation is semi-dynamic: points can be added, but can not be removed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description classKDTree2D.Node
-
Constructor Summary
Constructors Constructor and Description KDTree2D(java.util.ArrayList<Point2D> points)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(Point2D point)booleancontains(Point2D value)KDTree2D.NodegetNode(Point2D point)KDTree2D.NodegetRoot()static voidmain(java.lang.String[] args)Gives a small example of use.Point2DnearestNeighbor(Point2D point)java.util.Collection<Point2D>rangeSearch(Box2D range)
-
-
-
Constructor Detail
-
KDTree2D
public KDTree2D(java.util.ArrayList<Point2D> points)
-
-
Method Detail
-
getRoot
public KDTree2D.Node getRoot()
-
contains
public boolean contains(Point2D value)
-
getNode
public KDTree2D.Node getNode(Point2D point)
-
add
public void add(Point2D point)
-
main
public static void main(java.lang.String[] args)
Gives a small example of use.
-
-
DMelt 3.0 © DataMelt by jWork.ORG