/** * Determines whether a point lies in the interior, on the boundary, or in the * exterior of a ring. The ring may be oriented in either direction. * <p> * This method does <i>not</i> first check the point against the envelope of * the ring. * * @param p * point to check for ring inclusion * @param ring * an array of coordinates representing the ring (which must have * first point identical to last point) * @return the {@link Location} of p relative to the ring */ public static int locatePointInRing(Coordinate p, Coordinate[] ring) { return RayCrossingCounter.locatePointInRing(p, ring); }
/** * Determines whether a point lies in the interior, on the boundary, or in the * exterior of a ring. The ring may be oriented in either direction. * <p> * This method does <i>not</i> first check the point against the envelope of * the ring. * * @param p * point to check for ring inclusion * @param ring * an array of coordinates representing the ring (which must have * first point identical to last point) * @return the {@link Location} of p relative to the ring */ public static int locateInRing(Coordinate p, Coordinate[] ring) { return RayCrossingCounter.locatePointInRing(p, ring); }
private int locate(Coordinate pt, LineString ring) { CoordinateSequence seq = ring.getCoordinateSequence(); CoordinateSequence seqProj = project(seq, facingPlane); Coordinate ptProj = project(pt, facingPlane); return RayCrossingCounter.locatePointInRing(ptProj, seqProj); }
public boolean intersects(Coordinate pt, LineString ring) { CoordinateSequence seq = ring.getCoordinateSequence(); CoordinateSequence seqProj = project(seq, facingPlane); Coordinate ptProj = project(pt, facingPlane); return Location.EXTERIOR != RayCrossingCounter.locatePointInRing(ptProj, seqProj); }
protected void runPtInRing(int expectedLoc, Coordinate pt, String wkt) throws Exception { Geometry geom = reader.read(wkt); assertEquals(expectedLoc, RayCrossingCounter.locatePointInRing(pt, geom.getCoordinates())); }
Polygon polygon = (Polygon) object; Coordinate p = polygon.getInteriorPoint().getCoordinate(); int location = RayCrossingCounter.locatePointInRing(p, ring.getCoordinateSequence()); if (location == Location.INTERIOR) { geoms.add(polygon);