protected boolean isEndPoint() { return hasIntersection() && !isProper; }
/** * Tests whether an intersection is proper. * <br> * The intersection between two line segments is considered proper if * they intersect in a single point in the interior of both segments * (e.g. the intersection is a single point and is not equal to any of the * endpoints). * <p> * The intersection between a point and a line segment is considered proper * if the point lies in the interior of the segment (e.g. is not equal to * either of the endpoints). * * @return true if the intersection is proper */ public boolean isProper() { return hasIntersection() && isProper; }
if (intersector.hasIntersection()) { Coordinate intersection = intersector.getIntersection(0); c2.x = intersection.x;
/** * Test whether the given segment intersects * the closure of this hot pixel. * This is NOT the test used in the standard snap-rounding * algorithm, which uses the partially closed tolerance square * instead. * This routine is provided for testing purposes only. * * @param p0 the start point of a line segment * @param p1 the end point of a line segment * @return <code>true</code> if the segment intersects the closure of the pixel's tolerance square */ private boolean intersectsPixelClosure(Coordinate p0, Coordinate p1) { li.computeIntersection(p0, p1, corner[0], corner[1]); if (li.hasIntersection()) return true; li.computeIntersection(p0, p1, corner[1], corner[2]); if (li.hasIntersection()) return true; li.computeIntersection(p0, p1, corner[2], corner[3]); if (li.hasIntersection()) return true; li.computeIntersection(p0, p1, corner[3], corner[0]); if (li.hasIntersection()) return true; return false; }
/** * Tests whether a point lies on the line segments defined by a list of * coordinates. * * @return true if the point is a vertex of the line or lies in the interior * of a line segment in the linestring */ public static boolean isOnLine(Coordinate p, Coordinate[] pt) { LineIntersector lineIntersector = new RobustLineIntersector(); for (int i = 1; i < pt.length; i++) { Coordinate p0 = pt[i - 1]; Coordinate p1 = pt[i]; lineIntersector.computeIntersection(p, p0, p1); if (lineIntersector.hasIntersection()) { return true; } } return false; }
/** * Tests whether a point lies on the line defined by a list of * coordinates. * * @param p the point to test * @param line the line coordinates * @return true if the point is a vertex of the line or lies in the interior * of a line segment in the line */ public static boolean isOnLine(Coordinate p, Coordinate[] line) { LineIntersector lineIntersector = new RobustLineIntersector(); for (int i = 1; i < line.length; i++) { Coordinate p0 = line[i - 1]; Coordinate p1 = line[i]; lineIntersector.computeIntersection(p, p0, p1); if (lineIntersector.hasIntersection()) { return true; } } return false; }
/** * 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; }
public boolean intersects(Coordinate p0, Coordinate p1) { Envelope segEnv = new Envelope(p0, p1); if (! rectEnv.intersects(segEnv)) return false; li.computeIntersection(p0, p1, corner[0], corner[1]); if (li.hasIntersection()) return true; li.computeIntersection(p0, p1, corner[1], corner[2]); if (li.hasIntersection()) return true; li.computeIntersection(p0, p1, corner[2], corner[3]); if (li.hasIntersection()) return true; li.computeIntersection(p0, p1, corner[3], corner[0]); if (li.hasIntersection()) return true; return false; }
public boolean intersects(Coordinate p0, Coordinate p1) { Envelope segEnv = new Envelope(p0, p1); if (! rectEnv.intersects(segEnv)) return false; li.computeIntersection(p0, p1, corner[0], corner[1]); if (li.hasIntersection()) return true; li.computeIntersection(p0, p1, corner[1], corner[2]); if (li.hasIntersection()) return true; li.computeIntersection(p0, p1, corner[2], corner[3]); if (li.hasIntersection()) return true; li.computeIntersection(p0, p1, corner[3], corner[0]); if (li.hasIntersection()) return true; return false; }
private void checkInteriorIntersections(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()) { if (li.isProper() || hasInteriorIntersection(li, p00, p01) || hasInteriorIntersection(li, p10, p11)) { throw new RuntimeException("found non-noded intersection at " + p00 + "-" + p01 + " and " + p10 + "-" + p11); } } } /**
if (li.hasIntersection()) intersectsLeft = true; if (li.hasIntersection()) intersectsBottom = true;
/** * Tests whether a point lies on the line defined by a * {@link CoordinateSequence}. * * @param p the point to test * @param line the line coordinates * @return true if the point is a vertex of the line or lies in the interior * of a line segment in the line */ public static boolean isOnLine(Coordinate p, CoordinateSequence line) { LineIntersector lineIntersector = new RobustLineIntersector(); Coordinate p0 = new Coordinate(); Coordinate p1 = new Coordinate(); int n = line.size(); for (int i = 1; i < n; i++) { line.getCoordinate(i-1, p0); line.getCoordinate(i, p1); lineIntersector.computeIntersection(p, p0, p1); if (lineIntersector.hasIntersection()) { return true; } } return false; }
if (li.hasIntersection()) { if (li.isInteriorIntersection()) { for (int intIndex = 0; intIndex < li.getIntersectionNum(); intIndex++) {
if (li.hasIntersection()) { if (li.isInteriorIntersection()) { for (int intIndex = 0; intIndex < li.getIntersectionNum(); intIndex++) {
if (li.hasIntersection()) {
boolean isInteriorInt = li.hasIntersection() && li.isInteriorIntersection();
if (li.hasIntersection()) {
if (li.hasIntersection()) { if (recordIsolated) { e0.setIsolated(false);
lineIntersector.getIntersection(0); lineIntersector.isProper(); lineIntersector.hasIntersection(); lineIntersector.computeIntersection(p1, p2, q1, q2); lineIntersector.isProper(); lineIntersector.hasIntersection(); lineIntersector.computeIntersection(p1, p2, q1, q2); lineIntersector.isProper(); lineIntersector.hasIntersection(); lineIntersector.computeIntersection(p1, p2, q1, q2); lineIntersector.isProper(); lineIntersector.hasIntersection(); q2 = new Coordinate(30, 10); lineIntersector.computeIntersection(p1, p2, q1, q2); lineIntersector.hasIntersection(); lineIntersector.hasIntersection(); lineIntersector.getIntersectionNum(); lineIntersector.hasIntersection(); lineIntersector.getIntersectionNum(); lineIntersector.getIntersection(1); lineIntersector.hasIntersection(); lineIntersector.getIntersectionNum();
if (li.hasIntersection()) { isIntersected0[i] = true; isIntersected1[j] = true;