Class AxisSplitterMedian<P>

All Implemented Interfaces:

public class AxisSplitterMedian<P>
extends Object
implements AxisSplitter<P>
Splits the points in K-D Tree node by selecting the axis with the largest variance. The point with the median value along that axis is the split point. The data is segmented into left and right lists using the sorted list used to find the median value.
  • Constructor Details

    • AxisSplitterMedian

      public AxisSplitterMedian​(KdTreeDistance<P> distance, AxisSplitRule splitRule)
    • AxisSplitterMedian

      public AxisSplitterMedian​(KdTreeDistance<P> distance)
      Defaults to selecting the split axis with maximum variance
  • Method Details

    • splitData

      public void splitData​(List<P> points, @Nullable @Nullable DogArray_I32 indexes, List<P> left, @Nullable @Nullable DogArray_I32 leftIndexes, List<P> right, @Nullable @Nullable DogArray_I32 rightIndexes)
      Description copied from interface: AxisSplitter
      Given the a set of points, select the axis to split the data along and select a point to divide the data. Points whput items below the threshold into left and above into right. Data is optional and should be ignored if null. The selected
      Specified by:
      splitData in interface AxisSplitter<P>
      points - Input: Set of points.
      indexes - Input: (Optional) Option index asssociated with points. Can be null.
      left - Output: Storage for points less than the split point.
      leftIndexes - Output: (Optional) Storage for indexes associated with left. Can be null.
      right - Output: Storage for points more than the split point.
      rightIndexes - Output: (Optional) Storage for indexes associated with right. Can be null.
    • getSplitPoint

      public P getSplitPoint()
      Description copied from interface: AxisSplitter
      Returns the point used to split the data
      Specified by:
      getSplitPoint in interface AxisSplitter<P>
    • getSplitIndex

      public int getSplitIndex()
      Description copied from interface: AxisSplitter
      Index associated with the split point
      Specified by:
      getSplitIndex in interface AxisSplitter<P>
    • getSplitAxis

      public int getSplitAxis()
      Description copied from interface: AxisSplitter
      The axis/dimension that the input list was split on
      Specified by:
      getSplitAxis in interface AxisSplitter<P>
    • getPointLength

      public int getPointLength()
      Description copied from interface: AxisSplitter
      Number of elements in a point
      Specified by:
      getPointLength in interface AxisSplitter<P>