in commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/RegionBSPTree2D.java [606:633]
public Result visit(final RegionNode2D node) {
if (node.isInternal()) {
// check if the line subset intersects the node cut
final Line line = linecastSubset.getLine();
final Vector2D pt = ((Line) 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 LinecastPoint2D potentialResult = computeLinecastPoint(pt, node);
if (potentialResult != null) {
results.add(potentialResult);
// update the min abscissa
minAbscissa = Math.min(minAbscissa, potentialResult.getAbscissa());
}
}
}
}
return Result.CONTINUE;
}