in commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/RegionBSPTree3D.java [626:653]
public Result visit(final RegionNode3D node) {
if (node.isInternal()) {
// check if the line subset intersects the node cut hyperplane
final Line3D line = linecastSubset.getLine();
final Vector3D pt = ((Plane) node.getCutHyperplane()).intersection(line);
if (pt != null) {
if (firstOnly && !results.isEmpty() &&
line.getPrecision().compare(minAbscissa, line.abscissa(pt)) < 0) {
// we have results and we are now sure that no other intersection points will be
// found that are closer or at the same position on the intersecting line.
return Result.TERMINATE;
} else if (linecastSubset.contains(pt)) {
// we've potentially found a new linecast point; add it to the list of potential
// results
final LinecastPoint3D potentialResult = computeLinecastPoint(pt, node);
if (potentialResult != null) {
results.add(potentialResult);
// update the min abscissa
minAbscissa = Math.min(minAbscissa, potentialResult.getAbscissa());
}
}
}
}
return Result.CONTINUE;
}