normalizeDegree2 static method

double normalizeDegree2(
  1. double degree
)

Normalizes degree to 0...180, 0...-180

Implementation

static double normalizeDegree2(double degree) {
  var degreeNormalized = degree % 360;
  if (degreeNormalized > 180) {
    degreeNormalized -= 360;
  } else if (degreeNormalized < -180) {
    degreeNormalized += 360;
  }

  return degreeNormalized;
}