/** * Finds the node which is closest to 'target' * * @param target A point * @return Closest node or null if none is within the minimum distance. */ @Override public KdTree.Node findNeighbor(P target) { if( tree.root == null ) return null; this.target = target; this.closest = null; this.bestDistanceSq = maxDistanceSq; stepClosest(tree.root); return closest; }
public KdTreeNearestNeighbor( KdTreeDistance<P> distance ) { this( new KdTreeSearch1Standard<>(distance), new KdTreeSearchNStandard<>(distance), new AxisSplitterMedian<>(distance)); }
public KdTreeNearestNeighbor( KdTreeDistance<P> distance ) { this( new KdTreeSearch1Standard<>(distance), new KdTreeSearchNStandard<>(distance), new AxisSplitterMedian<>(distance)); }
@Override public KdTreeSearch1<double[]> createAlg() { return new KdTreeSearch1Standard<>(new KdTreeEuclideanSq_F64(N)); } }
/** * Finds the node which is closest to 'target' * * @param target A point * @return Closest node or null if none is within the minimum distance. */ @Override public KdTree.Node findNeighbor(P target) { if( tree.root == null ) return null; this.target = target; this.closest = null; this.bestDistanceSq = maxDistanceSq; stepClosest(tree.root); return closest; }
stepClosest(nearer); if( dx2 <= bestDistanceSq ) { if( closest == null || dx2 < bestDistanceSq ) stepClosest(further);
stepClosest(nearer); if( dx2 <= bestDistanceSq ) { if( closest == null || dx2 < bestDistanceSq ) stepClosest(further);