예제 #1
0
파일: DeepSkyCalc.cs 프로젝트: t9mike/ADK
        public override void Calculate(SkyContext context)
        {
            // precessional elements
            var p = Precession.ElementsFK5(Date.EPOCH_J2000, context.JulianDay);

            foreach (var ds in DeepSkies)
            {
                ds.Equatorial = context.Get(Equatorial, ds);
                ds.Horizontal = context.Get(Horizontal, ds);

                if (ds.Outline != null)
                {
                    foreach (var op in ds.Outline)
                    {
                        CrdsEquatorial eq0 = new CrdsEquatorial(op.Equatorial0);

                        // Equatorial coordinates for the mean equinox and epoch of the target date
                        var eq = Precession.GetEquatorialCoordinates(eq0, p);

                        // Nutation effect
                        var eq1 = Nutation.NutationEffect(eq, context.NutationElements, context.Epsilon);

                        // Aberration effect
                        var eq2 = Aberration.AberrationEffect(eq, context.AberrationElements, context.Epsilon);

                        // Apparent coordinates of the object
                        eq += eq1 + eq2;

                        // Apparent horizontal coordinates
                        op.Horizontal = eq.ToHorizontal(context.GeoLocation, context.SiderealTime);
                    }
                }
            }
        }
예제 #2
0
        public override void Calculate(SkyContext context)
        {
            var p = Precession.ElementsFK5(Date.EPOCH_J2000, context.JulianDay);

            foreach (var b in ConstBorders)
            {
                foreach (var bp in b)
                {
                    // Equatorial coordinates for the mean equinox and epoch of the target date
                    var eq = Precession.GetEquatorialCoordinates(bp.Equatorial0, p);

                    // Apparent horizontal coordinates
                    bp.Horizontal = eq.ToHorizontal(context.GeoLocation, context.SiderealTime);
                }
            }

            foreach (var c in ConstLabels)
            {
                // Equatorial coordinates for the mean equinox and epoch of the target date
                var eq = Precession.GetEquatorialCoordinates(c.Equatorial0, p);

                // Apparent horizontal coordinates
                c.Horizontal = eq.ToHorizontal(context.GeoLocation, context.SiderealTime);
            }
        }
예제 #3
0
        public void GetEquatorialCoordinates()
        {
            // Equatorial coordinates of Theta Persei
            CrdsEquatorial eq0 = new CrdsEquatorial(new HMS(2, 44, 11.986), new DMS(49, 13, 42.48));

            // proper motion of Theta Persei, units per year
            CrdsEquatorial pm = new CrdsEquatorial(new HMS(0, 0, 0.03425), -new DMS(0, 0, 0.0895));

            // target date (2018 November 13.19)
            double jd = Date.JulianDay(new Date(2028, 11, 13.19));

            Assert.AreEqual(2462088.69, jd);

            // years since initial epoch
            double years = (jd - Date.EPOCH_J2000) / 365.25;

            // Take into account effect of proper motion:
            // now coordinates are for the mean equinox of J2000.0,
            // but for epoch of the target date
            eq0.Alpha += pm.Alpha * years;
            eq0.Delta += pm.Delta * years;

            // precessional elements
            var p = Precession.ElementsFK5(Date.EPOCH_J2000, jd);

            // Equatorial coordinates for the mean equinox and epoch of the target date
            CrdsEquatorial eq = Precession.GetEquatorialCoordinates(eq0, p);

            // Check final results
            Assert.AreEqual(new HMS(2, 46, 11.331), new HMS(eq.Alpha));
            Assert.AreEqual(new DMS(49, 20, 54.54), new DMS(eq.Delta));
        }
예제 #4
0
        /// <summary>
        /// Calculates equatorial geocentric coordinates of Pluto for current epoch
        /// </summary>
        private CrdsEquatorial Pluto_Equatorial0(SkyContext c)
        {
            PrecessionalElements pe     = Precession.ElementsFK5(Date.EPOCH_J2000, c.JulianDay);
            CrdsEquatorial       eq2000 = c.Get(Pluto_EclipticalJ2000).ToEquatorial(epsilonJ2000);

            return(Precession.GetEquatorialCoordinates(eq2000, pe));
        }
예제 #5
0
        /// <summary>
        /// Converts coordinates of telescope from epoch used by hardware to current epoch (used in sky map)
        /// </summary>
        /// <returns>Equatorial coordinates in current epoch</returns>
        private CrdsEquatorial ConvertCoordinatesFromTelescopeEpoch()
        {
            double jd = new Date(DateTime.UtcNow).ToJulianEphemerisDay();

            CrdsEquatorial eq = new CrdsEquatorial(telescope.RightAscension * 15, telescope.Declination);

            switch (telescope.EquatorialSystem)
            {
            default:
            case EquatorialCoordinateType.equOther:
            case EquatorialCoordinateType.equTopocentric:
                break;

            case EquatorialCoordinateType.equB1950:
                eq = Precession.GetEquatorialCoordinates(eq, Precession.ElementsFK5(Date.EPOCH_B1950, jd));
                break;

            case EquatorialCoordinateType.equJ2000:
                eq = Precession.GetEquatorialCoordinates(eq, Precession.ElementsFK5(Date.EPOCH_J2000, jd));
                break;

            case EquatorialCoordinateType.equJ2050:
                eq = Precession.GetEquatorialCoordinates(eq, Precession.ElementsFK5(Date.EPOCH_J2050, jd));
                break;
            }

            return(eq);
        }
예제 #6
0
        /// <summary>
        /// Converts coordinates in current epoch to an epoch used by telescope hardware.
        /// </summary>
        /// <param name="eq">Equatorial coordinates in current epoch (used by sky map)</param>
        /// <returns>Coordinates in epoch used by telescope hardware</returns>
        private CrdsEquatorial ConvertCoordinatesToTelescopeEpoch(CrdsEquatorial eq)
        {
            CrdsEquatorial eqT = new CrdsEquatorial(eq);

            double jd0 = new Date(DateTime.UtcNow).ToJulianEphemerisDay();

            switch (telescope.EquatorialSystem)
            {
            default:
            case EquatorialCoordinateType.equOther:
            case EquatorialCoordinateType.equTopocentric:
                break;

            case EquatorialCoordinateType.equB1950:
                eqT = Precession.GetEquatorialCoordinates(eq, Precession.ElementsFK5(jd0, Date.EPOCH_B1950));
                break;

            case EquatorialCoordinateType.equJ2000:
                eqT = Precession.GetEquatorialCoordinates(eq, Precession.ElementsFK5(jd0, Date.EPOCH_J2000));
                break;

            case EquatorialCoordinateType.equJ2050:
                eqT = Precession.GetEquatorialCoordinates(eq, Precession.ElementsFK5(jd0, Date.EPOCH_J2050));
                break;
            }

            return(eqT);
        }
예제 #7
0
        public override void Render(IMapContext map)
        {
            Graphics g          = map.Graphics;
            bool     isGround   = settings.Get <bool>("Ground");
            bool     isLabels   = settings.Get <bool>("StarsLabels");
            Brush    brushNames = new SolidBrush(map.GetColor("ColorStarsLabels"));

            if (map.MagLimit > 8 && settings.Get <bool>("Stars") && settings.Get <bool>("Tycho2"))
            {
                Brush brushStar = GetColor(map);

                PrecessionalElements pe = Precession.ElementsFK5(map.JulianDay, Date.EPOCH_J2000);

                var eq0 = map.Center.ToEquatorial(map.GeoLocation, map.SiderealTime);

                CrdsEquatorial eq = Precession.GetEquatorialCoordinates(eq0, pe);

                SkyContext context = new SkyContext(map.JulianDay, map.GeoLocation);

                tycho2.LockedStar   = map.LockedObject as Tycho2Star;
                tycho2.SelectedStar = map.SelectedObject as Tycho2Star;

                var stars = tycho2.GetStars(context, eq, map.ViewAngle, m => MagFilter(map, m));

                foreach (var star in stars)
                {
                    if (!isGround || star.Horizontal.Altitude > 0)
                    {
                        PointF p = map.Project(star.Horizontal);
                        if (!map.IsOutOfScreen(p))
                        {
                            float size = map.GetPointSize(star.Magnitude);

                            if (map.Schema == ColorSchema.White)
                            {
                                g.FillEllipse(Brushes.White, p.X - size / 2 - 1, p.Y - size / 2 - 1, size + 2, size + 2);
                            }
                            g.FillEllipse(brushStar, p.X - size / 2, p.Y - size / 2, size, size);

                            if (isLabels && map.ViewAngle < 1 && size > 3)
                            {
                                map.DrawObjectCaption(fontNames, brushNames, star.ToString(), p, size);
                            }
                            map.AddDrawnObject(star);
                        }
                    }
                }
            }
        }
예제 #8
0
        public void FindConstellation()
        {
            // precessional elements for converting from J1950 to B1875 epoch
            var p = Precession.ElementsFK5(Date.EPOCH_J1950, Date.EPOCH_B1875);

            foreach (var test in testData)
            {
                // Equatorial coordinates for B1875 epoch
                CrdsEquatorial eq = Precession.GetEquatorialCoordinates(new CrdsEquatorial(test.RA, test.Dec), p);

                // Constellation name
                string con = Constellations.FindConstellation(eq);

                // Check result
                Assert.AreEqual(test.ConstName, con);
            }
        }
예제 #9
0
        public override void Render(IMapContext map)
        {
            peFrom1950 = Precession.ElementsFK5(Date.EPOCH_B1950, map.JulianDay);
            peTo1950   = Precession.ElementsFK5(map.JulianDay, Date.EPOCH_B1950);

            Color colorGridEquatorial = map.GetColor("ColorEquatorialGrid");
            Color colorGridHorizontal = map.GetColor("ColorHorizontalGrid");
            Color colorLineEcliptic   = map.GetColor("ColorEcliptic");
            Color colorLineGalactic   = map.GetColor("ColorGalacticEquator");
            Color colorLineMeridian   = map.GetColor("ColorMeridian");

            penGridEquatorial.Color = colorGridEquatorial;
            penGridHorizontal.Color = colorGridHorizontal;
            penLineEcliptic.Color   = colorLineEcliptic;
            penLineGalactic.Color   = colorLineGalactic;
            penLineMeridian.Color   = colorLineMeridian;

            if (settings.Get <bool>("GalacticEquator"))
            {
                DrawGrid(map, penLineGalactic, LineGalactic);
            }
            if (settings.Get <bool>("EquatorialGrid"))
            {
                DrawGrid(map, penGridEquatorial, GridEquatorial);
                DrawEquatorialPoles(map);
            }
            if (settings.Get <bool>("HorizontalGrid"))
            {
                DrawGrid(map, penGridHorizontal, GridHorizontal);
                DrawHorizontalPoles(map);
            }
            if (settings.Get <bool>("EclipticLine"))
            {
                DrawGrid(map, penLineEcliptic, LineEcliptic);
                DrawEquinoxLabels(map);
                DrawLunarNodes(map);
            }
            if (settings.Get <bool>("MeridianLine"))
            {
                DrawGrid(map, penLineMeridian, LineMeridian);
            }
        }
예제 #10
0
 /// <summary>
 /// Gets precessional elements to convert equatorial coordinates of stars to current epoch
 /// </summary>
 private PrecessionalElements PrecessionalElements(SkyContext context)
 {
     return(Precession.ElementsFK5(Date.EPOCH_J2000, context.JulianDay));
 }
예제 #11
0
 /// <summary>
 /// Gets precessional elements to convert equatorial coordinates of minor body to current epoch
 /// </summary>
 protected PrecessionalElements GetPrecessionalElements(SkyContext c)
 {
     return(Precession.ElementsFK5(Date.EPOCH_J2000, c.JulianDay));
 }