angle180 property

Angle get angle180

Return an equivalent angle bounded to between -PI and PI (-180 and 180 degrees). If this Angle is already within that range then it is returned directly.

Implementation

Angle get angle180 {
  if (valueSI >= -math.pi && valueSI <= math.pi) return this;

  var rad = valueSI.toDouble();
  while (rad < -math.pi) {
    rad += twoPi;
  }
  while (rad > math.pi) {
    rad -= twoPi;
  }
  return Angle(rad: rad);
}