processIntersections method
void
processIntersections(
- SegmentString e0,
- int segIndex0,
- SegmentString e1,
- int segIndex1,
override
This method is called by clients
of the {@link SegmentIntersector} class to process
intersections for two segments of the {@link SegmentString}s being intersected.
Note that some clients (such as MonotoneChain
s) may optimize away
this call for segment pairs which they have determined do not intersect
(e.g. by an disjoint envelope test).
Implementation
void processIntersections(
SegmentString e0, int segIndex0, SegmentString e1, int segIndex1) {
if (e0 == e1 && segIndex0 == segIndex1) return;
numTests++;
Coordinate p00 = e0.getCoordinates()[segIndex0];
Coordinate p01 = e0.getCoordinates()[segIndex0 + 1];
Coordinate p10 = e1.getCoordinates()[segIndex1];
Coordinate p11 = e1.getCoordinates()[segIndex1 + 1];
li.computeIntersection(p00, p01, p10, p11);
//if (li.hasIntersection() && li.isProper()) Debug.println(li);
if (li.hasIntersection()) {
//intersectionFound = true;
numIntersections++;
if (li.isInteriorIntersection()) {
numInteriorIntersections++;
hasInterior = true;
//System.out.println(li);
}
// if the segments are adjacent they have at least one trivial intersection,
// the shared endpoint. Don't bother adding it if it is the
// only intersection.
if (!isTrivialIntersection(e0, segIndex0, e1, segIndex1)) {
_hasIntersection = true;
(e0 as NodedSegmentString).addIntersections(li, segIndex0, 0);
(e1 as NodedSegmentString).addIntersections(li, segIndex1, 1);
if (li.isProper()) {
numProperIntersections++;
//Debug.println(li.toString()); Debug.println(li.getIntersection(0));
//properIntersectionPoint = (Coordinate) li.getIntersection(0).clone();
hasProper = true;
hasProperInterior = true;
}
}
}
}