/** *@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; }
Coordinate intersection = intersector.getIntersection(0); c2.x = intersection.x; c2.y = intersection.y;
if (li.isInteriorIntersection()) { for (int intIndex = 0; intIndex < li.getIntersectionNum(); intIndex++) { interiorIntersections.add(li.getIntersection(intIndex));
/** * Add an SegmentNode for intersection intIndex. * An intersection that falls exactly on a vertex * of the SegmentString is normalized * to use the higher of the two possible segmentIndexes */ public void addIntersection(LineIntersector li, int segmentIndex, int geomIndex, int intIndex) { Coordinate intPt = new Coordinate(li.getIntersection(intIndex)); addIntersection(intPt, segmentIndex); }
if (li.isInteriorIntersection()) { for (int intIndex = 0; intIndex < li.getIntersectionNum(); intIndex++) { interiorIntersections.add(li.getIntersection(intIndex));
/** * Computes an intersection point between two line segments, if there is one. * There may be 0, 1 or many intersection points between two segments. * If there are 0, null is returned. If there is 1 or more, * exactly one of them is returned * (chosen at the discretion of the algorithm). * If more information is required about the details of the intersection, * the {@link RobustLineIntersector} class should be used. * * @param line a line segment * @return an intersection point, or <code>null</code> if there is none * * @see RobustLineIntersector */ public Coordinate intersection(LineSegment line) { LineIntersector li = new RobustLineIntersector(); li.computeIntersection(p0, p1, line.p0, line.p1); if (li.hasIntersection()) return li.getIntersection(0); return null; }
checkIntPoints(expectedIntPt[0], li.getIntersection(0), distanceTolerance); checkIntPoints(expectedIntPt[1], li.getIntersection(0), distanceTolerance); checkIntPoints(expectedIntPt[1], li.getIntersection(0), distanceTolerance); if (! (equals(expectedIntPt[0],li.getIntersection(0), distanceTolerance) || equals(expectedIntPt[0],li.getIntersection(1), distanceTolerance) )) { checkIntPoints(expectedIntPt[0], li.getIntersection(0), distanceTolerance); checkIntPoints(expectedIntPt[0], li.getIntersection(1), distanceTolerance); else if (! (equals(expectedIntPt[1],li.getIntersection(0), distanceTolerance) || equals(expectedIntPt[1],li.getIntersection(1), distanceTolerance) )) { checkIntPoints(expectedIntPt[1], li.getIntersection(0), distanceTolerance); checkIntPoints(expectedIntPt[1], li.getIntersection(1), distanceTolerance);
Coordinate intPt = new Coordinate(li.getIntersection(intIndex)); int normalizedSegmentIndex = segmentIndex; double dist = li.getEdgeDistance(geomIndex, intIndex);
lineIntersector.computeIntersection(p1, p2, q1, q2); lineIntersector.getIntersectionNum(); lineIntersector.getIntersection(0); lineIntersector.isProper(); lineIntersector.hasIntersection(); lineIntersector.hasIntersection(); lineIntersector.getIntersectionNum(); lineIntersector.getIntersection(1);
intPt = li.getIntersection(0);
interiorIntersection = li.getIntersection(0); if (keepIntersections) intersections.add(interiorIntersection); intersectionCount++;
segList.addPt(li.getIntersection(0));
properIntersectionPoint = li.getIntersection(0).copy(); hasProper = true; if (isDoneWhenProperInt) {
Coordinate intPt = li.getIntersection(0);