Ejemplo n.º 1
0
 private CrdsHorizontal MarsMoon_Horizontal(SkyContext c, int m)
 {
     return(c.Get(MarsMoon_Equatorial, m).ToHorizontal(c.GeoLocation, c.SiderealTime));
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Gets horizontal parallax of planet
 /// </summary>
 private double Parallax(SkyContext c, int p)
 {
     return(PlanetEphem.Parallax(c.Get(DistanceFromEarth, p)));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Gets apparent horizontal coordinates of planet
 /// </summary>
 private CrdsHorizontal Horizontal(SkyContext c, int p)
 {
     return(c.Get(Equatorial, p).ToHorizontal(c.GeoLocation, c.SiderealTime));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Gets geocentrical equatorial coordinates of planet
 /// </summary>
 private CrdsEquatorial Equatorial0(SkyContext c, int p)
 {
     return(c.Get(Ecliptical, p).ToEquatorial(c.Epsilon));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Gets distance from planet to Sun
 /// </summary>
 private double DistanceFromSun(SkyContext c, int p)
 {
     return(c.Get(Heliocentrical, p).R);
 }
Ejemplo n.º 6
0
        protected double DistanceFromEarth(SkyContext c, T body)
        {
            var r = c.Get(RectangularG, body);

            return(Math.Sqrt(r.X * r.X + r.Y * r.Y + r.Z * r.Z));
        }
Ejemplo n.º 7
0
 public override void Calculate(SkyContext context)
 {
     context.DayLightFactor = context.Get(DaylightFactor);
 }
Ejemplo n.º 8
0
 public double Semidiameter(SkyContext c)
 {
     return(SolarEphem.Semidiameter(c.Get(Ecliptical).Distance));
 }
Ejemplo n.º 9
0
        public override void Calculate(SkyContext context)
        {
            foreach (var p in planets)
            {
                if (p.Number == Planet.EARTH)
                {
                    continue;
                }

                int n = p.Number;

                p.Equatorial      = context.Get(Planet_Equatorial, n);
                p.Horizontal      = context.Get(Planet_Horizontal, n);
                p.Appearance      = context.Get(Planet_Appearance, n);
                p.Magnitude       = context.Get(Planet_Magnitude, n);
                p.DistanceFromSun = context.Get(Planet_DistanceFromSun, n);
                p.Semidiameter    = context.Get(Planet_Semidiameter, n);
                p.Phase           = context.Get(Planet_Phase, n);
                p.Elongation      = context.Get(Planet_Elongation, n);
                p.Ecliptical      = context.Get(Planet_Ecliptical, n);

                if (p.Number == Planet.MARS)
                {
                    foreach (var m in marsMoons)
                    {
                        int mn = m.Number;
                        m.Rectangular       = context.Get(MarsMoon_Rectangular, mn);
                        m.Equatorial        = context.Get(MarsMoon_Equatorial, mn);
                        m.Horizontal        = context.Get(MarsMoon_Horizontal, mn);
                        m.Semidiameter      = context.Get(MarsMoon_Semidiameter, mn);
                        m.DistanceFromEarth = context.Get(MarsMoon_Ecliptical, mn).Distance;
                    }

                    MarsNPCWidth = context.Get(Mars_PolarCap, PolarCap.Northern);
                    MarsSPCWidth = context.Get(Mars_PolarCap, PolarCap.Southern);
                }

                if (p.Number == Planet.JUPITER)
                {
                    foreach (var m in JupiterMoons)
                    {
                        int mn = m.Number;
                        m.Rectangular       = context.Get(JupiterMoon_Rectangular, mn);
                        m.RectangularS      = context.Get(JupiterMoonShadow_Rectangular, mn);
                        m.Equatorial        = context.Get(JupiterMoon_Equatorial, mn);
                        m.Horizontal        = context.Get(JupiterMoon_Horizontal, mn);
                        m.Semidiameter      = context.Get(JupiterMoon_Semidiameter, mn);
                        m.CM                = context.Get(JupiterMoon_CentralMeridian, mn);
                        m.Magnitude         = context.Get(JupiterMoon_Magnitude, mn);
                        m.DistanceFromEarth = context.Get(JupiterMoon_DistanceFromEarth, mn);
                    }

                    GreatRedSpotLongitude = context.Get(Jupiter_GreatRedSpotLongitude);
                }

                if (p.Number == Planet.SATURN)
                {
                    foreach (var m in SaturnMoons)
                    {
                        int mn = m.Number;
                        m.Rectangular       = context.Get(SaturnMoon_Rectangular, mn);
                        m.Equatorial        = context.Get(SaturnMoon_Equatorial, mn);
                        m.Horizontal        = context.Get(SaturnMoon_Horizontal, mn);
                        m.Semidiameter      = context.Get(SaturnMoon_Semidiameter, mn);
                        m.Magnitude         = context.Get(SaturnMoon_Magnitude, mn);
                        m.DistanceFromEarth = context.Get(SaturnMoon_DistanceFromEarth, mn);
                    }

                    SaturnRings = context.Get(Saturn_RingsAppearance, n);
                }

                if (p.Number == Planet.URANUS)
                {
                    foreach (var m in uranusMoons)
                    {
                        int mn = m.Number;
                        m.Rectangular       = context.Get(UranusMoon_Rectangular, mn);
                        m.Equatorial        = context.Get(UranusMoon_Equatorial, mn);
                        m.Horizontal        = context.Get(UranusMoon_Horizontal, mn);
                        m.Semidiameter      = context.Get(UranusMoon_Semidiameter, mn);
                        m.Magnitude         = context.Get(UranusMoon_Magnitude, mn);
                        m.DistanceFromEarth = context.Get(UranusMoon_Ecliptical, mn).Distance;
                    }
                }

                if (p.Number == Planet.NEPTUNE)
                {
                    foreach (var m in neptuneMoons)
                    {
                        int mn = m.Number;
                        m.Equatorial        = context.Get(NeptuneMoon_Equatorial, mn);
                        m.Horizontal        = context.Get(NeptuneMoon_Horizontal, mn);
                        m.Semidiameter      = context.Get(NeptuneMoon_Semidiameter, mn);
                        m.Magnitude         = context.Get(NeptuneMoon_Magnitude, mn);
                        m.DistanceFromEarth = context.Get(NeptuneMoon_Ecliptical, mn).Distance;
                    }
                }

                foreach (var m in genericMoons)
                {
                    m.Equatorial        = context.Get(GenericMoon_Equatorial, m.Id);
                    m.Horizontal        = context.Get(GenericMoon_Horizontal, m.Id);
                    m.Semidiameter      = context.Get(GenericMoon_Semidiameter, m.Id);
                    m.Magnitude         = context.Get(GenericMoon_Magnitude, m.Id);
                    m.DistanceFromEarth = context.Get(GenericMoon_Ecliptical, m.Id).Distance;
                }
            }

            pluto.Equatorial        = context.Get(Pluto_Equatorial);
            pluto.Horizontal        = context.Get(Pluto_Horizontal);
            pluto.Appearance        = context.Get(Pluto_Appearance);
            pluto.Semidiameter      = context.Get(Pluto_Semidiameter);
            pluto.Magnitude         = context.Get(Pluto_Magnitude);
            pluto.DistanceFromEarth = context.Get(Pluto_DistanceFromEarth);
            pluto.Ecliptical        = context.Get(Pluto_Ecliptical);
        }
Ejemplo n.º 10
0
 private CrdsEquatorial Equatorial(SkyContext c)
 {
     return(c.Get(Equatorial0).ToTopocentric(c.GeoLocation, c.SiderealTime, c.Get(Parallax)));
 }
Ejemplo n.º 11
0
 public CrdsHorizontal Horizontal(SkyContext c)
 {
     return(c.Get(Equatorial).ToHorizontal(c.GeoLocation, c.SiderealTime));
 }
Ejemplo n.º 12
0
 private double Parallax(SkyContext c)
 {
     return(SolarEphem.Parallax(c.Get(Ecliptical).Distance));
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Gets geocentric equatorial coordinates of the Sun
 /// </summary>
 public CrdsEquatorial Equatorial0(SkyContext c)
 {
     return(c.Get(Ecliptical).ToEquatorial(c.Epsilon));
 }
Ejemplo n.º 14
0
        private double MarsMoon_Semidiameter(SkyContext c, int m)
        {
            var distance = c.Get(MarsMoon_Ecliptical, m).Distance;

            return(MartianMoons.Semidiameter(m, distance));
        }
Ejemplo n.º 15
0
 /// <summary>
 /// Gets difference between ecliptical longitudes of the Sun and minor body
 /// </summary>
 public double LongitudeDifference(SkyContext c, T body)
 {
     return(BasicEphem.LongitudeDifference(c.Get(SunEcliptical).Lambda, c.Get(Ecliptical, body).Lambda));
 }
Ejemplo n.º 16
0
        /// <summary>
        /// Calculates horizontal coordinates of comet tail end
        /// </summary>
        private CrdsHorizontal TailHorizontal(SkyContext ctx, Comet c)
        {
            var eq = ctx.Get(TailEquatorial, c);

            return(eq.ToHorizontal(ctx.GeoLocation, ctx.SiderealTime));
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Gets Earth's distance from the Sun, in a.u.
        /// </summary>
        protected double EarthDistanceFromSun(SkyContext c)
        {
            var r = c.Get(SunRectangular);

            return(Math.Sqrt(r.X * r.X + r.Y * r.Y + r.Z * r.Z));
        }
Ejemplo n.º 18
0
        public CrdsEcliptical Ecliptical(SkyContext c, T body)
        {
            var r = c.Get(RectangularG, body);

            return(r.ToEcliptical());
        }
Ejemplo n.º 19
0
        public double DistanceFromSun(SkyContext c, T body)
        {
            var r = c.Get(RectangularH, body);

            return(Math.Sqrt(r.X * r.X + r.Y * r.Y + r.Z * r.Z));
        }
Ejemplo n.º 20
0
 protected double Phase(SkyContext c, T body)
 {
     return(BasicEphem.Phase(c.Get(PhaseAngle, body)));
 }
Ejemplo n.º 21
0
        private float DaylightFactor(SkyContext c)
        {
            var hSun = c.Get(solarCalc.Horizontal);

            double alt = hSun.Altitude;

            if (alt >= 0)
            {
                var hMoon  = c.Get(lunarCalc.Horizontal);
                var sdSun  = c.Get(solarCalc.Semidiameter);
                var sdMoon = c.Get(lunarCalc.Semidiameter);

                // Angular separation between Sun and Moon disks, in arcseconds
                double delta = Angle.Separation(hSun, hMoon) * 3600.0;

                if (delta < Math.Abs(sdSun - sdMoon))
                {
                    return(0);
                }

                // Solar eclipse (disks are overlapping)
                if (delta <= sdSun + sdMoon)
                {
                    // find overlapping area of two circles
                    // (https://abakbot.ru/online-2/73-ploshhad-peresecheniya-okruzhnostej)

                    double r1 = sdSun;
                    double r2 = sdMoon;
                    double f1 = 2 * Math.Acos((r1 * r1 - r2 * r2 + delta * delta) / (2 * r1 * delta));
                    double f2 = 2 * Math.Acos((r2 * r2 - r1 * r1 + delta * delta) / (2 * r2 * delta));

                    double s1 = r1 * r1 * Math.Sin(f1 - Math.Sin(f1)) / 2;
                    double s2 = r2 * r2 * Math.Sin(f2 - Math.Sin(f2)) / 2;

                    // area of overlapping area
                    double s = s1 + s2;

                    // area of Sun disk
                    double ss = Math.PI * r1 * r1;

                    double percentage = Math.Abs(s / ss);

                    if (percentage <= 0.1)
                    {
                        return((float)(percentage / 0.1));
                    }
                }
            }

            // Absolute value of solar altitude
            // at the end of Nautical twilight / beginning of Astronomical twilight
            const double nightAlt = 12;

            if (alt >= 0)
            {
                return(1);
            }
            else if (alt < 0 && alt > -nightAlt)
            {
                return(1 - (float)(-alt / nightAlt));
            }
            else
            {
                return(0);
            }
        }
Ejemplo n.º 22
0
 /// <summary>
 /// Gets horizontal parallax of minor body
 /// </summary>
 protected double Parallax(SkyContext c, T body)
 {
     return(PlanetEphem.Parallax(c.Get(DistanceFromEarth, body)));
 }
Ejemplo n.º 23
0
 /// <summary>
 /// Gets distance from Earth to planet
 /// </summary>
 private double DistanceFromEarth(SkyContext c, int p)
 {
     return(c.Get(Ecliptical, p).Distance);
 }
Ejemplo n.º 24
0
        /// <summary>
        /// Gets horizontal coordinates of minor body
        /// </summary>
        protected CrdsHorizontal Horizontal(SkyContext c, T body)
        {
            var eq = c.Get(EquatorialT, body);

            return(eq.ToHorizontal(c.GeoLocation, c.SiderealTime));
        }
Ejemplo n.º 25
0
 /// <summary>
 /// Gets visible semidianeter of planet
 /// </summary>
 private double Semidiameter(SkyContext c, int p)
 {
     return(PlanetEphem.Semidiameter(p, c.Get(DistanceFromEarth, p)));
 }
Ejemplo n.º 26
0
        /// <summary>
        /// Gets rectangular coordinates of Sun for J2000.0 epoch
        /// </summary>
        protected CrdsRectangular SunRectangular(SkyContext c)
        {
            var eSun = c.Get(SunEcliptical);

            return(eSun.ToRectangular(c.Epsilon));
        }
Ejemplo n.º 27
0
 /// <summary>
 /// Gets apparent topocentric coordinates of planet
 /// </summary>
 public CrdsEquatorial Equatorial(SkyContext c, int p)
 {
     return(c.Get(Equatorial0, p).ToTopocentric(c.GeoLocation, c.SiderealTime, c.Get(Parallax, p)));
 }
Ejemplo n.º 28
0
 private CrdsEquatorial SunEquatorial(SkyContext c)
 {
     return(c.Get(SunEcliptical).ToEquatorial(c.Epsilon));
 }
Ejemplo n.º 29
0
 /// <summary>
 /// Gets elongation angle for the planet
 /// </summary>
 public double Elongation(SkyContext c, int p)
 {
     return(BasicEphem.Elongation(c.Get(SunEcliptical), c.Get(Ecliptical, p)));
 }
Ejemplo n.º 30
0
 private CrdsEquatorial MarsMoon_Equatorial(SkyContext c, int m)
 {
     return(c.Get(MarsMoon_Equatorial0, m).ToTopocentric(c.GeoLocation, c.SiderealTime, c.Get(Planet_Parallax, Planet.MARS)));
 }