コード例 #1
0
        /// <summary>
        /// Based on Chapter 39, Meeus and Chapter 10
        /// </summary>
        /// <param name="obs"></param>
        public void makeTopocentric(GPObserver obs)
        {
            double       u, h, delta_alpha;
            double       rho_sin, rho_cos;
            const double b_a = 0.99664719;

            // geocentric position of observer on the earth surface
            // 10.1 - 10.3
            u       = GPMath.arctanDeg(b_a * b_a * GPMath.tanDeg(obs.GetLatitudeNorthPositive()));
            rho_sin = b_a * GPMath.sinDeg(u) + obs.GetAltitude() / 6378140.0 * GPMath.sinDeg(obs.GetLatitudeNorthPositive());
            rho_cos = GPMath.cosDeg(u) + obs.GetAltitude() / 6378140.0 * GPMath.cosDeg(obs.GetLatitudeNorthPositive());

            // equatorial horizontal paralax
            // 39.1
            this.parallax = GPMath.arcsinDeg(GPMath.sinDeg(8.794 / 3600) / (this.distanceFromEarth / GPAstroEngine.AU));

            // geocentric hour angle of the body
            h = apparent_sidereal_time - obs.GetLongitudeWestPositive() - right_ascession;


            // 39.2
            delta_alpha = GPMath.arctanDeg(
                (-rho_cos * GPMath.sinDeg(this.parallax) * GPMath.sinDeg(h)) /
                (GPMath.cosDeg(this.declination) - rho_cos * GPMath.sinDeg(this.parallax) * GPMath.cosDeg(h)));

            this.right_ascession += delta_alpha;
            this.declination      = GPMath.arctanDeg(
                ((GPMath.sinDeg(this.declination) - rho_sin * GPMath.sinDeg(this.parallax)) * GPMath.cosDeg(delta_alpha)) /
                (GPMath.cosDeg(this.declination) - rho_cos * GPMath.sinDeg(this.parallax) * GPMath.cosDeg(h)));
        }
コード例 #2
0
        private void calculateRiseSetMethodA(GPGregorianTime vct, GPLocationProvider ed, double DayHours, GPSun sun, double DG, double RAD)
        {
            double time       = vct.getJulianLocalNoon() - 0.5 + DayHours / 360 - vct.getTimeZoneOffsetHours() / 24.0;
            double dLatitude  = ed.getLocation(time).GetLatitudeNorthPositive();
            double dLongitude = ed.getLocation(time).GetLongitudeEastPositive();
            //Debugger.Log(0,"",String.Format("{0}     {1} {2}\n", vct.getLongDateString(), dLatitude, dLongitude));
            // definition of event
            // eventdef = 0.0;
            // civil twilight eventdef = 0.10453;
            // nautical twilight eventdef = 0.20791;
            // astronomical twilight eventdef = 0.30902;
            // center of the sun on the horizont eventdef = 0.01454;
            double eventdef = 0.01454;

            double x = GPMath.tanDeg(dLatitude) * GPMath.tanDeg(sun.declination) + eventdef / (GPMath.cosDeg(dLatitude) * GPMath.cosDeg(sun.declination));

            if (x < -1.0 || x > 1.0)
            {
                // initial values for the case
                // that no rise no set for that day
                sun.sunrise_deg = -360;
                sun.noon_deg    = -360;
                sun.sunset_deg  = -360;
                return;
            }

            double hourAngle = GPMath.arcsinDeg(x);

            // time of sunrise
            sun.sunrise_deg = 90.0 - dLongitude - hourAngle + equationOfTime;
            // time of noon
            sun.noon_deg = 180.0 - dLongitude + equationOfTime;
            // time of sunset
            sun.sunset_deg = 270.0 - dLongitude + hourAngle + equationOfTime;
        }
コード例 #3
0
        public static void calc_geocentric(ref double longitude, ref double latitude, ref double rektaszension, ref double declination, double date)
        {
            //var
            double epsilon;      //: extended;
            double delta_phi;    //: extended;
            double alpha, delta; //: extended;

            calc_epsilon_phi(date, out delta_phi, out epsilon);
            longitude = GPMath.putIn360(longitude + delta_phi);

            alpha = GPMath.arctan2Deg(GPMath.sinDeg(longitude) * GPMath.cosDeg(epsilon) - GPMath.tanDeg(latitude) * GPMath.sinDeg(epsilon), GPMath.cosDeg(longitude));

            delta = GPMath.arcsinDeg(GPMath.sinDeg(latitude) * GPMath.cosDeg(epsilon) + GPMath.cosDeg(latitude) * GPMath.sinDeg(epsilon) * GPMath.sinDeg(longitude));

            rektaszension = alpha;
            declination   = delta;

            double xg, yg, zg;

            xg = GPMath.cosDeg(longitude) * GPMath.cosDeg(latitude);
            yg = GPMath.sinDeg(longitude) * GPMath.cosDeg(latitude);
            zg = GPMath.sinDeg(latitude);

            alpha = GPMath.arctan2Deg(yg * GPMath.cosDeg(epsilon) - zg * GPMath.sinDeg(epsilon), GPMath.cosDeg(longitude) * GPMath.cosDeg(latitude));
        }