/// <summary> /// Recalculation of sunrise time for given travelling /// </summary> /// <param name="sun"></param> /// <param name="locChange"></param> private static void recalculateSunriseTravel(GPSun sun, GPLocationChange locChange) { GPSun newSun = new GPSun(); double drStep = 0.5; double dr = 0.0; int steps = 0; while (steps < 25) { GPLocation lp = locChange.getTravellingLocation(dr); double jd = locChange.julianStart + (locChange.julianEnd - locChange.julianStart) * dr; GPGregorianTime gt = new GPGregorianTime(lp); gt.setJulianGreenwichTime(jd); GPLocationProvider lpr = new GPLocationProvider(lp); newSun.calculateRise(sun.rise, lpr); newSun.updateSunriseTimes(sun.rise, lpr); if (gt.getJulianGreenwichTime() > newSun.rise.getJulianGreenwichTime()) { drStep = drStep / 2; dr -= drStep; } else { dr += drStep; } steps++; } sun.rise = newSun.rise; sun.sunrise_deg = newSun.sunrise_deg; sun.eclipticalLongitude = newSun.eclipticalLongitude; }
/// <summary> /// recalculation of arunodaya time for given travelling /// </summary> /// <param name="sun"></param> /// <param name="locChange"></param> private static void recalculateArunodayaTravel(GPSun sun, GPLocationChange locChange) { GPSun newSun = new GPSun(); double drStep = 0.5; double dr = 0.0; int steps = 0; while (steps < 25) { GPLocation lp = locChange.getTravellingLocation(dr); double jd = locChange.julianStart + (locChange.julianEnd - locChange.julianStart) * dr; GPGregorianTime gt = new GPGregorianTime(lp); gt.setJulianGreenwichTime(jd); GPLocationProvider lpr = new GPLocationProvider(lp); newSun.calculateRise(sun.rise, lpr); newSun.updateSunriseTimes(sun.rise, lpr); // Debugger.Log(0, "", String.Format("ROW: {0} {1} {2} {3}\n", lp.getLongitudeString(), lp.getLatitudeString(), // newSun.rise.getLongTimeString(), gt.getLongTimeString())); if (gt.getJulianGreenwichTime() > newSun.arunodaya.getJulianGreenwichTime()) { drStep = drStep / 2; dr -= drStep; } else { dr += drStep; } steps++; } sun.arunodaya = newSun.arunodaya; sun.arunodaya_deg = newSun.arunodaya_deg; sun.longitude_arun_deg = newSun.longitude_arun_deg; }