Interface PointIndex<T>

  • Type Parameters:
    T - Type of the value associated with the point key.
    All Superinterfaces:
    Index<T>
    All Known Implementing Classes:
    CoverTree, KDTree, PHTreeP, PointArray, PointIndexWrapper, QuadTreeKD, QuadTreeKD0, QuadTreeKD2

    public interface PointIndex<T>
    extends Index<T>
    A common interface for spatial indexes (maps) that use points as keys. This interface is somewhat inconsistent because it suggests that implementations acrt as "maps" which means that a given keys can exist only once and is overwritten when a new entry with the same key is added.

    However, most implementations in this library (except for the PH-Tree) act as multimaps which means they allow multple entries with identical keys.

    • Method Detail

      • insert

        void insert​(double[] key,
                    T value)
        Insert a point.
        Parameters:
        key - point
        value - value
      • remove

        T remove​(double[] point)
        Remove a point entry.
        Parameters:
        point - the point
        Returns:
        the value of the entry or null if the entry was not found
      • update

        T update​(double[] oldPoint,
                 double[] newPoint)
        Update the position of an entry.
        Parameters:
        oldPoint - old position
        newPoint - new position
        Returns:
        the value of the entry or null if the entry was not found
      • queryExact

        T queryExact​(double[] point)
        Lookup an entry, using exact match.
        Parameters:
        point - the point
        Returns:
        the value of the entry or null if the entry was not found
      • query

        QueryIterator<PointEntry<T>> query​(double[] min,
                                           double[] max)
        Parameters:
        min - Lower left corner of the query window
        max - Upper right corner of the query window
        Returns:
        All points that lie inside the query rectangle.
      • query1NN

        default PointEntryDist<T> query1NN​(double[] center)
        Finds the nearest neighbor. This uses euclidean distance. Other distance types can only be specified directly on the index implementations.
        Parameters:
        center - center point
        Returns:
        the nearest neighbor
      • queryKNN

        QueryIteratorKNN<PointEntryDist<T>> queryKNN​(double[] center,
                                                     int k)
        Finds the nearest neighbor. This uses euclidean distance. Other distance types can only be specified directly on the index implementations.
        Parameters:
        center - center point
        k - number of neighbors
        Returns:
        list of nearest neighbors