8 package net.sf.geographiclib;
102 private double _a, _f, _b, _c2, _f1, _salp0, _calp0, _k2,
103 _salp1, _calp1, _ssig1, _csig1, _dn1, _stau1, _ctau1, _somg1, _comg1,
104 _A1m1, _A2m1, _A3c, _B11, _B21, _B31, _A4, _B41;
107 private double _C1a[], _C1pa[], _C2a[], _C3a[],
128 double lat1,
double lon1,
double azi1) {
178 double lat1,
double lon1,
double azi1,
185 LineInit(g, lat1, lon1, azi1, salp1, calp1, caps);
189 double lat1,
double lon1,
190 double azi1,
double salp1,
double calp1,
203 _azi1 = azi1; _salp1 = salp1; _calp1 = calp1;
210 _dn1 = Math.sqrt(1 + g._ep2 *
GeoMath.
sq(sbet1));
213 _salp0 = _salp1 * cbet1;
226 _ssig1 = sbet1; _somg1 = _salp0 * sbet1;
227 _csig1 = _comg1 = sbet1 != 0 || _calp1 != 0 ? cbet1 * _calp1 : 1;
233 double eps = _k2 / (2 * (1 + Math.sqrt(1 + _k2)) + _k2);
237 _C1a =
new double[nC1_ + 1];
240 double s = Math.sin(_B11),
c = Math.cos(_B11);
242 _stau1 = _ssig1 *
c + _csig1 *
s;
243 _ctau1 = _csig1 *
c - _ssig1 *
s;
249 _C1pa =
new double[nC1p_ + 1];
254 _C2a =
new double[nC2_ + 1];
261 _C3a =
new double[
nC3_];
263 _A3c = -_f * _salp0 * g.
A3f(eps);
268 _C4a =
new double[
nC4_];
271 _A4 =
GeoMath.
sq(_a) * _calp0 * _salp0 * g._e2;
277 double lat1,
double lon1,
278 double azi1,
double salp1,
double calp1,
279 int caps,
boolean arcmode,
double s13_a13) {
280 LineInit(g, lat1, lon1, azi1, salp1, calp1, caps);
335 return Position(
false, s12, outmask);
375 return Position(
true, a12, outmask);
438 double sig12, ssig12, csig12, B12 = 0, AB1 = 0;
442 sig12 = Math.toRadians(s12_a12);
449 tau12 = s12_a12 / (_b * (1 + _A1m1)),
454 _stau1 *
c + _ctau1 *
s,
455 _ctau1 *
c - _stau1 * s,
457 sig12 = tau12 - (B12 - _B11);
458 ssig12 = Math.sin(sig12); csig12 = Math.cos(sig12);
459 if (Math.abs(_f) > 0.01) {
483 ssig2 = _ssig1 * csig12 + _csig1 * ssig12,
484 csig2 = _csig1 * csig12 - _ssig1 * ssig12;
486 double serr = (1 + _A1m1) * (sig12 + (B12 - _B11)) - s12_a12 / _b;
487 sig12 = sig12 - serr / Math.sqrt(1 + _k2 *
GeoMath.
sq(ssig2));
488 ssig12 = Math.sin(sig12); csig12 = Math.cos(sig12);
491 r.
a12 = Math.toDegrees(sig12);
494 double ssig2, csig2, sbet2, cbet2, salp2, calp2;
496 ssig2 = _ssig1 * csig12 + _csig1 * ssig12;
497 csig2 = _csig1 * csig12 - _ssig1 * ssig12;
498 double dn2 = Math.sqrt(1 + _k2 *
GeoMath.
sq(ssig2));
501 if (arcmode || Math.abs(_f) > 0.01)
503 AB1 = (1 + _A1m1) * (B12 - _B11);
506 sbet2 = _calp0 * ssig2;
513 salp2 = _salp0; calp2 = _calp0 * csig2;
516 r.
s12 = _b * ((1 + _A1m1) * sig12 + AB1);
520 double somg2 = _salp0 * ssig2, comg2 = csig2,
525 - (Math.atan2( ssig2, csig2) - Math.atan2( _ssig1, _csig1))
526 + (Math.atan2(E*somg2, comg2) - Math.atan2(E*_somg1, _comg1)))
527 : Math.atan2(somg2 * _comg1 - comg2 * _somg1,
528 comg2 * _comg1 + somg2 * _somg1);
529 double lam12 = omg12 + _A3c *
532 double lon12 = Math.toDegrees(lam12);
547 AB2 = (1 + _A2m1) * (B22 - _B21),
548 J12 = (_A1m1 - _A2m1) * sig12 + (AB1 - AB2);
552 r.
m12 = _b * ((dn2 * (_csig1 * ssig2) - _dn1 * (_ssig1 * csig2))
553 - _csig1 * csig2 * J12);
555 double t = _k2 * (ssig2 - _ssig1) * (ssig2 + _ssig1) / (_dn1 + dn2);
556 r.
M12 = csig12 + (t * ssig2 - csig2 * J12) * _ssig1 / _dn1;
557 r.
M21 = csig12 - (t * _ssig1 - _csig1 * J12) * ssig2 / dn2;
564 double salp12, calp12;
565 if (_calp0 == 0 || _salp0 == 0) {
567 salp12 = salp2 * _calp1 - calp2 * _salp1;
568 calp12 = calp2 * _calp1 + salp2 * _salp1;
578 salp12 = _calp0 * _salp0 *
579 (csig12 <= 0 ? _csig1 * (1 - csig12) + ssig12 * _ssig1 :
580 ssig12 * (_csig1 * ssig12 / (1 + csig12) + _ssig1));
583 r.
S12 = _c2 * Math.atan2(salp12, calp12) + _A4 * (B42 - _B41);
613 void SetArc(
double a13) {
640 private boolean Init() {
return _caps != 0; }
652 {
return Init() ? _lon1 : Double.NaN; }
658 {
return Init() ? _azi1 : Double.NaN; }
665 return new Pair(
Init() ? _salp1 : Double.NaN,
666 Init() ? _calp1 : Double.NaN);
683 return new Pair(
Init() ? _salp0 : Double.NaN,
684 Init() ? _calp0 : Double.NaN);
701 {
return Init() ?
_a : Double.NaN; }
708 {
return Init() ? _f : Double.NaN; }
722 return (_caps & testcaps) == testcaps;
734 {
return Init() ? (arcmode ?
_a13 : _s13) : Double.NaN; }
static double A1m1f(double eps)
GeodesicData Position(boolean arcmode, double s12_a12, int outmask)
GeodesicData Position(double s12)
static void C1f(double eps, double c[])
boolean Capabilities(int testcaps)
static double hypot(double x, double y)
GeodesicData ArcPosition(double a12)
static void C2f(double eps, double c[])
static final int REDUCEDLENGTH
static final double tiny_
void GenSetDistance(boolean arcmode, double s13_a13)
static final int STANDARD
static final int LONGITUDE
double EquatorialAzimuth()
void C3f(double eps, double c[])
void g(const string &key, int i)
void C4f(double eps, double c[])
static double atan2d(double y, double x)
static double A2m1f(double eps)
static Pair norm(double sinx, double cosx)
GeodesicData ArcPosition(double a12, int outmask)
GeodesicLine(Geodesic g, double lat1, double lon1, double azi1, int caps)
GeodesicData Position(double s12, int outmask)
static final int DISTANCE
Pair EquatorialAzimuthCosines()
static double SinCosSeries(boolean sinp, double sinx, double cosx, double c[])
static double LatFix(double x)
static double copysign(double x, double y)
void SetDistance(double s13)
static Pair sincosd(double x)
static final int LONG_UNROLL
static final int LATITUDE
static final int DISTANCE_IN
static double AngRound(double x)
void LineInit(Geodesic g, double lat1, double lon1, double azi1, double salp1, double calp1, int caps)
static final int GEODESICSCALE
static double sq(double x)
static void C1pf(double eps, double c[])
static double AngNormalize(double x)
double GenDistance(boolean arcmode)
static final int OUT_MASK
GeodesicLine(Geodesic g, double lat1, double lon1, double azi1, double salp1, double calp1, int caps, boolean arcmode, double s13_a13)
GeodesicLine(Geodesic g, double lat1, double lon1, double azi1)