Class KDTree2D

java.lang.Object
com.irurueta.geometry.KDTree<Point2D>
com.irurueta.geometry.KDTree2D

public class KDTree2D extends KDTree<Point2D>
Implementation of a k-D tree in 2D. Once a K-D tree is built for a collection of points, it can later be used to efficiently do certain operations such as point location, nearest points searches, etc.
  • Constructor Details

    • KDTree2D

      public KDTree2D(Collection<Point2D> pts)
      Constructor.
      Parameters:
      pts - collection of points to store in the tree.
  • Method Details

    • getDimensions

      public int getDimensions()
      Gets number of dimensions supported by this k-D tree implementation on provided list of points.
      Specified by:
      getDimensions in class KDTree<Point2D>
      Returns:
      number of dimensions.
    • createPoint

      protected Point2D createPoint(double value)
      Creates a point.
      Specified by:
      createPoint in class KDTree<Point2D>
      Parameters:
      value - value to be set on point coordinates.
      Returns:
      created point.
    • copyPoint

      protected Point2D copyPoint(Point2D point)
      Copies a point.
      Specified by:
      copyPoint in class KDTree<Point2D>
      Parameters:
      point - point to be copied.
      Returns:
      copied point.