ranges360 property

List<AngleRange> get ranges360

Returns the equivalent range(s) projected onto the 0-360 degree circle.

Note that there may be either one or two ranges in the returned list, depending on whether or not the projection of this range crosses 0 degrees.

Implementation

List<AngleRange> get ranges360 {
  if (revolutions.abs() > 0) {
    return <AngleRange>[AngleRange(angle0, angle360)];
  }

  final rangeList = <AngleRange>[];

  if (startAngle < endAngle) {
    // clockwise
    final start360 = startAngle.angle360;
    final delta = start360 - startAngle as Angle;
    final endPlusDelta = endAngle + delta as Angle;
    if (endPlusDelta.valueSI > twoPi) {
      rangeList
        ..add(AngleRange(angle0, endPlusDelta.angle360))
        ..add(AngleRange(start360, angle360));
    } else {
      rangeList.add(AngleRange(start360, endPlusDelta));
    }
  } else {
    // counterclockwise
    final end360 = endAngle.angle360;
    final delta = end360 - endAngle as Angle;
    final startPlusDelta = startAngle + delta as Angle;
    if (startPlusDelta.valueSI > twoPi) {
      rangeList
        ..add(AngleRange(angle360, end360))
        ..add(AngleRange(startPlusDelta - angle360 as Angle, angle0));
    } else {
      rangeList.add(AngleRange(end360, startPlusDelta));
    }
  }

  return rangeList;
}