calculateStringPath method

LineSegmentPath? calculateStringPath(
  1. double dy
)

Implementation

LineSegmentPath? calculateStringPath(double dy) {
  List<List<Mappoint>> coordinatesAbsolute = getCoordinatesAbsolute();

  if (coordinatesAbsolute.isEmpty || coordinatesAbsolute[0].length < 2) {
    return null;
  }
  List<Mappoint> c;
  if (dy.abs() < 2) {
    // dy is very small, use the fast method
    c = coordinatesAbsolute[0];
  } else {
    c = _parallelPath(coordinatesAbsolute[0], dy);
  }

  if (c.length < 2) {
    return null;
  }

  LineSegmentPath fullPath = LineSegmentPath();
  for (int i = 1; i < c.length; i++) {
    LineSegment segment = LineSegment(c[i - 1], c[i]);
    fullPath.segments.add(segment);
  }
  return fullPath;
}