Skip to content

Instantly share code, notes, and snippets.

@sukesh-ak
Created August 2, 2020 08:13
Show Gist options
  • Save sukesh-ak/0ca356c16d3cced5c7893916dfced21e to your computer and use it in GitHub Desktop.
Save sukesh-ak/0ca356c16d3cced5c7893916dfced21e to your computer and use it in GitHub Desktop.
Helper functions for handling speed conversions while using GNSS
public static double DegreesToRadians(double degrees)
{
return degrees * Math.PI / 180.0;
}
public static double RadiansToDegrees(double radians)
{
return radians * 180.0 / Math.PI;
}
public static double RadiansToNauticalMiles(double radians)
{
// There are 60 nautical miles for each degree
return radians * 60 * 180 / Math.PI;
}
public static double RadiansToMeters(double radians)
{
// there are 1852 meters in a nautical mile
return 1852 * RadiansToNauticalMiles(radians);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment