}
// step 8
IKDTreeDomain nearest = null;
RefFloat distSq = new RefFloat();
if (nearerKd == null) {
distSq.val = Float.POSITIVE_INFINITY;
} else {
nearest = nearerKd.nearestNeighbourI(target, nearerHr, maxDistSq, distSq);
}
// step 9
maxDistSq = (float) Math.min(maxDistSq, distSq.val);
// step 10
if (furtherHr.isInReach(target, (float) Math.sqrt(maxDistSq))) {
float ptDistSq = KDTree.distanceSq(pivot, target);
if (ptDistSq < distSq.val) {
// steps 10.1.1 to 10.1.3
nearest = pivot;
distSq.val = ptDistSq;
maxDistSq = distSq.val;
}
// step 10.2
RefFloat tempDistSq = new RefFloat();
IKDTreeDomain tempNearest = null;
if (furtherKd == null) {
tempDistSq.val = Float.POSITIVE_INFINITY;
} else {
tempNearest = furtherKd.nearestNeighbourI(target, furtherHr, maxDistSq, tempDistSq);