public EquatorialCoords HelToEquatorial(EclipticalCoords Earth, NutObl nutobl) { EclipticalCoords geo = Utils.HelToGeo(Earth, this); geo.r += nutobl.deltapsi; return(geo.EclipticalToEquatorial(nutobl)); }
public EclipticalCoords ToEcliptical(NutObl nutobl) { EclipticalCoords coords = new EclipticalCoords(); coords.l = Math.Atan2((Math.Sin(this.ra) * Math.Cos(nutobl.epsilon)) + (Math.Tan(this.dec) * Math.Sin(nutobl.epsilon)), Math.Cos(this.ra)); coords.b = Math.Asin((Math.Sin(this.dec) * Math.Cos(nutobl.epsilon)) - (Math.Cos(this.dec) * Math.Sin(nutobl.epsilon) * Math.Sin(this.ra))); return(coords); }
public static EclipticalCoords EquatorialToEcliptical(EquatorialCoords celest, NutObl nutobl) { EclipticalCoords coords = new EclipticalCoords(); coords.l = Math.Atan2((Math.Sin(celest.ra) * Math.Cos(nutobl.epsilon)) + (Math.Tan(celest.dec) * Math.Sin(nutobl.epsilon)), Math.Cos(celest.ra)); coords.b = Math.Asin((Math.Sin(celest.dec) * Math.Cos(nutobl.epsilon)) - (Math.Cos(celest.dec) * Math.Sin(nutobl.epsilon) * Math.Sin(celest.ra))); return(coords); }
//Ecliptical to Celestial coordinate conversion. Epsilon (obliquity of the ecliptic) in rads public static EquatorialCoords EclipticalToCelestial(EclipticalCoords eclipt, NutObl nutobl) { EquatorialCoords coords = new EquatorialCoords(); coords.ra = Math.Atan2((Math.Sin(eclipt.l) * Math.Cos(nutobl.epsilon)) - (Math.Tan(eclipt.b) * Math.Sin(nutobl.epsilon)), Math.Cos(eclipt.l)); coords.dec = Math.Asin((Math.Sin(eclipt.b) * Math.Cos(nutobl.epsilon)) + (Math.Cos(eclipt.b) * Math.Sin(nutobl.epsilon) * Math.Sin(eclipt.l))); return(coords); }
//Heliocentric ecliptical to Geocentric ecliptical public static EclipticalCoords HelToGeo(EclipticalCoords Earth, EclipticalCoords Planet) { EclipticalCoords geo = new EclipticalCoords(); double x = Planet.r * Math.Cos(Planet.b) * Math.Cos(Planet.l) - Earth.r * Math.Cos(Earth.b) * Math.Cos(Earth.l); double y = Planet.r * Math.Cos(Planet.b) * Math.Sin(Planet.l) - Earth.r * Math.Cos(Earth.b) * Math.Sin(Earth.l); double z = Planet.r * Math.Sin(Planet.b) - Earth.r * Math.Sin(Earth.b); geo.l = Math.Atan2(y, x); geo.b = Math.Atan2(z, Math.Sqrt(x * x + y * y)); geo.r = Math.Sqrt(x * x + y * y + z * z); return(geo); }
//Calculate the corrections in RA/Dec due to aberation public static EquatorialCoords Aberation(EquatorialCoords celest, EclipticalCoords sun, NutObl nutobl, double T) { EquatorialCoords delta = new EquatorialCoords(); double k = deg2rad(20.49552 / 3600); double ee = deg2rad(0.016708634 - 4.2037E-05 * T - 1.267E-07 * T * T); double pir = deg2rad(102.93735 + 1.71946 * T + 0.00046 * T * T); delta.ra = (-k / Math.Cos(celest.ra)) * (Math.Cos(celest.ra) * Math.Cos(sun.l) * Math.Cos(nutobl.epsilon) + Math.Sin(celest.ra) * Math.Sin(sun.l)); delta.ra += (ee * k / Math.Cos(celest.dec)) * (Math.Cos(celest.ra) * Math.Cos(pir) * Math.Cos(nutobl.epsilon) + Math.Sin(celest.ra) * Math.Sin(pir)); delta.dec = ee * k * (Math.Cos(pir) * Math.Cos(nutobl.epsilon) * (Math.Tan(nutobl.epsilon) * Math.Cos(celest.dec) - Math.Sin(celest.ra) * Math.Sin(celest.dec)) + Math.Cos(celest.ra) * Math.Sin(celest.dec) * Math.Sin(pir)); delta.dec -= k * (Math.Cos(sun.l) * Math.Cos(nutobl.epsilon) * (Math.Tan(nutobl.epsilon) * Math.Cos(celest.dec) - Math.Sin(celest.ra) * Math.Sin(celest.dec)) + Math.Cos(celest.ra) * Math.Sin(celest.dec) * Math.Sin(sun.l)); return(delta); }
public EclipticalCoords HelToGeo(EclipticalCoords Earth) { EclipticalCoords geo = new EclipticalCoords(); double x = this.r * Math.Cos(this.b) * Math.Cos(this.l) - Earth.r * Math.Cos(Earth.b) * Math.Cos(Earth.l); double y = this.r * Math.Cos(this.b) * Math.Sin(this.l) - Earth.r * Math.Cos(Earth.b) * Math.Sin(Earth.l); double z = this.r * Math.Sin(this.b) - Earth.r * Math.Sin(Earth.b); geo.l = Math.Atan2(y, x); geo.b = Math.Atan2(z, Math.Sqrt(x * x + y * y)); geo.r = Math.Sqrt(x * x + y * y + z * z); l = geo.l; b = geo.b; r = geo.r; return(geo); }
//Calculate the corrections in RA/Dec due to aberation public EquatorialCoords Aberation(EclipticalCoords sun, NutObl nutobl, double T) { EquatorialCoords delta = new EquatorialCoords(); double k = (20.49552 / 3600) * Math.PI / 180.0; double ee = (0.016708634 - 4.2037E-05 * T - 1.267E-07 * T * T) * Math.PI / 180.0; double pir = (102.93735 + 1.71946 * T + 0.00046 * T * T) * Math.PI / 180.0; delta.ra = (-k / Math.Cos(this.ra)) * (Math.Cos(this.ra) * Math.Cos(sun.l) * Math.Cos(nutobl.epsilon) + Math.Sin(this.ra) * Math.Sin(sun.l)); delta.ra += (ee * k / Math.Cos(this.dec)) * (Math.Cos(this.ra) * Math.Cos(pir) * Math.Cos(nutobl.epsilon) + Math.Sin(this.ra) * Math.Sin(pir)); delta.dec = ee * k * (Math.Cos(pir) * Math.Cos(nutobl.epsilon) * (Math.Tan(nutobl.epsilon) * Math.Cos(this.dec) - Math.Sin(this.ra) * Math.Sin(this.dec)) + Math.Cos(this.ra) * Math.Sin(this.dec) * Math.Sin(pir)); delta.dec -= k * (Math.Cos(sun.l) * Math.Cos(nutobl.epsilon) * (Math.Tan(nutobl.epsilon) * Math.Cos(this.dec) - Math.Sin(this.ra) * Math.Sin(this.dec)) + Math.Cos(this.ra) * Math.Sin(this.dec) * Math.Sin(sun.l)); ra = ra + delta.ra; dec = dec + delta.dec; return(delta); }