33# pragma warning (disable: 5054)
40 void GeodesicLineExact::LineInit(
const GeodesicExact& g,
63 Math::norm(sbet1, cbet1); cbet1 = fmax(tiny_, cbet1);
64 _dn1 = (_f >= 0 ? sqrt(1 + g._ep2 *
Math::sq(sbet1)) :
65 sqrt(1 - _e2 * Math::sq(cbet1)) / _f1);
68 _salp0 = _salp1 * cbet1;
71 _calp0 = hypot(_calp1, _salp1 * sbet1);
81 _ssig1 = sbet1; _somg1 = _salp0 * sbet1;
82 _csig1 = _comg1 = sbet1 != 0 || _calp1 != 0 ? cbet1 * _calp1 : 1;
84 _cchi1 = _f1 * _dn1 * _comg1;
90 _eE.
Reset(-_k2, -g._ep2, 1 + _k2, 1 + g._ep2);
94 _eE1 = _eE.
deltaE(_ssig1, _csig1, _dn1);
95 real s = sin(_eE1), c = cos(_eE1);
97 _stau1 = _ssig1 * c + _csig1 * s;
98 _ctau1 = _csig1 * c - _ssig1 * s;
105 _dD1 = _eE.
deltaD(_ssig1, _csig1, _dn1);
110 _hH1 = _eE.
deltaH(_ssig1, _csig1, _dn1);
113 if (_caps & CAP_C4) {
115 _aA4 =
Math::sq(_a) * _calp0 * _salp0 * _e2;
119 GeodesicExact::I4Integrand i4(g._ep2, _k2);
121 g._fft.transform(i4, _cC4a.data());
130 real lat1, real lon1, real azi1,
136 LineInit(g, lat1, lon1, azi1, salp1, calp1, caps);
143 bool arcmode,
real s13_a13) {
144 LineInit(g, lat1, lon1, azi1, salp1, calp1, caps);
150 real& lat2, real& lon2, real& azi2,
151 real& s12, real& m12,
152 real& M12, real& M21,
154 outmask &= _caps & OUT_MASK;
160 real sig12, ssig12, csig12, E2 = 0, AB1 = 0;
168 tau12 = s12_a12 / (_b * _eE0),
172 E2 = - _eE.
deltaEinv(_stau1 * c + _ctau1 * s, _ctau1 * c - _stau1 * s);
173 sig12 = tau12 - (E2 - _eE1);
178 real ssig2, csig2, sbet2, cbet2, salp2, calp2;
180 ssig2 = _ssig1 * csig12 + _csig1 * ssig12;
181 csig2 = _csig1 * csig12 - _ssig1 * ssig12;
182 real dn2 = _eE.
Delta(ssig2, csig2);
185 E2 = _eE.
deltaE(ssig2, csig2, dn2);
187 AB1 = _eE0 * (E2 - _eE1);
190 sbet2 = _calp0 * ssig2;
192 cbet2 = hypot(_salp0, _calp0 * csig2);
195 cbet2 = csig2 = tiny_;
197 salp2 = _salp0; calp2 = _calp0 * csig2;
200 s12 = arcmode ? _b * (_eE0 * sig12 + AB1) : s12_a12;
203 real somg2 = _salp0 * ssig2, comg2 = csig2,
204 E = copysign(real(1), _salp0);
206 real cchi2 = _f1 * dn2 * comg2;
209 - (atan2( ssig2, csig2) - atan2( _ssig1, _csig1))
210 + (atan2(E * somg2, cchi2) - atan2(E * _somg1, _cchi1)))
211 : atan2(somg2 * _cchi1 - cchi2 * _somg1,
212 cchi2 * _cchi1 + somg2 * _somg1);
214 _e2/_f1 * _salp0 * _hH0 *
215 (sig12 + (_eE.
deltaH(ssig2, csig2, dn2) - _hH1));
229 real J12 = _k2 * _dD0 * (sig12 + (_eE.
deltaD(ssig2, csig2, dn2) - _dD1));
233 m12 = _b * ((dn2 * (_csig1 * ssig2) - _dn1 * (_ssig1 * csig2))
234 - _csig1 * csig2 * J12);
236 real t = _k2 * (ssig2 - _ssig1) * (ssig2 + _ssig1) / (_dn1 + dn2);
237 M12 = csig12 + (t * ssig2 - csig2 * J12) * _ssig1 / _dn1;
238 M21 = csig12 - (t * _ssig1 - _csig1 * J12) * ssig2 / dn2;
242 if (outmask &
AREA) {
243 real B42 = _aA4 == 0 ? 0 :
246 if (_calp0 == 0 || _salp0 == 0) {
248 salp12 = salp2 * _calp1 - calp2 * _salp1;
249 calp12 = calp2 * _calp1 + salp2 * _salp1;
266 salp12 = _calp0 * _salp0 *
267 (csig12 <= 0 ? _csig1 * (1 - csig12) + ssig12 * _ssig1 :
268 ssig12 * (_csig1 * ssig12 / (1 + csig12) + _ssig1));
271 S12 = _c2 * atan2(salp12, calp12) + _aA4 * (B42 - _bB41);
282 _a13 =
GenPosition(
false, _s13, 0u, t, t, t, t, t, t, t, t);
290 GenPosition(
true, _a13,
DISTANCE, t, t, t, _s13, t, t, t, t);
GeographicLib::Math::real real
Header for GeographicLib::GeodesicLineExact class.
static real integral(real sinx, real cosx, const real F[], int N)
Math::real deltaE(real sn, real cn, real dn) const
void Reset(real k2=0, real alpha2=0)
Math::real Delta(real sn, real cn) const
Math::real deltaD(real sn, real cn, real dn) const
Math::real deltaH(real sn, real cn, real dn) const
Math::real deltaEinv(real stau, real ctau) const
Exact geodesic calculations.
Math::real GenPosition(bool arcmode, real s12_a12, unsigned outmask, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21, real &S12) const
void SetDistance(real s13)
void GenSetDistance(bool arcmode, real s13_a13)
static void sincosd(T x, T &sinx, T &cosx)
static T atan2d(T y, T x)
static void norm(T &x, T &y)
static T AngNormalize(T x)
Namespace for GeographicLib.