//return Ecliptic Coordinates with necessary orbital corrections //T - Time in Julian centuries since J2000 Vector <double> GetMoonCoor(double T) { double Arcs = 3600.0 * 180.0 / Math.PI; double L_0, l, ls, F, D, dL, S, h, N; // Mean elements of lunar orbit L_0 = Astro.Frac(0.606433 + 1336.855225 * T); // mean longitude [rev] l = 2 * Math.PI * Astro.Frac(0.374897 + 1325.552410 * T); // Moon's mean anomaly ls = 2 * Math.PI * Astro.Frac(0.993133 + 99.997361 * T); // Sun's mean anomaly D = 2 * Math.PI * Astro.Frac(0.827361 + 1236.853086 * T); // Diff. long. Moon-Sun F = 2 * Math.PI * Astro.Frac(0.259086 + 1342.227825 * T); // Dist. from ascending node // Perturbations in longitude and latitude dL = +22640 * Math.Sin(l) - 4586 * Math.Sin(l - 2 * D) + 2370 * Math.Sin(2 * D) + 769 * Math.Sin(2 * l) - 668 * Math.Sin(ls) - 412 * Math.Sin(2 * F) - 212 * Math.Sin(2 * l - 2 * D) - 206 * Math.Sin(l + ls - 2 * D) + 192 * Math.Sin(l + 2 * D) - 165 * Math.Sin(ls - 2 * D) - 125 * Math.Sin(D) - 110 * Math.Sin(l + ls) + 148 * Math.Sin(l - ls) - 55 * Math.Sin(2 * F - 2 * D); S = F + (dL + 412 * Math.Sin(2 * F) + 541 * Math.Sin(ls)) / Arcs; h = F - 2 * D; N = -526 * Math.Sin(h) + 44 * Math.Sin(l + h) - 31 * Math.Sin(-l + h) - 23 * Math.Sin(ls + h) + 11 * Math.Sin(-ls + h) - 25 * Math.Sin(-2 * l + F) + 21 * Math.Sin(-l + F); // Ecliptic longitude and latitude Vector <double> v = new Vector <double>(); v.X = 2 * Math.PI * Astro.Frac(L_0 + dL / 1296.0e3); // [rad] v.Y = (18520.0 * Math.Sin(S) + N) / Arcs; // [rad] return(v); }
//return Ecliptic Coordinates with necessary orbital corrections //T - Time in Julian centuries since J2000 Vector <double> GetSunCoor(double T) { // Mean anomaly and ecliptic longitude double M = 2 * Math.PI * Astro.Frac(0.993133 + 99.997361 * T); double L = 2 * Math.PI * Astro.Frac(0.7859453 + M / (Math.PI * 2) + (6893.0 * Math.Sin(M) + 72.0 * Math.Sin(2.0 * M) + 6191.2 * T) / 1296.0e3); return(new Vector <double> { X = L, Y = 0 }); }
int GetMoonDay(DateTime date) { double eq, eq1, eq2; int monthH = date.Month; int yearH = date.Year; if (date.Month <= 2) { monthH += 12; yearH--; } eq = Math.Floor(yearH / 100.0); eq1 = Math.Floor(eq / 3) + Math.Floor(eq / 4) + 6 - eq; eq2 = (Math.Round(Astro.Frac(yearH / eq) * 209) + monthH + eq1 + date.Day) / 30; return((int)(Astro.Frac(eq2) * 30 + 1)); }