convertAngle function

double convertAngle(
  1. double original,
  2. AngleUnit from,
  3. AngleUnit to
)

Convert original angle from some unit to another.

Example:

convertAngle(100, AngleUnits.degrees, AngleUnits.radians) // returns: 0.017453292519943295

Implementation

double convertAngle(double original, AngleUnit from, AngleUnit to) {
  return original * to.radianRatio / from.radianRatio;
}