locatePointInRing static method

int locatePointInRing(
  1. Coordinate p,
  2. LinearRing ring
)

Determines whether a point lies in a LinearRing, using the ring envelope to short-circuit if possible.

@param p the point to test @param ring a linear ring @return true if the point lies inside the ring

Implementation

static int locatePointInRing(Coordinate p, LinearRing ring) {
  // short-circuit if point is not in ring envelope
  if (!ring.getEnvelopeInternal().intersectsCoordinate(p))
    return Location.EXTERIOR;
  return PointLocation.locateInRing(p, ring.getCoordinates());
}