getRingCurve method

List<Coordinate>? getRingCurve(
  1. List<Coordinate> inputPts,
  2. int side,
  3. double distance
)

This method handles the degenerate cases of single points and lines, as well as rings.

@return a Coordinate array representing the curve or null if the curve is empty

Implementation

List<Coordinate>? getRingCurve(
    List<Coordinate> inputPts, int side, double distance) {
  this.distance = distance;
  if (inputPts.length <= 2) return getLineCurve(inputPts, distance);

  // optimize creating ring for for zero distance
  if (distance == 0.0) {
    return copyCoordinates(inputPts);
  }
  OffsetSegmentGenerator segGen = getSegGen(distance);
  computeRingBufferCurve(inputPts, side, segGen);
  return segGen.getCoordinates();
}