subSegment method

LineSegment subSegment(
  1. double offset, [
  2. double length = -1
])

LineSegment that starts at offset from start and runs for length towards end point

@param offset offset applied at begin of line @param length length of the new segment @return new LineSegment computed

Implementation

LineSegment subSegment(double offset, [double length = -1]) {
  Mappoint subSegmentStart = pointAlongLineSegment(offset);
  Mappoint subSegmentEnd = length == -1 ? end : pointAlongLineSegment(offset + length);
  return LineSegment(subSegmentStart, subSegmentEnd);
}