public static void ToLatitudeLongitude( double scanningX, VerticalScanningCalculations verticalScanningCalculations, double satelliteLongitude, out double latitude, out double longitude) { var l0 = satelliteLongitude; var satelliteHeight = verticalScanningCalculations.SatelliteHeight; var cosX = Cos(scanningX); var sinX = Sin(scanningX); var cosY = verticalScanningCalculations.CosY; var sinY = verticalScanningCalculations.SinY; var t = verticalScanningCalculations.T; var c = verticalScanningCalculations.C; var a = sinX * sinX + cosX * cosX * t; var b = -2 * satelliteHeight * cosX * cosY; var rs = (-b - Sqrt(b * b - 4 * a * c)) / (2 * a); var sx = rs * cosX * cosY; var sy = -rs * sinX; var sz = rs * cosX * sinY; latitude = Atan(RadiusEquatorSquared / RadiusPolarSquared * (sz / Sqrt((satelliteHeight - sx) * (satelliteHeight - sx) + sy * sy))); longitude = (l0 - Atan(sy / (satelliteHeight - sx))).NormaliseLongitude(); }
public static VerticalScanningCalculations VerticalScanningCalculations(double scanningY, double satelliteHeight) { var calculations = new VerticalScanningCalculations { CosY = Cos(scanningY), SinY = Sin(scanningY), SatelliteHeight = satelliteHeight + RadiusEquator }; calculations.C = calculations.SatelliteHeight * calculations.SatelliteHeight - RadiusEquatorSquared; calculations.T = calculations.CosY * calculations.CosY + RadiusEquatorSquared / RadiusPolarSquared * calculations.SinY * calculations.SinY; return(calculations); }