/// <summary> /// Converts galactical coodinates to equatorial, for equinox B1950.0. /// </summary> /// <param name="gal">Galactical coodinates.</param> /// <returns>Equatorial coodinates, for equinox B1950.0.</returns> public static CrdsEquatorial ToEquatorial(this CrdsGalactical gal) { CrdsEquatorial eq = new CrdsEquatorial(); double l_l0 = Angle.ToRadians(gal.l - 123.0); double delta0 = Angle.ToRadians(27.4); double b = Angle.ToRadians(gal.b); double Y = Math.Sin(l_l0); double X = Math.Cos(l_l0) * Math.Sin(delta0) - Math.Tan(b) * Math.Cos(delta0); double sinDelta = Math.Sin(b) * Math.Sin(delta0) + Math.Cos(b) * Math.Cos(delta0) * Math.Cos(l_l0); eq.Alpha = Angle.To360(Angle.ToDegrees(Math.Atan2(Y, X)) + 12.25); eq.Delta = Angle.ToDegrees(Math.Asin(sinDelta)); return(eq); }
/// <summary> /// Converts equatorial coordinates (for equinox B1950.0) to galactical coordinates. /// </summary> /// <param name="eq">Equatorial coordinates for equinox B1950.0</param> /// <returns>Galactical coordinates.</returns> public static CrdsGalactical ToGalactical(this CrdsEquatorial eq) { CrdsGalactical gal = new CrdsGalactical(); double alpha0_alpha = Angle.ToRadians(192.25 - eq.Alpha); double delta = Angle.ToRadians(eq.Delta); double delta0 = Angle.ToRadians(27.4); double Y = Math.Sin(alpha0_alpha); double X = Math.Cos(alpha0_alpha) * Math.Sin(delta0) - Math.Tan(delta) * Math.Cos(delta0); double sinb = Math.Sin(delta) * Math.Sin(delta0) + Math.Cos(delta) * Math.Cos(delta0) * Math.Cos(alpha0_alpha); gal.l = Angle.To360(303 - Angle.ToDegrees(Math.Atan2(Y, X))); gal.b = Angle.ToDegrees(Math.Asin(sinb)); return(gal); }