public Geometry intersection(Geometry other) { return lineString.intersection(other); }
public Geometry intersection(Geometry other) { return linearize().intersection(other); }
public Geometry intersection(Geometry other) { return linearize().intersection(other); }
private LineString circleArcInBounds( double x, double y, double radius, ReferencedEnvelope bounds) { Point center = gf.createPoint(new Coordinate(x, y)); Polygon buffered = (Polygon) center.buffer(radius, 64); Polygon mask = JTS.toGeometry(bounds); Geometry intersection = buffered.getExteriorRing().intersection(mask); return (LineString) intersection; }
/** * Finds an interior point of a Polygon. * @param geometry the geometry to analyze */ private void addPolygon(Geometry geometry) { if (geometry.isEmpty()) return; Coordinate intPt; double width; LineString bisector = horizontalBisector(geometry); if (bisector.getLength() == 0.0) { width = 0; intPt = bisector.getCoordinate(); } else { Geometry intersections = bisector.intersection(geometry); Geometry widestIntersection = widestGeometry(intersections); width = widestIntersection.getEnvelopeInternal().getWidth(); intPt = centre(widestIntersection.getEnvelopeInternal()); } if (interiorPoint == null || width > maxWidth) { interiorPoint = intPt; maxWidth = width; } }
Coordinate coordsEnd = coords[1]; if (Math.max(coordsStart.z, coordsEnd.z) > max * j * stepLength){ Geometry ptsIntersect = lineGeoms.intersection(rayStep); if (ptsIntersect instanceof Point && ptsIntersect!=null) { double coordWithZ = CoordinateUtils.interpolate(lineGeoms.getCoordinateN(0), lineGeoms.getCoordinateN(1), ptsIntersect.getCoordinate());
private LineString voronoiSide(int idgeom, int side,GeometryFactory geometryFactory, Coordinate circumcenter) { boolean triangleCCW = isCCW(idgeom); // Create linestring to envelope LineSegment sideGeom = getTriangleSegment(idgeom, side); Vector2D direction = new Vector2D(sideGeom.p0, sideGeom.p1); direction = direction.normalize().rotate(triangleCCW ? - Math.PI / 2 : Math.PI / 2).multiply(envelope.maxExtent()); LineSegment voronoiLine = new LineSegment(circumcenter, new Coordinate(direction.getX() + circumcenter.x, direction.getY() + circumcenter.y)); Geometry lineString = voronoiLine.toGeometry(geometryFactory).intersection(geometryFactory.toGeometry(envelope)); if(lineString instanceof LineString && lineString.getLength() > epsilon) { return (LineString)lineString; } else { return null; } }