mirror of https://github.com/apache/lucene.git
parent
6b24910e4a
commit
98d2df17d5
|
@ -244,7 +244,7 @@ allprojects { prj ->
|
||||||
// '-Xep:TryFailThrowable:OFF',
|
// '-Xep:TryFailThrowable:OFF',
|
||||||
'-Xep:TypeParameterQualifier:ERROR',
|
'-Xep:TypeParameterQualifier:ERROR',
|
||||||
'-Xep:UnicodeDirectionalityCharacters:ERROR',
|
'-Xep:UnicodeDirectionalityCharacters:ERROR',
|
||||||
// '-Xep:UnicodeInCode:OFF', // noisy (spatial3d)
|
'-Xep:UnicodeInCode:ERROR',
|
||||||
'-Xep:UnnecessaryCheckNotNull:ERROR',
|
'-Xep:UnnecessaryCheckNotNull:ERROR',
|
||||||
'-Xep:UnnecessaryTypeArgument:ERROR',
|
'-Xep:UnnecessaryTypeArgument:ERROR',
|
||||||
'-Xep:UnsafeWildcard:ERROR',
|
'-Xep:UnsafeWildcard:ERROR',
|
||||||
|
|
|
@ -571,63 +571,69 @@ public class PlanetModel implements SerializableObject {
|
||||||
|
|
||||||
double lat = from.getLatitude();
|
double lat = from.getLatitude();
|
||||||
double lon = from.getLongitude();
|
double lon = from.getLongitude();
|
||||||
double sinα1 = Math.sin(bearing);
|
double sinalpha1 = Math.sin(bearing);
|
||||||
double cosα1 = Math.cos(bearing);
|
double cosalpha1 = Math.cos(bearing);
|
||||||
|
|
||||||
double tanU1 = (1.0 - scaledFlattening) * Math.tan(lat);
|
double tanU1 = (1.0 - scaledFlattening) * Math.tan(lat);
|
||||||
double cosU1 = 1.0 / Math.sqrt((1.0 + tanU1 * tanU1));
|
double cosU1 = 1.0 / Math.sqrt((1.0 + tanU1 * tanU1));
|
||||||
double sinU1 = tanU1 * cosU1;
|
double sinU1 = tanU1 * cosU1;
|
||||||
|
|
||||||
double σ1 = Math.atan2(tanU1, cosα1);
|
double sigma1 = Math.atan2(tanU1, cosalpha1);
|
||||||
double sinα = cosU1 * sinα1;
|
double sinalpha = cosU1 * sinalpha1;
|
||||||
double cosSqα = 1.0 - sinα * sinα;
|
double cosSqalpha = 1.0 - sinalpha * sinalpha;
|
||||||
double uSq = cosSqα * squareRatio;
|
double uSq = cosSqalpha * squareRatio;
|
||||||
double A = 1.0 + uSq / 16384.0 * (4096.0 + uSq * (-768.0 + uSq * (320.0 - 175.0 * uSq)));
|
double A = 1.0 + uSq / 16384.0 * (4096.0 + uSq * (-768.0 + uSq * (320.0 - 175.0 * uSq)));
|
||||||
double B = uSq / 1024.0 * (256.0 + uSq * (-128.0 + uSq * (74.0 - 47.0 * uSq)));
|
double B = uSq / 1024.0 * (256.0 + uSq * (-128.0 + uSq * (74.0 - 47.0 * uSq)));
|
||||||
|
|
||||||
double cos2σM;
|
double cos2sigmaM;
|
||||||
double sinσ;
|
double sinsigma;
|
||||||
double cosσ;
|
double cossigma;
|
||||||
double Δσ;
|
double deltasigma;
|
||||||
|
|
||||||
double σ = dist / (zScaling * inverseScale * A);
|
double sigma = dist / (zScaling * inverseScale * A);
|
||||||
double σʹ;
|
double sigmaprime;
|
||||||
double iterations = 0;
|
double iterations = 0;
|
||||||
do {
|
do {
|
||||||
cos2σM = Math.cos(2.0 * σ1 + σ);
|
cos2sigmaM = Math.cos(2.0 * sigma1 + sigma);
|
||||||
sinσ = Math.sin(σ);
|
sinsigma = Math.sin(sigma);
|
||||||
cosσ = Math.cos(σ);
|
cossigma = Math.cos(sigma);
|
||||||
Δσ =
|
deltasigma =
|
||||||
B
|
B
|
||||||
* sinσ
|
* sinsigma
|
||||||
* (cos2σM
|
* (cos2sigmaM
|
||||||
+ B
|
+ B
|
||||||
/ 4.0
|
/ 4.0
|
||||||
* (cosσ * (-1.0 + 2.0 * cos2σM * cos2σM)
|
* (cossigma * (-1.0 + 2.0 * cos2sigmaM * cos2sigmaM)
|
||||||
- B
|
- B
|
||||||
/ 6.0
|
/ 6.0
|
||||||
* cos2σM
|
* cos2sigmaM
|
||||||
* (-3.0 + 4.0 * sinσ * sinσ)
|
* (-3.0 + 4.0 * sinsigma * sinsigma)
|
||||||
* (-3.0 + 4.0 * cos2σM * cos2σM)));
|
* (-3.0 + 4.0 * cos2sigmaM * cos2sigmaM)));
|
||||||
σʹ = σ;
|
sigmaprime = sigma;
|
||||||
σ = dist / (zScaling * inverseScale * A) + Δσ;
|
sigma = dist / (zScaling * inverseScale * A) + deltasigma;
|
||||||
} while (Math.abs(σ - σʹ) >= Vector.MINIMUM_RESOLUTION && ++iterations < 100);
|
} while (Math.abs(sigma - sigmaprime) >= Vector.MINIMUM_RESOLUTION && ++iterations < 100);
|
||||||
double x = sinU1 * sinσ - cosU1 * cosσ * cosα1;
|
double x = sinU1 * sinsigma - cosU1 * cossigma * cosalpha1;
|
||||||
double φ2 =
|
double phi2 =
|
||||||
Math.atan2(
|
Math.atan2(
|
||||||
sinU1 * cosσ + cosU1 * sinσ * cosα1,
|
sinU1 * cossigma + cosU1 * sinsigma * cosalpha1,
|
||||||
(1.0 - scaledFlattening) * Math.sqrt(sinα * sinα + x * x));
|
(1.0 - scaledFlattening) * Math.sqrt(sinalpha * sinalpha + x * x));
|
||||||
double λ = Math.atan2(sinσ * sinα1, cosU1 * cosσ - sinU1 * sinσ * cosα1);
|
double lambda =
|
||||||
double C = scaledFlattening / 16.0 * cosSqα * (4.0 + scaledFlattening * (4.0 - 3.0 * cosSqα));
|
Math.atan2(sinsigma * sinalpha1, cosU1 * cossigma - sinU1 * sinsigma * cosalpha1);
|
||||||
|
double C =
|
||||||
|
scaledFlattening / 16.0 * cosSqalpha * (4.0 + scaledFlattening * (4.0 - 3.0 * cosSqalpha));
|
||||||
double L =
|
double L =
|
||||||
λ
|
lambda
|
||||||
- (1.0 - C)
|
- (1.0 - C)
|
||||||
* scaledFlattening
|
* scaledFlattening
|
||||||
* sinα
|
* sinalpha
|
||||||
* (σ + C * sinσ * (cos2σM + C * cosσ * (-1.0 + 2.0 * cos2σM * cos2σM)));
|
* (sigma
|
||||||
double λ2 = (lon + L + 3.0 * Math.PI) % (2.0 * Math.PI) - Math.PI; // normalise to -180..+180
|
+ C
|
||||||
|
* sinsigma
|
||||||
|
* (cos2sigmaM + C * cossigma * (-1.0 + 2.0 * cos2sigmaM * cos2sigmaM)));
|
||||||
|
double lambda2 =
|
||||||
|
(lon + L + 3.0 * Math.PI) % (2.0 * Math.PI) - Math.PI; // normalise to -180..+180
|
||||||
|
|
||||||
return new GeoPoint(this, φ2, λ2);
|
return new GeoPoint(this, phi2, lambda2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue