42 const double sin_lat = sin(def->
lla.
lat);
43 const double cos_lat = cos(def->
lla.
lat);
44 const double sin_lon = sin(def->
lla.
lon);
45 const double cos_lon = cos(def->
lla.
lon);
63 static const double a = 6378137.0;
64 static const double f = 1. / 298.257223563;
65 const double b = a * (1. - f);
66 const double b2 = b * b;
68 const double e2 = 2.*f - (f * f);
69 const double ep2 = f * (2. - f) / ((1. - f) * (1. - f));
70 const double E2 = a * a - b2;
73 const double z2 = ecef->
z * ecef->
z;
74 const double r2 = ecef->
x * ecef->
x + ecef->
y * ecef->
y;
75 const double r = sqrt(r2);
76 const double F = 54.*b2 * z2;
77 const double G = r2 + (1 - e2) * z2 - e2 * E2;
78 const double c = (e2 * e2 * F * r2) / (G * G * G);
79 const double s = pow((1 + c + sqrt(c * c + 2 * c)), 1. / 3.);
80 const double s1 = 1 + s + 1 / s;
81 const double P = F / (3 * s1 * s1 * G * G);
82 const double Q = sqrt(1 + 2 * e2 * e2 * P);
83 const double ro = -(e2 * P * r) / (1 + Q) + sqrt((a * a / 2) * (1 + 1 / Q) - ((1 - e2) * P * z2) / (Q *
84 (1 + Q)) - P * r2 / 2);
85 const double tmp = (r - e2 * ro) * (r - e2 * ro);
86 const double U = sqrt(tmp + z2);
87 const double V = sqrt(tmp + (1 - e2) * z2);
88 const double zo = (b2 * ecef->
z) / (a * V);
90 lla->
alt = U * (1 - b2 / (a * V));
91 lla->
lat = atan((ecef->
z + ep2 * zo) / r);
92 lla->
lon = atan2(ecef->
y, ecef->
x);
100 static const double a = 6378137.0;
101 static const double f = 1. / 298.257223563;
102 const double e2 = 2.*f - (f * f);
104 const double sin_lat = sin(lla->
lat);
105 const double cos_lat = cos(lla->
lat);
106 const double sin_lon = sin(lla->
lon);
107 const double cos_lon = cos(lla->
lon);
108 const double chi = sqrt(1. - e2 * sin_lat * sin_lat);
109 const double a_chi = a / chi;
111 ecef->
x = (a_chi + lla->
alt) * cos_lat * cos_lon;
112 ecef->
y = (a_chi + lla->
alt) * cos_lat * sin_lon;
113 ecef->
z = (a_chi * (1. - e2) + lla->
alt) * sin_lat;
188 const double a = 6378137.0;
189 const double f = 1. / 298.257223563;
190 const double c2 = (1. - f) * (1. - f);
192 double ls = atan(c2 * tan(gd_lat));
193 return atan2(hmsl * sin(gd_lat) + a * sin(ls), hmsl * cos(gd_lat) + a * cos(ls));
201 return log(tan(M_PI_4 + phi / 2.0)) - e / 2.0 * log((1.0 + e * sin(phi)) / (1.0 - e * sin(phi)));
206 return log(tan(M_PI_4 + phi / 2.0));
211 double exp_l = exp(lat);
212 double phi0 = 2 * atan(exp_l) - M_PI_2;
218 double sin_phi = e * sin(phi_);
219 phi0 = 2 * atan(pow((1 + sin_phi) / (1. - sin_phi), e / 2.) * exp_l) - M_PI_2;
221 }
while (max_iter && fabs(phi_ - phi0) > epsilon);
233 double e = exp(v.x); \
240 struct DoubleVect2 vstar = {-v.x, -v.y}; \
243 VECT2_SUB(v, vstar); \
244 VECT2_SMUL(v, v, -0.5); \
263 lla->
lon = lambda_c + atan(sinh(v.
y) / cos(v.
x));
264 double phi = asin(sin(v.
x) / cosh(v.
y));
#define VECT3_ADD(_a, _b)
vector in North East Down coordinates Units: meters
void lla_of_utm_d(struct LlaCoor_d *lla, struct UtmCoor_d *utm)
void ecef_of_ned_vect_d(struct EcefCoor_d *ecef, struct LtpDef_d *def, struct NedCoor_d *ned)
position in UTM coordinates Units: meters
double gc_of_gd_lat_d(double gd_lat, double hmsl)
#define VECT3_COPY(_a, _b)
struct DoubleRMat ltp_of_ecef
rotation from ECEF to local frame
#define VECT3_DIFF(_c, _a, _b)
double alt
in meters above WGS84 reference ellipsoid
static double inverse_isometric_latitude_d(double lat, double e, double epsilon)
struct LlaCoor_d lla
origin of local frame in LLA
double alt
in meters above WGS84 reference ellipsoid
vector in Latitude, Longitude and Altitude
void ecef_of_ned_point_d(struct EcefCoor_d *ecef, struct LtpDef_d *def, struct NedCoor_d *ned)
void ecef_of_enu_point_d(struct EcefCoor_d *ecef, struct LtpDef_d *def, struct EnuCoor_d *enu)
#define ENU_OF_TO_NED(_po, _pi)
Paparazzi double-precision floating point math for geodetic calculations.
void enu_of_lla_point_d(struct EnuCoor_d *enu, struct LtpDef_d *def, struct LlaCoor_d *lla)
#define MAT33_VECT3_TRANSP_MUL(_vout, _mat, _vin)
vector in East North Up coordinates Units: meters
void enu_of_ecef_vect_d(struct EnuCoor_d *enu, struct LtpDef_d *def, struct EcefCoor_d *ecef)
static double isometric_latitude_fast_d(double phi)
definition of the local (flat earth) coordinate system
vector in EarthCenteredEarthFixed coordinates
void lla_of_ecef_d(struct LlaCoor_d *lla, struct EcefCoor_d *ecef)
#define VECT2_SMUL(_vo, _vi, _s)
Constants UTM (Mercator) projections.
void ned_of_lla_point_d(struct NedCoor_d *ned, struct LtpDef_d *def, struct LlaCoor_d *lla)
uint8_t zone
UTM zone number.
#define MAT33_VECT3_MUL(_vout, _mat, _vin)
void ltp_def_from_ecef_d(struct LtpDef_d *def, struct EcefCoor_d *ecef)
void ned_of_ecef_point_d(struct NedCoor_d *ned, struct LtpDef_d *def, struct EcefCoor_d *ecef)
struct EcefCoor_d ecef
origin of local frame in ECEF
#define LambdaOfUtmZone(utm_zone)
static double UNUSED isometric_latitude_d(double phi, double e)
static const float serie_coeff_proj_mercator[5]
void ecef_of_enu_vect_d(struct EcefCoor_d *ecef, struct LtpDef_d *def, struct EnuCoor_d *enu)
void enu_of_ecef_point_d(struct EnuCoor_d *enu, struct LtpDef_d *def, struct EcefCoor_d *ecef)
void ecef_of_lla_d(struct EcefCoor_d *ecef, struct LlaCoor_d *lla)
void ned_of_ecef_vect_d(struct NedCoor_d *ned, struct LtpDef_d *def, struct EcefCoor_d *ecef)
#define VECT2_SUB(_a, _b)