/** * Adds EdgeIntersections for one or both * intersections found for a segment of an edge to the edge intersection list. */ public void addIntersections(LineIntersector li, int segmentIndex, int geomIndex) { for (int i = 0; i < li.getIntersectionNum(); i++) { addIntersection(li, segmentIndex, geomIndex, i); } } /**
/** * Adds EdgeIntersections for one or both * intersections found for a segment of an edge to the edge intersection list. */ public void addIntersections(LineIntersector li, int segmentIndex, int geomIndex) { for (int i = 0; i < li.getIntersectionNum(); i++) { addIntersection(li, segmentIndex, geomIndex, i); } } /**
/** *@return true if there is an intersection point which is not an endpoint of the segment p0-p1 */ private boolean hasInteriorIntersection(LineIntersector li, Coordinate p0, Coordinate p1) { for (int i = 0; i < li.getIntersectionNum(); i++) { Coordinate intPt = li.getIntersection(i); if (! (intPt.equals(p0) || intPt.equals(p1))) return true; } return false; }
/** * A trivial intersection is an apparent self-intersection which in fact * is simply the point shared by adjacent line segments. * Note that closed edges require a special check for the point shared by the beginning * and end segments. */ private boolean isTrivialIntersection(Edge e0, int segIndex0, Edge e1, int segIndex1) { if (e0 == e1) { if (li.getIntersectionNum() == 1) { if (isAdjacentSegments(segIndex0, segIndex1)) return true; if (e0.isClosed()) { int maxSegIndex = e0.getNumPoints() - 1; if ( (segIndex0 == 0 && segIndex1 == maxSegIndex) || (segIndex1 == 0 && segIndex0 == maxSegIndex) ) { return true; } } } } return false; }
/** * A trivial intersection is an apparent self-intersection which in fact * is simply the point shared by adjacent line segments. * Note that closed edges require a special check for the point shared by the beginning * and end segments. */ private boolean isTrivialIntersection(SegmentString e0, int segIndex0, SegmentString e1, int segIndex1) { if (e0 == e1) { if (li.getIntersectionNum() == 1) { if (isAdjacentSegments(segIndex0, segIndex1)) return true; if (e0.isClosed()) { int maxSegIndex = e0.size() - 1; if ( (segIndex0 == 0 && segIndex1 == maxSegIndex) || (segIndex1 == 0 && segIndex0 == maxSegIndex) ) { return true; } } } } return false; }
int numInt = li.getIntersectionNum();
for (int intIndex = 0; intIndex < li.getIntersectionNum(); intIndex++) { interiorIntersections.add(li.getIntersection(intIndex));
for (int intIndex = 0; intIndex < li.getIntersectionNum(); intIndex++) { interiorIntersections.add(li.getIntersection(intIndex));
Coordinate x = new Coordinate(15, 15); lineIntersector.computeIntersection(p1, p2, q1, q2); lineIntersector.getIntersectionNum(); lineIntersector.getIntersection(0); lineIntersector.isProper(); new Coordinate(100, 10), new Coordinate(100, 100)); lineIntersector.hasIntersection(); lineIntersector.getIntersectionNum(); lineIntersector.getIntersectionNum(); lineIntersector.getIntersection(1); new Coordinate(220, 240), new Coordinate(140, 160)); lineIntersector.hasIntersection(); lineIntersector.getIntersectionNum(); lineIntersector.getIntersectionNum(); lineIntersector.isProper(); new Coordinate(11, 90), new Coordinate(10, 10)); lineIntersector.hasIntersection(); lineIntersector.getIntersectionNum(); lineIntersector.isProper();
li.computeIntersection(pt[0], pt[1], pt[2], pt[3]); int intNum = li.getIntersectionNum(); assertEquals("Number of intersections not as expected", expectedIntersectionNum, intNum);