isRing static method

dynamic isRing(
  1. List<Coordinate> pts
)

Tests whether an array of {@link Coordinate}s forms a ring, by checking length and closure. Self-intersection is not checked.

@param pts an array of Coordinates @return true if the coordinate form a ring.

Implementation

static isRing(List<Coordinate> pts) {
  if (pts.length < 4) return false;
  if (!pts[0].equals2D(pts[pts.length - 1])) return false;
  return true;
}