52 _caps = caps | LATITUDE | AZIMUTH | LONG_UNROLL;
62 _salp0 = _salp1 * cbet1;
75 _ssig1 = sbet1; _somg1 = _salp0 * sbet1;
76 _csig1 = _comg1 = sbet1 != 0 || _calp1 != 0 ? cbet1 * _calp1 : 1;
78 _cchi1 = _f1 * _dn1 * _comg1;
84 _E.Reset(-_k2, -g.
_ep2, 1 + _k2, 1 + g.
_ep2);
88 _E1 = _E.deltaE(_ssig1, _csig1, _dn1);
91 _stau1 = _ssig1 *
c + _csig1 *
s;
92 _ctau1 = _csig1 *
c - _ssig1 *
s;
99 _D1 = _E.deltaD(_ssig1, _csig1, _dn1);
104 _H1 = _E.deltaH(_ssig1, _csig1, _dn1);
107 if (_caps & CAP_C4) {
108 real eps = _k2 / (2 * (1 +
sqrt(1 + _k2)) + _k2);
111 _A4 =
Math::sq(_a) * _calp0 * _salp0 * _e2;
125 LineInit(g, lat1, lon1, azi1, salp1, calp1, caps);
132 bool arcmode,
real s13_a13) {
133 LineInit(g, lat1, lon1, azi1, salp1, calp1, caps);
134 GenSetDistance(arcmode, s13_a13);
143 outmask &= _caps & OUT_MASK;
144 if (!( Init() && (arcmode || (_caps & (OUT_MASK & DISTANCE_IN))) ))
149 real sig12, ssig12, csig12,
E2 = 0, AB1 = 0;
154 s12a -= 180 *
floor(s12a / 180);
155 ssig12 = s12a == 0 ? 0 :
sin(sig12);
156 csig12 = s12a == 90 ? 0 :
cos(sig12);
160 tau12 = s12_a12 / (_b * _E0),
164 E2 = - _E.deltaEinv(_stau1 *
c + _ctau1 *
s, _ctau1 *
c - _stau1 * s);
165 sig12 = tau12 - (E2 - _E1);
170 real ssig2, csig2, sbet2, cbet2, salp2, calp2;
172 ssig2 = _ssig1 * csig12 + _csig1 * ssig12;
173 csig2 = _csig1 * csig12 - _ssig1 * ssig12;
174 real dn2 = _E.Delta(ssig2, csig2);
175 if (outmask & (DISTANCE | REDUCEDLENGTH | GEODESICSCALE)) {
177 E2 = _E.deltaE(ssig2, csig2, dn2);
179 AB1 = _E0 * (E2 - _E1);
182 sbet2 = _calp0 * ssig2;
187 cbet2 = csig2 = tiny_;
189 salp2 = _salp0; calp2 = _calp0 * csig2;
191 if (outmask & DISTANCE)
192 s12 = arcmode ? _b * (_E0 * sig12 + AB1) : s12_a12;
194 if (outmask & LONGITUDE) {
195 real somg2 = _salp0 * ssig2, comg2 = csig2,
198 real cchi2 = _f1 * dn2 * comg2;
199 real chi12 = outmask & LONG_UNROLL
201 - (
atan2( ssig2, csig2) -
atan2( _ssig1, _csig1))
202 + (
atan2(E * somg2, cchi2) -
atan2(E * _somg1, _cchi1)))
203 :
atan2(somg2 * _cchi1 - cchi2 * _somg1,
204 cchi2 * _cchi1 + somg2 * _somg1);
206 _e2/_f1 * _salp0 * _H0 *
207 (sig12 + (_E.deltaH(ssig2, csig2, dn2) - _H1));
209 lon2 = outmask & LONG_UNROLL ? _lon1 + lon12 :
214 if (outmask & LATITUDE)
217 if (outmask & AZIMUTH)
220 if (outmask & (REDUCEDLENGTH | GEODESICSCALE)) {
221 real J12 = _k2 * _D0 * (sig12 + (_E.deltaD(ssig2, csig2, dn2) - _D1));
222 if (outmask & REDUCEDLENGTH)
225 m12 = _b * ((dn2 * (_csig1 * ssig2) - _dn1 * (_ssig1 * csig2))
226 - _csig1 * csig2 * J12);
227 if (outmask & GEODESICSCALE) {
228 real t = _k2 * (ssig2 - _ssig1) * (ssig2 + _ssig1) / (_dn1 + dn2);
229 M12 = csig12 + (t * ssig2 - csig2 * J12) * _ssig1 / _dn1;
230 M21 = csig12 - (t * _ssig1 - _csig1 * J12) * ssig2 / dn2;
234 if (outmask & AREA) {
238 if (_calp0 == 0 || _salp0 == 0) {
240 salp12 = salp2 * _calp1 - calp2 * _salp1;
241 calp12 = calp2 * _calp1 + salp2 * _salp1;
258 salp12 = _calp0 * _salp0 *
259 (csig12 <= 0 ? _csig1 * (1 - csig12) + ssig12 * _ssig1 :
260 ssig12 * (_csig1 * ssig12 / (1 + csig12) + _ssig1));
263 S12 = _c2 *
atan2(salp12, calp12) + _A4 * (B42 - _B41);
274 _a13 = GenPosition(
false, _s13, 0u, t, t, t, t, t, t, t, t);
282 GenPosition(
true, _a13, DISTANCE, t, t, t, _s13, t, t, t, t);
286 arcmode ? SetArc(s13_a13) : SetDistance(s13_a13);
static T AngNormalize(T x)
static real CosSeries(real sinx, real cosx, const real c[], int n)
void LineInit(const GeodesicExact &g, real lat1, real lon1, real azi1, real salp1, real calp1, unsigned caps)
EIGEN_DEVICE_FUNC const SqrtReturnType sqrt() const
static void sincosd(T x, T &sinx, T &cosx)
void SetDistance(real s13)
static void norm(T &x, T &y)
void g(const string &key, int i)
void GenSetDistance(bool arcmode, real s13_a13)
EIGEN_DEVICE_FUNC const CosReturnType cos() const
Header for GeographicLib::GeodesicLineExact class.
static T atan2d(T y, T x)
Namespace for GeographicLib.
Jet< T, N > atan2(const Jet< T, N > &g, const Jet< T, N > &f)
Exact geodesic calculations.
static T copysign(T x, T y)
EIGEN_DEVICE_FUNC const FloorReturnType floor() const
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
EIGEN_DEVICE_FUNC const SinReturnType sin() const
void C4f(real k2, real c[]) const