convertDistance function
Convert original
distance from
some unit to
another.
Example:
convertDistance(100, DistanceUnits.centimeters, DistanceUnits.meters) // returns: 1
Implementation
double convertDistance(double original, DistanceUnit from, DistanceUnit to) {
return original * to.meterRatio / from.meterRatio;
}