10#include <QtCore/QByteArray>
17inline constexpr double DEG_TO_RAD = std::numbers::pi / 180.0;
18inline constexpr double RAD_TO_DEG = 180.0 / std::numbers::pi;
30 return value / 1000.0;
36 return static_cast<double>(std::llround(meters * 1000.0)) / 1000.0;
42 const double units = meters * 10000.0;
43 if (!std::isfinite(units) || units < 0 || units > (std::numeric_limits<uint32_t>::max)()) {
46 return static_cast<uint32_t
>(units);
62 return std::hypot(left.
x - right.
x, left.
y - right.
y, left.
z - right.
z);
72[[nodiscard]] uint64_t
utcMicroseconds(
int year,
int month,
int day,
int hour,
int minute,
int second, int32_t nsec);
QByteArray gpsFixedDecimal(double value, int decimals)
Unit conversions and geodesy shared by receiver families and their callers.
Ecef toEcef(const GPSEllipsoidPosition &position)
constexpr double metersFromMillimeters(int32_t value)
constexpr time_t UTC_PLAUSIBILITY_FLOOR_SECS
Receiver dates before this instant (2009-02-13) are implausible and reported as unknown.
bool nearEarthSurface(const Ecef &position)
constexpr double DEG_TO_RAD
constexpr double degreesFromE7(int32_t value)
Degrees of a coordinate in 1e-7 degree units, as u-blox and MAVLink send them.
double roundedToMillimeters(double meters)
meters rounded to whole millimetres.
double distance(const Ecef &left, const Ecef &right)
Straight-line distance between left and right, in metres.
std::optional< uint32_t > tenthMillimeters(double meters)
meters in 0.1 mm, truncated toward zero. Empty when not finite, negative or beyond a 32-bit unsigned ...
GPSEllipsoidPosition fromEcef(const Ecef &position)
uint64_t utcMicroseconds(int year, int month, int day, int hour, int minute, int second, int32_t nsec)
constexpr double RAD_TO_DEG
WGS84 geodetic position with ellipsoid height, not mean-sea-level altitude.