Functions and constants for angle and unit conversions.
More...
|
#define | M_PI std::numbers::pi |
|
#define | NM2M 1852. |
| Nautical mile to meters conversion factor.
|
|
#define | MPS2KNOT (3600. / NM2M) |
| Meters/sec to knots conversion factor.
|
|
#define | USFOOT2M (1200. / 3937.) |
| US Survey foot to meters conversion factor.
|
|
|
constexpr double | DEG (double dd) |
| Convert decimal degrees to radians.
|
|
constexpr double | D2rad (double dd) |
| Convert decimal degrees to radians.
|
|
constexpr double | rad2D (double r) |
| Convert radians to decimal degrees.
|
|
constexpr double | DM (double dd, double mm) |
| Convert degrees, minutes to radians.
|
|
constexpr double | DM2deg (double ddmm) |
| Convert degrees, minutes (DDMM.mmm) to decimal degrees.
|
|
constexpr double | deg2DM (double dd) |
| Convert decimal degrees to degrees, minutes (DDMM.mmm)
|
|
constexpr double | rad2DM (double rad) |
| Convert from radians to degrees, minutes (DDMM.mmm)
|
|
constexpr double | DM2rad (double val) |
| Convert degrees, minutes (DDMM.mmm) to radians.
|
|
constexpr double | DMS (double dd, double mm, double ss) |
| Convert degrees, minutes seconds to radians.
|
|
constexpr double | DMS2deg (double dms) |
| Convert degrees, minutes, seconds (DDMMSS.sss) to decimal degrees.
|
|
constexpr double | DMS2rad (double dms) |
| Convert degrees, minutes, seconds (DDMMSS.sss) to radians.
|
|
double | mlib::deg_reduce (double value) |
| Reduces a degrees value to [0,360) interval.
|
|
std::string | mlib::degtoa (double degrees, deg_fmt format, bool latitude, int precision) |
| Conversion from degrees to a string.
|
|
double | mlib::atodeg (const std::string &str) |
| Conversion from string to decimal degrees.
|
|
|
constexpr double | D2R = M_PI / 180. |
| Degrees to radians conversion factor.
|
|
constexpr double | A_WGS84 = 6378137.000 |
| Semimajor axis of WGS84 ellipsoid.
|
|
constexpr double | F_WGS84 = 0.003352810664747 |
| Flattening of WGS84 ellipsoid.
|
|
constexpr double | F1_WGS84 = 298.257223563 |
| Inverse of flattening for WGS84 ellipsoid.
|
|
constexpr double | MAS = M_PI / (180 * 3600000.) |
| milli-arcsecond
|
|
constexpr double | operator""_ftUS (long double ftus) |
|
constexpr double | operator""_ftUS (unsigned long long ftus) |
|
constexpr double | operator""_nmi (long double nmi) |
|
constexpr double | operator""_nmi (unsigned long long nmi) |
|
constexpr double | operator""_deg (long double deg) |
|
constexpr double | operator""_deg (unsigned long long deg) |
|
constexpr double | operator""_arcmin (long double min) |
|
constexpr double | operator""_arcmin (unsigned long long min) |
|
constexpr double | operator""_dm (long double val) |
|
constexpr double | operator""_dm (unsigned long long val) |
|
constexpr double | operator""_dms (long double val) |
|
constexpr double | operator""_dms (unsigned long long val) |
|
constexpr double | operator""_arcsec (long double sec) |
|
constexpr double | operator""_arcsec (unsigned long long sec) |
|
constexpr double | operator""_mas (long double mas) |
|
constexpr double | operator""_mas (unsigned long long mas) |
|
Functions and constants for angle and unit conversions.
These are conversion functions between different angle representations as well as to and from customary latitude/longitude string representations.
◆ deg_fmt
Formatting options for degtoa() function.
Enumerator |
---|
degrees | Decimal degrees (DD.dddd°)
|
minutes | Degrees, minutes format (DD°MM.mmmm')
|
seconds | Degrees, minutes, seconds format (DD°MM'SS.sss")
|
◆ atodeg()
double mlib::atodeg |
( |
const std::string & |
str | ) |
|
Conversion from string to decimal degrees.
- Parameters
-
- Returns
- angle value in degrees
Some valid strings are:
- 130°45'25.34566W
- 130D45'25.34566E
- 65D45M25.34567S
- 130.56789W
- 85°30.45678N
◆ degtoa()
std::string mlib::degtoa |
( |
double |
degrees, |
|
|
deg_fmt |
format, |
|
|
bool |
latitude, |
|
|
int |
precision |
|
) |
| |
Conversion from degrees to a string.
- Parameters
-
degrees | value to convert in decimal degrees |
format | formatting flags |
latitude | true if value is a latitude value |
precision | number of decimal places for fractional part |
Format is controlled by flags settings and precision. The resulting string can have one of the following formats:
DD°MM'SS.sss"H
if output format has deg_fmt::sec bit set
DD°MM.mmmm'H
if output format has LL_MIN bit set
DD.dddd°H
if neither of these bits is set
In the above formats, H
is the hemisphere which can be one of N
or S
if latitude
parameter is true. Otherwise it is one of E
or W
.
◆ operator""_arcmin() [1/2]
constexpr double operator""_arcmin |
( |
long double |
min | ) |
|
|
constexpr |
Minutes literal operator converts a value in arc-minutes to radians
◆ operator""_arcmin() [2/2]
constexpr double operator""_arcmin |
( |
unsigned long long |
min | ) |
|
|
constexpr |
Minutes literal operator converts a value in arc-minutes to radians
◆ operator""_arcsec() [1/2]
constexpr double operator""_arcsec |
( |
long double |
sec | ) |
|
|
constexpr |
Seconds literal operator converts a value in arc-seconds to radians
◆ operator""_arcsec() [2/2]
constexpr double operator""_arcsec |
( |
unsigned long long |
sec | ) |
|
|
constexpr |
Seconds literal operator converts a value in arc-seconds to radians
◆ operator""_deg() [1/2]
constexpr double operator""_deg |
( |
long double |
deg | ) |
|
|
constexpr |
Degrees literal operator converts a value in degrees to radians
◆ operator""_deg() [2/2]
constexpr double operator""_deg |
( |
unsigned long long |
deg | ) |
|
|
constexpr |
Degrees literal operator converts a value in degrees to radians
◆ operator""_dm() [1/2]
constexpr double operator""_dm |
( |
long double |
val | ) |
|
|
constexpr |
Degrees-minutes literal operator converts a value to radians
◆ operator""_dm() [2/2]
constexpr double operator""_dm |
( |
unsigned long long |
val | ) |
|
|
constexpr |
Degrees-minutes literal operator converts a value to radians
◆ operator""_dms() [1/2]
constexpr double operator""_dms |
( |
long double |
val | ) |
|
|
constexpr |
Degrees-minutes-seconds literal operator converts a value to radians
◆ operator""_dms() [2/2]
constexpr double operator""_dms |
( |
unsigned long long |
val | ) |
|
|
constexpr |
Degrees-minutes-seconds literal operator converts a value to radians
◆ operator""_ftUS() [1/2]
constexpr double operator""_ftUS |
( |
long double |
ftus | ) |
|
|
constexpr |
US survey foot literal operator converts a value in US survey feet to meters
◆ operator""_ftUS() [2/2]
constexpr double operator""_ftUS |
( |
unsigned long long |
ftus | ) |
|
|
constexpr |
US survey foot literal operator converts a value in US survey feet to meters
◆ operator""_mas() [1/2]
constexpr double operator""_mas |
( |
long double |
mas | ) |
|
|
constexpr |
Milli-arcseconds literal operator converts a value in thousandth of arc-seconds to radians
◆ operator""_mas() [2/2]
constexpr double operator""_mas |
( |
unsigned long long |
mas | ) |
|
|
constexpr |
Milli-arcseconds literal operator converts a value in thousandth of arc-seconds to radians
◆ operator""_nmi() [1/2]
constexpr double operator""_nmi |
( |
long double |
nmi | ) |
|
|
constexpr |
Nautical miles literal operator converts a value in nautical miles to meters
◆ operator""_nmi() [2/2]
constexpr double operator""_nmi |
( |
unsigned long long |
nmi | ) |
|
|
constexpr |
Nautical miles literal operator converts a value in nautical miles to meters