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); } }
/// <summary> /// Gets equatorial coordinates of a star for current epoch /// </summary> public CrdsEquatorial Equatorial(SkyContext c, ushort hrNumber) { Star star = Stars.ElementAt(hrNumber - 1); PrecessionalElements p = c.Get(GetPrecessionalElements); double years = c.Get(YearsSince2000); // Initial coodinates for J2000 epoch CrdsEquatorial eq0 = new CrdsEquatorial(star.Equatorial0); // 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 += star.PmAlpha * years / 3600.0; eq0.Delta += star.PmDelta * years / 3600.0; // Equatorial coordinates for the mean equinox and epoch of the target date CrdsEquatorial eq = Precession.GetEquatorialCoordinates(eq0, p); // Nutation effect var eq1 = Nutation.NutationEffect(eq, c.NutationElements, c.Epsilon); // Aberration effect var eq2 = Aberration.AberrationEffect(eq, c.AberrationElements, c.Epsilon); // Apparent coordinates of the star eq += eq1 + eq2; return(eq); }
/// <summary> /// Gets equatorial coordinates of comet tail end /// </summary> private CrdsEquatorial TailEquatorial(SkyContext ctx, Comet c) { var rBody = ctx.Get(RectangularH, c); var rSun = ctx.Get(SunRectangular); // distance from Sun double r = Math.Sqrt(rBody.X * rBody.X + rBody.Y * rBody.Y + rBody.Z * rBody.Z); double k = (r + ctx.Get(Appearance, c).Tail) / r; double x = rSun.X + k * rBody.X; double y = rSun.Y + k * rBody.Y; double z = rSun.Z + k * rBody.Z; // distance from Earth of tail end double Delta = Math.Sqrt(x * x + y * y + z * z); double alpha = Angle.ToDegrees(Math.Atan2(y, x)); double delta = Angle.ToDegrees(Math.Asin(z / Delta)); // geocentric equatoral for J2000.0 var eq0 = new CrdsEquatorial(alpha, delta); // Precessinal elements to convert between epochs var pe = ctx.Get(GetPrecessionalElements); // Equatorial coordinates for the mean equinox and epoch of the target date // No nutation an aberration corrections here, because we do not need high precision return(Precession.GetEquatorialCoordinates(eq0, pe)); }
/// <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)); }
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); } } } }
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)); }
/// <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); }
/// <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); }
public override void Initialize() { // Ecliptic LineEcliptic.FromHorizontal = (h, ctx) => { var eq = h.ToEquatorial(ctx.GeoLocation, ctx.SiderealTime); var ec = eq.ToEcliptical(ctx.Epsilon); return(new GridPoint(ec.Lambda, ec.Beta)); }; LineEcliptic.ToHorizontal = (c, ctx) => { var ec = new CrdsEcliptical(c.Longitude, c.Latitude); var eq = ec.ToEquatorial(ctx.Epsilon); return(eq.ToHorizontal(ctx.GeoLocation, ctx.SiderealTime)); }; // Galactic equator LineGalactic.FromHorizontal = (h, ctx) => { var eq = h.ToEquatorial(ctx.GeoLocation, ctx.SiderealTime); var eq1950 = Precession.GetEquatorialCoordinates(eq, peTo1950); var gal = eq1950.ToGalactical(); return(new GridPoint(gal.l, gal.b)); }; LineGalactic.ToHorizontal = (c, ctx) => { var gal = new CrdsGalactical(c.Longitude, c.Latitude); var eq1950 = gal.ToEquatorial(); var eq = Precession.GetEquatorialCoordinates(eq1950, peFrom1950); return(eq.ToHorizontal(ctx.GeoLocation, ctx.SiderealTime)); }; // Meridian line LineMeridian.FromHorizontal = (h, ctx) => new GridPoint(0, h.Azimuth - 180); LineMeridian.ToHorizontal = (c, context) => new CrdsHorizontal(0, c.Longitude - 180); // Horizontal grid GridHorizontal.FromHorizontal = (h, ctx) => new GridPoint(h.Azimuth, h.Altitude); GridHorizontal.ToHorizontal = (c, context) => new CrdsHorizontal(c.Longitude, c.Latitude); // Equatorial grid GridEquatorial.FromHorizontal = (h, ctx) => { var eq = h.ToEquatorial(ctx.GeoLocation, ctx.SiderealTime); return(new GridPoint(eq.Alpha, eq.Delta)); }; GridEquatorial.ToHorizontal = (c, ctx) => { var eq = new CrdsEquatorial(c.Longitude, c.Latitude); return(eq.ToHorizontal(ctx.GeoLocation, ctx.SiderealTime)); }; }
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); } } } } }
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); } }
/// <summary> /// Gets equatorial coordinates of deep sky object for current epoch /// </summary> private CrdsEquatorial Equatorial(SkyContext c, DeepSky ds) { PrecessionalElements p = c.Get(GetPrecessionalElements); // Equatorial coordinates for the mean equinox and epoch of the target date CrdsEquatorial eq = Precession.GetEquatorialCoordinates(ds.Equatorial0, p); // Nutation effect var eq1 = Nutation.NutationEffect(eq, c.NutationElements, c.Epsilon); // Aberration effect var eq2 = Aberration.AberrationEffect(eq, c.AberrationElements, c.Epsilon); // Apparent coordinates of the object eq += eq1 + eq2; return(eq); }
private CrdsEquatorial StarEquatorial(SkyContext c, ConjunctedStar star) { PrecessionalElements p = c.Get(PrecessionalElements); // Number of years, with fractions, since J2000 epoch double years = (c.JulianDay - Date.EPOCH_J2000) / 365.25; // Initial coodinates for J2000 epoch CrdsEquatorial eq0 = new CrdsEquatorial(star.Equatorial0); // 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 += star.PmAlpha * years / 3600.0; eq0.Delta += star.PmDelta * years / 3600.0; // Equatorial coordinates for the mean equinox and epoch of the target date // without aberration and nutation corrections return(Precession.GetEquatorialCoordinates(eq0, p)); }
/// <summary> /// Gets equatorial geocentrical coordinates for current epoch /// </summary> protected CrdsEquatorial EquatorialG(SkyContext c, T body) { // Precessinal elements to convert between epochs var pe = c.Get(GetPrecessionalElements); // Equatorial geocentrical coordinates for J2000 epoch var eq0 = c.Get(EquatorialJ2000, body); // Equatorial coordinates for the mean equinox and epoch of the target date CrdsEquatorial eq = Precession.GetEquatorialCoordinates(eq0, pe); // Nutation effect var eq1 = Nutation.NutationEffect(eq, c.NutationElements, c.Epsilon); // Aberration effect var eq2 = Aberration.AberrationEffect(eq, c.AberrationElements, c.Epsilon); // Apparent coordinates of the object eq += eq1 + eq2; return(eq); }
/// <summary> /// Gets equatorial coordinates of a star for current epoch /// </summary> public CrdsEquatorial Equatorial(SkyContext c, Nova n) { PrecessionalElements p = c.Get(GetPrecessionalElements); double years = c.Get(YearsSince2000); // Initial coodinates for J2000 epoch CrdsEquatorial eq0 = new CrdsEquatorial(n.Equatorial0); // Equatorial coordinates for the mean equinox and epoch of the target date CrdsEquatorial eq = Precession.GetEquatorialCoordinates(eq0, p); // Nutation effect var eq1 = Nutation.NutationEffect(eq, c.NutationElements, c.Epsilon); // Aberration effect var eq2 = Aberration.AberrationEffect(eq, c.AberrationElements, c.Epsilon); // Apparent coordinates of the star eq += eq1 + eq2; return(eq); }
/// <summary> /// Gets equatorial coordinates of a star for current epoch /// </summary> private CrdsEquatorial Equatorial(SkyContext context, Tycho2Star star) { PrecessionalElements p = context.Get(PrecessionalElements); double years = context.Get(YearsSince2000); // Take into account effect of proper motion: // now coordinates are for the mean equinox of J2000.0, // but for epoch of the target date var eq0 = star.Equatorial0 + new CrdsEquatorial(star.PmRA * years / 3600000, star.PmDec * years / 3600000); // Equatorial coordinates for the mean equinox and epoch of the target date CrdsEquatorial eq = Precession.GetEquatorialCoordinates(eq0, p); // Nutation effect var eqN = Nutation.NutationEffect(eq, context.NutationElements, context.Epsilon); // Aberration effect var eqA = Aberration.AberrationEffect(eq, context.AberrationElements, context.Epsilon); // Apparent coordinates of the star eq += eqN + eqA; return(eq); }