getOffsetCurve method

List<Coordinate>? getOffsetCurve(
  1. List<Coordinate> inputPts,
  2. double distance
)

Implementation

List<Coordinate>? getOffsetCurve(List<Coordinate> inputPts, double distance) {
  this.distance = distance;

  // a zero width offset curve is empty
  if (distance == 0.0) return null;

  bool isRightSide = distance < 0.0;
  double posDistance = distance.abs();
  OffsetSegmentGenerator segGen = getSegGen(posDistance);
  if (inputPts.length <= 1) {
    computePointCurve(inputPts[0], segGen);
  } else {
    computeOffsetCurve(inputPts, isRightSide, segGen);
  }
  List<Coordinate> curvePts = segGen.getCoordinates();
  // for right side line is traversed in reverse direction, so have to reverse generated line
  if (isRightSide) CoordinateArrays.reverse(curvePts);
  return curvePts;
}