51 _caps = caps | LATITUDE | AZIMUTH | LONG_UNROLL;
60 _salp0 = _salp1 * cbet1;
73 _ssig1 = sbet1; _somg1 = _salp0 * sbet1;
74 _csig1 = _comg1 = sbet1 != 0 || _calp1 != 0 ? cbet1 * _calp1 : 1;
79 real eps = _k2 / (2 * (1 +
sqrt(1 + _k2)) + _k2);
87 _stau1 = _ssig1 *
c + _csig1 *
s;
88 _ctau1 = _csig1 *
c - _ssig1 *
s;
102 if (_caps & CAP_C3) {
104 _A3c = -_f * _salp0 *
g.A3f(eps);
108 if (_caps & CAP_C4) {
111 _A4 =
Math::sq(_a) * _calp0 * _salp0 *
g._e2;
125 LineInit(
g, lat1, lon1, azi1, salp1, calp1, caps);
131 unsigned caps,
bool arcmode,
real s13_a13) {
132 LineInit(
g, lat1, lon1, azi1, salp1, calp1, caps);
133 GenSetDistance(arcmode, s13_a13);
142 outmask &= _caps & OUT_MASK;
143 if (!( Init() && (arcmode || (_caps & (OUT_MASK & DISTANCE_IN))) ))
148 real sig12, ssig12, csig12, B12 = 0, AB1 = 0;
156 tau12 = s12_a12 / (_b * (1 + _A1m1)),
161 _stau1 *
c + _ctau1 *
s,
162 _ctau1 *
c - _stau1 *
s,
164 sig12 = tau12 - (B12 - _B11);
165 ssig12 =
sin(sig12); csig12 =
cos(sig12);
166 if (
abs(_f) > 0.01) {
190 ssig2 = _ssig1 * csig12 + _csig1 * ssig12,
191 csig2 = _csig1 * csig12 - _ssig1 * ssig12;
193 real serr = (1 + _A1m1) * (sig12 + (B12 - _B11)) - s12_a12 / _b;
195 ssig12 =
sin(sig12); csig12 =
cos(sig12);
200 real ssig2, csig2, sbet2, cbet2, salp2, calp2;
202 ssig2 = _ssig1 * csig12 + _csig1 * ssig12;
203 csig2 = _csig1 * csig12 - _ssig1 * ssig12;
205 if (outmask & (DISTANCE | REDUCEDLENGTH | GEODESICSCALE)) {
206 if (arcmode ||
abs(_f) > 0.01)
208 AB1 = (1 + _A1m1) * (B12 - _B11);
211 sbet2 = _calp0 * ssig2;
216 cbet2 = csig2 = tiny_;
218 salp2 = _salp0; calp2 = _calp0 * csig2;
220 if (outmask & DISTANCE)
221 s12 = arcmode ? _b * ((1 + _A1m1) * sig12 + AB1) : s12_a12;
223 if (outmask & LONGITUDE) {
225 real somg2 = _salp0 * ssig2, comg2 = csig2,
228 real omg12 = outmask & LONG_UNROLL
230 - (
atan2( ssig2, csig2) -
atan2( _ssig1, _csig1))
231 + (
atan2(
E * somg2, comg2) -
atan2(
E * _somg1, _comg1)))
232 :
atan2(somg2 * _comg1 - comg2 * _somg1,
233 comg2 * _comg1 + somg2 * _somg1);
234 real lam12 = omg12 + _A3c *
238 lon2 = outmask & LONG_UNROLL ? _lon1 + lon12 :
243 if (outmask & LATITUDE)
246 if (outmask & AZIMUTH)
249 if (outmask & (REDUCEDLENGTH | GEODESICSCALE)) {
252 AB2 = (1 + _A2m1) * (B22 - _B21),
253 J12 = (_A1m1 - _A2m1) * sig12 + (AB1 - AB2);
254 if (outmask & REDUCEDLENGTH)
257 m12 = _b * ((dn2 * (_csig1 * ssig2) - _dn1 * (_ssig1 * csig2))
258 - _csig1 * csig2 * J12);
259 if (outmask & GEODESICSCALE) {
260 real t = _k2 * (ssig2 - _ssig1) * (ssig2 + _ssig1) / (_dn1 + dn2);
261 M12 = csig12 + (
t * ssig2 - csig2 * J12) * _ssig1 / _dn1;
262 M21 = csig12 - (
t * _ssig1 - _csig1 * J12) * ssig2 / dn2;
266 if (outmask & AREA) {
270 if (_calp0 == 0 || _salp0 == 0) {
272 salp12 = salp2 * _calp1 - calp2 * _salp1;
273 calp12 = calp2 * _calp1 + salp2 * _salp1;
290 salp12 = _calp0 * _salp0 *
291 (csig12 <= 0 ? _csig1 * (1 - csig12) + ssig12 * _ssig1 :
292 ssig12 * (_csig1 * ssig12 / (1 + csig12) + _ssig1));
295 S12 = _c2 *
atan2(salp12, calp12) + _A4 * (B42 - _B41);
306 _a13 = GenPosition(
false, _s13, 0u,
t,
t,
t,
t,
t,
t,
t,
t);
314 GenPosition(
true, _a13, DISTANCE,
t,
t,
t, _s13,
t,
t,
t,
t);
318 arcmode ? SetArc(s13_a13) : SetDistance(s13_a13);