locatePointInRing static method
Determines the {@link Location} of a point in a ring.
@param p the point to test @param ring a coordinate sequence forming a ring @return the location of the point in the ring
Implementation
static int locatePointInRing(Coordinate p, CoordinateSequence ring) {
RayCrossingCounter counter = new RayCrossingCounter(p);
Coordinate p1 = new Coordinate.empty2D();
Coordinate p2 = new Coordinate.empty2D();
for (int i = 1; i < ring.size(); i++) {
ring.getCoordinateInto(i, p1);
ring.getCoordinateInto(i - 1, p2);
counter.countSegment(p1, p2);
if (counter.isOnSegment()) return counter.getLocation();
}
return counter.getLocation();
}