bearingToAzimuth function

num bearingToAzimuth(
  1. num bearing
)

Converts any bearing angle from the north line direction (positive clockwise) and returns an angle between 0-360 degrees (positive clockwise), 0 being the north line

Implementation

num bearingToAzimuth(num bearing) {
  num angle = bearing.remainder(360);
  if (angle < 0) {
    angle += 360;
  }
  return angle;
}