numSegments static method

int numSegments(
  1. LineString line
)

Gets the count of the number of line segments in a {@link LineString}. This is one less than the number of coordinates.

@param line a LineString @return the number of segments

Implementation

static int numSegments(LineString line) {
  int npts = line.getNumPoints();
  if (npts <= 1) return 0;
  return npts - 1;
}