public static Geometry makeConvexHull(Graph graph) { return new ConvexHull(geometryCollectionFromVertices(graph)).getConvexHull(); }
double area = CGAlgorithms.signedArea(r.getCoordinates());
private void addHole(Coordinate[] pts) { boolean isPositiveArea = CGAlgorithms.isCCW(pts); for (int i = 0; i < pts.length - 1; i++) { addTriangle(basePt, pts[i], pts[i+1], isPositiveArea); } addLinearSegments(pts); } private void addTriangle(Coordinate p0, Coordinate p1, Coordinate p2, boolean isPositiveArea)
private void computeMinimumDiameter() { // check if computation is cached if (minWidthPt != null) return; if (isConvex) computeWidthConvex(inputGeom); else { Geometry convexGeom = (new ConvexHull(inputGeom)).getConvexHull(); computeWidthConvex(convexGeom); } }
public IteratedNoder(PrecisionModel pm) { li = new RobustLineIntersector(); this.pm = pm; li.setPrecisionModel(pm); }
/** * Adds the area defined by an array of * coordinates. The array must be a ring; * i.e. end with the same coordinate as it starts with. * @param ring an array of {@link Coordinate}s */ public void add(Coordinate[] ring) { setBasePoint(ring[0]); addShell(ring); }
private boolean isShallow(Coordinate p0, Coordinate p1, Coordinate p2, double distanceTol) { double dist = CGAlgorithms.distancePointLine(p1, p0, p2); return dist < distanceTol; }
/** * Computes the distance between this line segment and another segment. * * @return the distance to the other segment */ public double distance(LineSegment ls) { return CGAlgorithms.distanceLineLine(p0, p1, ls.p0, ls.p1); }
/** * Gets the length of the minimum diameter of the input Geometry * * @return the length of the minimum diameter */ public double getLength() { computeMinimumDiameter(); return minWidth; }
public int compare(Object o1, Object o2) { Coordinate p1 = (Coordinate) o1; Coordinate p2 = (Coordinate) o2; return polarCompare(origin, p1, p2); }
/** * Convenience method to test a point for intersection with * a Geometry * @param p the coordinate to test * @param geom the Geometry to test * @return <code>true</code> if the point is in the interior or boundary of the Geometry */ public boolean intersects(Coordinate p, Geometry geom) { return locate(p, geom) != Location.EXTERIOR; }
/** * Computes the perpendicular distance between the (infinite) line defined * by this line segment and a point. * * @return the perpendicular distance between the defined line and the given point */ public double distancePerpendicular(Coordinate p) { return CGAlgorithms.distancePointLinePerpendicular(p, p0, p1); }
protected void computeIntLineIndex(int segmentIndex) { double dist0 = getEdgeDistance(segmentIndex, 0); double dist1 = getEdgeDistance(segmentIndex, 1); if (dist0 > dist1) { intLineIndex[segmentIndex][0] = 0; intLineIndex[segmentIndex][1] = 1; } else { intLineIndex[segmentIndex][0] = 1; intLineIndex[segmentIndex][1] = 0; } }
public MCPointInRing(LinearRing ring) { this.ring = ring; buildIndex(); }
private void addShell(Coordinate[] pts) { boolean isPositiveArea = ! CGAlgorithms.isCCW(pts); for (int i = 0; i < pts.length - 1; i++) { addTriangle(basePt, pts[i], pts[i+1], isPositiveArea); } addLinearSegments(pts); } private void addHole(Coordinate[] pts)
List<Coordinate> coords = componentCoordinates.get(key); Coordinate[] coordArray = new Coordinate[coords.size()]; ConvexHull hull = new ConvexHull(coords.toArray(coordArray), GeometryUtils.getGeometryFactory()); Geometry geom = hull.getConvexHull();
double area = CGAlgorithms.signedArea(r.getCoordinates());
if (CGAlgorithms.signedArea(ring.getCoordinateSequence()) > 0.0) holes.add(ring); else
if (CGAlgorithms.signedArea(ring.getCoordinateSequence()) > 0.0) holes.add(ring); else
final double exteriorArea = CGAlgorithms.signedArea(exteriorRing.getCoordinates()); if(((int) Math.round(exteriorArea)) == 0) { continue; final double interiorArea = CGAlgorithms.signedArea(nextInteriorRing.getCoordinates()); if(((int)Math.round(interiorArea)) == 0) { continue;