in commons-geometry-core/src/main/java/org/apache/commons/geometry/core/partitioning/bsp/AbstractRegionBSPTree.java [827:848]
public Result visit(final N node) {
final P point = getTarget();
if (node.isInternal() && (minDist < 0.0 || isPossibleClosestCut(node.getCut(), point, minDist))) {
final RegionCutBoundary<P> boundary = node.getCutBoundary();
final P boundaryPt = boundary.closest(point);
final double dist = boundaryPt.distance(point);
final int cmp = Double.compare(dist, minDist);
if (minDist < 0.0 || cmp < 0) {
projected = boundaryPt;
minDist = dist;
} else if (cmp == 0) {
// the two points are the _exact_ same distance from the reference point, so use
// a separate method to disambiguate them
projected = disambiguateClosestPoint(point, projected, boundaryPt);
}
}
return Result.CONTINUE;
}