public void Test_swe_set_topo() { using (var swe = new SwissEph()) { double tjd = swe.swe_julday(1974, 8, 16, 0.5, SwissEph.SE_GREG_CAL); double[] geopos = new double[] { 47.853333, 5.333889, 468 }; double[] xin1 = new double[6], xin2 = new double[6], xin3 = new double[6] ; String serr = null; swe.swe_calc(tjd, SwissEph.SE_SUN, 33024, xin1, ref serr); Assert.Equal(0, xin1[0], 12); Assert.Equal(0, xin1[1], 12); Assert.Equal(0, xin1[2], 12); swe.swe_set_topo(geopos[0], geopos[1], geopos[2]); swe.swe_calc(tjd, SwissEph.SE_SUN, 33024, xin2, ref serr); Assert.Equal(142.781802332173, xin2[0], 12); Assert.Equal(6.0673071E-05, xin2[1], 12); Assert.Equal(1.012695777714, xin2[2], 12); swe.swe_calc(tjd, SwissEph.SE_SUN, 33024, xin3, ref serr); Assert.Equal(142.781802332173, xin3[0], 12); Assert.Equal(6.0673071E-05, xin3[1], 12); Assert.Equal(1.012695777714, xin3[2], 12); } }
public void Test_swe_set_topo() { using (var swe = new SwissEph()) { double tjd = swe.swe_julday(1974, 8, 16, 0.5, SwissEph.SE_GREG_CAL); double[] geopos = new double[] { 47.853333, 5.333889, 468 }; double[] xin1 = new double[6], xin2 = new double[6], xin3 = new double[6] ; String serr = null; swe.swe_calc(tjd, SwissEph.SE_SUN, 33024, xin1, ref serr); Assert.AreEqual(0, xin1[0], 0.0000000000001); Assert.AreEqual(0, xin1[1], 0.0000000000001); Assert.AreEqual(0, xin1[2], 0.0000000000001); swe.swe_set_topo(geopos[0], geopos[1], geopos[2]); swe.swe_calc(tjd, SwissEph.SE_SUN, 33024, xin2, ref serr); Assert.AreEqual(142.78180233188, xin2[0], 0.000000000001); Assert.AreEqual(6.06728560368863E-05, xin2[1], 0.000000000001); Assert.AreEqual(1.01269577772231, xin2[2], 0.000000000001); swe.swe_calc(tjd, SwissEph.SE_SUN, 33024, xin3, ref serr); Assert.AreEqual(142.78180233188, xin3[0], 0.000000000001); Assert.AreEqual(6.06728560368863E-05, xin3[1], 0.0000000000001); Assert.AreEqual(1.01269577772231, xin3[2], 0.0000000000001); } }
public void Test_swe_set_topo() { using (var swe = new SwissEph()) { double tjd = swe.swe_julday(1974, 8, 16, 0.5, SwissEph.SE_GREG_CAL); double[] geopos = new double[] { 47.853333, 5.333889, 468 }; double[] xin1 = new double[6], xin2 = new double[6], xin3 = new double[6] ; String serr = null; swe.swe_calc(tjd, SwissEph.SE_SUN, 33024, xin1, ref serr); Assert.AreEqual(0, xin1[0], 0.0000000000001); Assert.AreEqual(0, xin1[1], 0.0000000000001); Assert.AreEqual(0, xin1[2], 0.0000000000001); swe.swe_set_topo(geopos[0], geopos[1], geopos[2]); swe.swe_calc(tjd, SwissEph.SE_SUN, 33024, xin2, ref serr); Assert.AreEqual(142.781800447368, xin2[0], 0.000000000001); Assert.AreEqual(5.71307753469628E-05, xin2[1], 0.000000000001); Assert.AreEqual(1.0126957777219, xin2[2], 0.000000000001); swe.swe_calc(tjd, SwissEph.SE_SUN, 33024, xin3, ref serr); Assert.AreEqual(142.781800447368, xin3[0], 0.000000000001); Assert.AreEqual(5.71307753469628E-05, xin3[1], 0.0000000000001); Assert.AreEqual(1.0126957777219, xin3[2], 0.0000000000001); } }
public void Test_swe_azalt() { using (var swe = new SwissEph()) { double tjd = swe.swe_julday(1974, 8, 16, 0.5, SwissEph.SE_GREG_CAL); double[] geopos = new double[] { 47.853333, 5.333889, 468 }; double[] xin = new double[6], xaz = new double[6]; String serr = null; swe.swe_calc(tjd, SwissEph.SE_SUN, SwissEph.SEFLG_MOSEPH, xin, ref serr); swe.swe_azalt(tjd, SwissEph.SE_ECL2HOR, geopos, 0, 0, xin, xaz); Assert.AreEqual(249.64242931513104, xaz[0], 0.0000000000001); Assert.AreEqual(-32.8340765334715, xaz[1], 0.0000000000001); Assert.AreEqual(-32.8340765334715, xaz[2], 0.0000000000001); } }
public void Test_swe_azalt() { using (var swe = new SwissEph()) { double tjd = swe.swe_julday(1974, 8, 16, 0.5, SwissEph.SE_GREG_CAL); double[] geopos = new double[] { 47.853333, 5.333889, 468 }; double[] xin = new double[6], xaz = new double[6]; String serr = null; swe.swe_calc(tjd, SwissEph.SE_SUN, SwissEph.SEFLG_MOSEPH, xin, ref serr); swe.swe_azalt(tjd, SwissEph.SE_ECL2HOR, geopos, 0, 0, xin, xaz); Assert.AreEqual(249.642425229358, xaz[0], 0.000000001); Assert.AreEqual(-32.8340786097275, xaz[1], 0.0000000001); Assert.AreEqual(-32.8340786097275, xaz[2], 0.0000000001); } }
public void Test_swe_calc() { using (var swe = new SwissEph()) { double tjd = swe.swe_julday(1974, 8, 16, 0.5, SwissEph.SE_GREG_CAL); double[] geopos = new double[] { 47.853333, 5.333889, 468 }; double[] xx = new double[6]; String serr = null; swe.swe_calc(tjd, SwissEph.SE_SUN, SwissEph.SEFLG_MOSEPH, xx, ref serr); Assert.AreEqual(142.779826288975, xx[0], 0.000000000001); Assert.AreEqual(-1.57665386141208E-05, xx[1], 0.0000000000001); Assert.AreEqual(1.01267253822512, xx[2], 0.0000000000001); Assert.AreEqual(0, xx[3], 0.0000000000001); Assert.AreEqual(0, xx[4], 0.0000000000001); Assert.AreEqual(0, xx[5], 0.0000000000001); } }
private Aspect GetAspect(double julianDay, int current, double latitude, double longitude) { double[] calculations = new double[6]; double[] cusps = new double[13]; double[] ascmc = new double[10]; string error = string.Empty; int result = _engine.swe_calc(julianDay, current, SwissEph.SEFLG_SPEED, calculations, ref error); string planetName = _engine.swe_get_planet_name(current); return(new Aspect() { Planet = new Planet(current), Sign = new Sign(calculations[0]) }); }
public int swisseph(StringBuilder buf) { string serr = String.Empty, serr_save = String.Empty, serr_warn = String.Empty; string s, s1, s2; string star = String.Empty; // char *sp, *sp2; string se_pname; string spnam, spnam2 = ""; string fmt = "PZBRS"; string plsel = String.Empty; char psp; string gap = " "; double jut = 0.0, y_frac; int i, j; double hpos = 0; int jday, jmon, jyear, jhour, jmin, jsec; int ipl, ipldiff = SwissEph.SE_SUN; double[] x = new double[6], xequ = new double[6], xcart = new double[6], xcartq = new double[6]; double[] cusp = new double[12 + 1]; /* cusp[0] + 12 houses */ double[] ascmc = new double[10]; /* asc, mc, vertex ...*/ double ar, sinp; double a, sidt, armc, lon, lat; double eps_true, eps_mean, nutl, nuto; //string ephepath; string fname = String.Empty; //string splan = null, sast = null; int nast, iast; int[] astno = new int[100]; int iflag = 0, iflag2; /* external flag: helio, geo... */ int iflgret; var whicheph = SwissEph.SEFLG_SWIEPH; bool universal_time = false; bool calc_house_pos = false; int gregflag; bool diff_mode = false; int round_flag = 0; double tjd_ut = 2415020.5; double tjd_et, t2; double delt; string bc; string jul; char hsys = pd.hsysname[0]; // *serr = *serr_save = *serr_warn = '\0'; //ephepath = ".;sweph"; if (String.Compare(pd.ephe, ephe[1]) == 0) { whicheph = SwissEph.SEFLG_JPLEPH; fname = SwissEph.SE_FNAME_DE406; } else if (String.Compare(pd.ephe, ephe[0]) == 0) { whicheph = SwissEph.SEFLG_SWIEPH; } else { whicheph = SwissEph.SEFLG_MOSEPH; } if (String.Compare(pd.etut, "UT") == 0) { universal_time = true; } if (String.Compare(pd.plansel, plansel[0]) == 0) { plsel = PLSEL_D; } else if (String.Compare(pd.plansel, plansel[1]) == 0) { plsel = PLSEL_P; } else if (String.Compare(pd.plansel, plansel[2]) == 0) { plsel = PLSEL_A; } if (String.Compare(pd.ctr, ctr[0]) == 0) { calc_house_pos = true; } else if (String.Compare(pd.ctr, ctr[1]) == 0) { iflag |= SwissEph.SEFLG_TOPOCTR; calc_house_pos = true; } else if (String.Compare(pd.ctr, ctr[2]) == 0) { iflag |= SwissEph.SEFLG_HELCTR; } else if (String.Compare(pd.ctr, ctr[3]) == 0) { iflag |= SwissEph.SEFLG_BARYCTR; } else if (String.Compare(pd.ctr, ctr[4]) == 0) { iflag |= SwissEph.SEFLG_SIDEREAL; sweph.swe_set_sid_mode(SwissEph.SE_SIDM_FAGAN_BRADLEY, 0, 0); } else if (String.Compare(pd.ctr, ctr[5]) == 0) { iflag |= SwissEph.SEFLG_SIDEREAL; sweph.swe_set_sid_mode(SwissEph.SE_SIDM_LAHIRI, 0, 0); //#if 0 // } else { // iflag &= ~(SEFLG_HELCTR | SEFLG_BARYCTR | SEFLG_TOPOCTR); //#endif } lon = pd.lon_deg + pd.lon_min / 60.0 + pd.lon_sec / 3600.0; if (pd.lon_e_w.StartsWith("W")) { lon = -lon; } lat = pd.lat_deg + pd.lat_min / 60.0 + pd.lat_sec / 3600.0; if (pd.lat_n_s.StartsWith("S")) { lat = -lat; } do_print(buf, C.sprintf("Planet Positions from %s \n\n", pd.ephe)); if ((whicheph & SwissEph.SEFLG_JPLEPH) != 0) { sweph.swe_set_jpl_file(fname); } iflag = (iflag & ~SwissEph.SEFLG_EPHMASK) | whicheph; iflag |= SwissEph.SEFLG_SPEED; //#if 0 // if (pd.helio) iflag |= SEFLG_HELCTR; //#endif if (pd.year * 10000 + pd.mon * 100 + pd.mday < 15821015) { gregflag = SwissEph.SE_JUL_CAL; } else { gregflag = SwissEph.SE_GREG_CAL; } jday = (int)pd.mday; jmon = (int)pd.mon; jyear = pd.year; jhour = (int)pd.hour; jmin = (int)pd.min; jsec = (int)pd.sec; jut = jhour + (jmin / 60.0) + (jsec / 3600.0); tjd_ut = sweph.swe_julday(jyear, jmon, jday, jut, gregflag); sweph.swe_revjul(tjd_ut, gregflag, ref jyear, ref jmon, ref jday, ref jut); jut += 0.5 / 3600; jhour = (int)jut; jmin = (int)((jut * 60.0) % 60.0); jsec = (int)((jut * 3600.0) % 60.0); bc = String.Empty; if (pd.year <= 0) { bc = C.sprintf("(%d B.C.)", 1 - jyear); } if (jyear * 10000L + jmon * 100L + jday <= 15821004) { jul = "jul."; } else { jul = ""; } do_print(buf, C.sprintf("%d.%d.%d %s %s %#02d:%#02d:%#02d %s\n", jday, jmon, jyear, bc, jul, jhour, jmin, jsec, pd.etut)); //custom_date custom_date = String.Concat(jyear, "-", jmon, "-", jday); jut = jhour + jmin / 60.0 + jsec / 3600.0; if (universal_time) { delt = sweph.swe_deltat(tjd_ut); do_print(buf, C.sprintf(" delta t: %f sec", delt * 86400.0)); tjd_et = tjd_ut + delt; } else { tjd_et = tjd_ut; } do_print(buf, C.sprintf(" jd (ET) = %f\n", tjd_et)); iflgret = sweph.swe_calc(tjd_et, SwissEph.SE_ECL_NUT, iflag, x, ref serr); eps_true = x[0]; eps_mean = x[1]; s1 = dms(eps_true, round_flag); s2 = dms(eps_mean, round_flag); do_print(buf, C.sprintf("\n%-15s %s%s%s (true, mean)", "Ecl. obl.", s1, gap, s2)); //custom_eclobl custom_eclobl = String.Concat(s1, "-", s2); nutl = x[2]; nuto = x[3]; s1 = dms(nutl, round_flag); s2 = dms(nuto, round_flag); do_print(buf, C.sprintf("\n%-15s %s%s%s (dpsi, deps)", "Nutation", s1, gap, s2)); //custom_eclnutation custom_nutation = String.Concat(s1, "-", s2); do_print(buf, "\n\n"); do_print(buf, " ecl. long. ecl. lat. "); do_print(buf, " dist. speed"); if (calc_house_pos) { do_print(buf, " house"); } do_print(buf, "\n"); if ((iflag & SwissEph.SEFLG_TOPOCTR) != 0) { sweph.swe_set_topo(lon, lat, pd.alt); } sidt = sweph.swe_sidtime(tjd_ut) + lon / 15; if (sidt >= 24) { sidt -= 24; } if (sidt < 0) { sidt += 24; } armc = sidt * 15; /* additional asteroids */ //splan = plsel; if (String.Compare(plsel, PLSEL_P) == 0) { var cpos = pd.sast.Split(",;. \t".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); j = cpos.Length; for (i = 0, nast = 0; i < j; i++) { if ((astno[nast] = int.Parse(cpos[i])) > 0) { nast++; plsel += "+"; } } } int pspi; for (pspi = 0, iast = 0; pspi < plsel.Length; pspi++) { psp = plsel[pspi]; if (psp == '+') { ipl = SwissEph.SE_AST_OFFSET + (int)astno[iast]; iast++; } else { ipl = letter_to_ipl(psp); } if ((iflag & SwissEph.SEFLG_HELCTR) != 0) { if (ipl == SwissEph.SE_SUN || ipl == SwissEph.SE_MEAN_NODE || ipl == SwissEph.SE_TRUE_NODE || ipl == SwissEph.SE_MEAN_APOG || ipl == SwissEph.SE_OSCU_APOG) { continue; } } else if ((iflag & SwissEph.SEFLG_BARYCTR) != 0) { if (ipl == SwissEph.SE_MEAN_NODE || ipl == SwissEph.SE_TRUE_NODE || ipl == SwissEph.SE_MEAN_APOG || ipl == SwissEph.SE_OSCU_APOG) { continue; } } else /* geocentric */ if (ipl == SwissEph.SE_EARTH) { continue; } /* ecliptic position */ if (ipl == SwissEph.SE_FIXSTAR) { iflgret = sweph.swe_fixstar(star, tjd_et, iflag, x, ref serr); se_pname = star; } else { iflgret = sweph.swe_calc(tjd_et, ipl, iflag, x, ref serr); se_pname = sweph.swe_get_planet_name(ipl); if (ipl > SwissEph.SE_AST_OFFSET) { s = C.sprintf("#%d", (int)astno[iast - 1]); se_pname += new String(' ', 11 - s.Length) + s; } } if (iflgret >= 0) { if (calc_house_pos) { hpos = sweph.swe_house_pos(armc, lat, eps_true, hsys, x, ref serr); if (hpos == 0) { iflgret = SwissEph.ERR; } } } if (iflgret < 0) { if (!String.IsNullOrEmpty(serr) && String.Compare(serr, serr_save) != 0) { serr_save = serr; do_print(buf, "error: "); do_print(buf, serr); do_print(buf, "\n"); } } else if (!String.IsNullOrEmpty(serr) && String.IsNullOrEmpty(serr_warn)) { serr_warn = serr; } /* equator position */ if (fmt.IndexOfAny("aADdQ".ToCharArray()) >= 0) { iflag2 = iflag | SwissEph.SEFLG_EQUATORIAL; if (ipl == SwissEph.SE_FIXSTAR) { iflgret = sweph.swe_fixstar(star, tjd_et, iflag2, xequ, ref serr); } else { iflgret = sweph.swe_calc(tjd_et, ipl, iflag2, xequ, ref serr); } } /* ecliptic cartesian position */ if (fmt.IndexOfAny("XU".ToCharArray()) >= 0) { iflag2 = iflag | SwissEph.SEFLG_XYZ; if (ipl == SwissEph.SE_FIXSTAR) { iflgret = sweph.swe_fixstar(star, tjd_et, iflag2, xcart, ref serr); } else { iflgret = sweph.swe_calc(tjd_et, ipl, iflag2, xcart, ref serr); } } /* equator cartesian position */ if (fmt.IndexOfAny("xu".ToCharArray()) >= 0) { iflag2 = iflag | SwissEph.SEFLG_XYZ | SwissEph.SEFLG_EQUATORIAL; if (ipl == SwissEph.SE_FIXSTAR) { iflgret = sweph.swe_fixstar(star, tjd_et, iflag2, xcartq, ref serr); } else { iflgret = sweph.swe_calc(tjd_et, ipl, iflag2, xcartq, ref serr); } } spnam = se_pname; /* * The string fmt contains a sequence of format specifiers; * each character in fmt creates a column, the columns are * sparated by the gap string. */ int spi = 0; if (se_pname.Equals(MonitorBody)) { custom_ecllong = x[0].ToString(); custom_ecllat = x[1].ToString(); custom_dist = x[2].ToString(); custom_speed = x[3].ToString(); custom_house = x[4].ToString(); } for (spi = 0; spi < fmt.Length; spi++) { char sp = fmt[spi]; if (spi > 0) { do_print(buf, gap); } switch (sp) { case 'y': do_print(buf, "%d", jyear); break; case 'Y': jut = 0; t2 = sweph.swe_julday(jyear, 1, 1, jut, gregflag); y_frac = (tjd_ut - t2) / 365.0; do_print(buf, "%.2lf", jyear + y_frac); break; case 'p': if (diff_mode) { do_print(buf, "%d-%d", ipl, ipldiff); } else { do_print(buf, "%d", ipl); } break; case 'P': if (diff_mode) { do_print(buf, "%.3s-%.3s", spnam, spnam2); } else { do_print(buf, "%-11s", spnam); } break; case 'J': case 'j': do_print(buf, "%.2f", tjd_ut); break; case 'T': do_print(buf, "%02d.%02d.%d", jday, jmon, jyear); break; case 't': do_print(buf, "%02d%02d%02d", jyear % 100, jmon, jday); break; case 'L': do_print(buf, dms(x[0], round_flag)); break; case 'l': do_print(buf, "%# 11.7f", x[0]); break; case 'Z': do_print(buf, dms(x[0], round_flag | BIT_ZODIAC)); break; case 'S': case 's': var sp2i = spi + 1; char sp2 = fmt.Length <= sp2i ? '\0' : fmt[sp2i]; if (sp2 == 'S' || sp2 == 's' || fmt.IndexOfAny("XUxu".ToCharArray()) >= 0) { for (sp2i = 0; sp2i < fmt.Length; sp2i++) { sp2 = fmt[sp2i]; if (sp2i > 0) { do_print(buf, gap); } switch (sp2) { case 'L': /* speed! */ case 'Z': /* speed! */ do_print(buf, dms(x[3], round_flag)); break; case 'l': /* speed! */ do_print(buf, "%11.7f", x[3]); break; case 'B': /* speed! */ do_print(buf, dms(x[4], round_flag)); break; case 'b': /* speed! */ do_print(buf, "%11.7f", x[4]); break; case 'A': /* speed! */ do_print(buf, dms(xequ[3] / 15, round_flag | SwissEph.SEFLG_EQUATORIAL)); break; case 'a': /* speed! */ do_print(buf, "%11.7f", xequ[3]); break; case 'D': /* speed! */ do_print(buf, dms(xequ[4], round_flag)); break; case 'd': /* speed! */ do_print(buf, "%11.7f", xequ[4]); break; case 'R': /* speed! */ case 'r': /* speed! */ do_print(buf, "%# 14.9f", x[5]); break; case 'U': /* speed! */ case 'X': /* speed! */ if (sp == 'U') { ar = Math.Sqrt(square_sum(xcart)); } else { ar = 1; } do_print(buf, "%# 14.9f%s", xcart[3] / ar, gap); do_print(buf, "%# 14.9f%s", xcart[4] / ar, gap); do_print(buf, "%# 14.9f", xcart[5] / ar); break; case 'u': /* speed! */ case 'x': /* speed! */ if (sp == 'u') { ar = Math.Sqrt(square_sum(xcartq)); } else { ar = 1; } do_print(buf, "%# 14.9f%s", xcartq[3] / ar, gap); do_print(buf, "%# 14.9f%s", xcartq[4] / ar, gap); do_print(buf, "%# 14.9f", xcartq[5] / ar); break; default: break; } } if (fmt.Length <= spi + 1 && (fmt[spi + 1] == 'S' || fmt[sp + 1] == 's')) { spi++; sp = fmt[spi]; } } else { do_print(buf, dms(x[3], round_flag)); } break; case 'B': do_print(buf, dms(x[1], round_flag)); break; case 'b': do_print(buf, "%# 11.7f", x[1]); break; case 'A': /* rectascensio */ do_print(buf, dms(xequ[0] / 15, round_flag | SwissEph.SEFLG_EQUATORIAL)); break; case 'a': /* rectascensio */ do_print(buf, "%# 11.7f", xequ[0]); break; case 'D': /* declination */ do_print(buf, dms(xequ[1], round_flag)); break; case 'd': /* declination */ do_print(buf, "%# 11.7f", xequ[1]); break; case 'R': do_print(buf, "%# 14.9f", x[2]); break; case 'r': if (ipl == SwissEph.SE_MOON) { /* for moon print parallax */ sinp = 8.794 / x[2]; /* in seconds of arc */ ar = sinp * (1 + sinp * sinp * 3.917402e-12); /* the factor is 1 / (3600^2 * (180/pi)^2 * 6) */ do_print(buf, "%# 13.5f\"", ar); } else { do_print(buf, "%# 14.9f", x[2]); } break; case 'U': case 'X': if (sp == 'U') { ar = Math.Sqrt(square_sum(xcart)); } else { ar = 1; } do_print(buf, "%# 14.9f%s", xcart[0] / ar, gap); do_print(buf, "%# 14.9f%s", xcart[1] / ar, gap); do_print(buf, "%# 14.9f", xcart[2] / ar); break; case 'u': case 'x': if (sp == 'u') { ar = Math.Sqrt(square_sum(xcartq)); } else { ar = 1; } do_print(buf, "%# 14.9f%s", xcartq[0] / ar, gap); do_print(buf, "%# 14.9f%s", xcartq[1] / ar, gap); do_print(buf, "%# 14.9f", xcartq[2] / ar); break; case 'Q': do_print(buf, "%-15s", spnam); do_print(buf, dms(x[0], round_flag)); do_print(buf, dms(x[1], round_flag)); do_print(buf, " %# 14.9f", x[2]); do_print(buf, dms(x[3], round_flag)); do_print(buf, dms(x[4], round_flag)); do_print(buf, " %# 14.9f\n", x[5]); do_print(buf, " %s", dms(xequ[0], round_flag)); do_print(buf, dms(xequ[1], round_flag)); do_print(buf, " %s", dms(xequ[3], round_flag)); do_print(buf, dms(xequ[4], round_flag)); break; } /* switch */ /* * EOF printing i to tb */ } /* for sp */ if (calc_house_pos) { //sprintf(s, " %# 6.4f", hpos); do_print(buf, "%# 9.4f", hpos); //custom_house custom_house = hpos.ToString(); } do_print(buf, "\n"); } /* for psp */ if (!String.IsNullOrEmpty(serr_warn)) { do_print(buf, "\nwarning: "); do_print(buf, serr_warn); do_print(buf, "\n"); } /* houses */ do_print(buf, C.sprintf("\nHouse Cusps (%s)\n\n", pd.hsysname)); a = sidt + 0.5 / 3600; do_print(buf, C.sprintf("sid. time : %4d:%#02d:%#02d ", (int)a, (int)((a * 60.0) % 60.0), (int)((a * 3600.0) % 60.0)) ); a = armc + 0.5 / 3600; do_print(buf, "armc : %4d%s%#02d'%#02d\"\n", (int)armc, MY_ODEGREE_STRING, (int)((armc * 60.0) % 60.0), (int)((a * 3600.0) % 60.0)); do_print(buf, "geo. lat. : %4d%c%#02d'%#02d\" ", pd.lat_deg, pd.lat_n_s[0], pd.lat_min, pd.lat_sec); do_print(buf, "geo. long.: %4d%c%#02d'%#02d\"\n\n", pd.lon_deg, pd.lon_e_w[0], pd.lon_min, pd.lon_sec); sweph.swe_houses_ex(tjd_ut, iflag, lat, lon, hsys, cusp, ascmc); round_flag |= BIT_ROUND_SEC; do_print(buf, C.sprintf("AC : %s\n", dms(ascmc[0], round_flag | BIT_ZODIAC))); do_print(buf, C.sprintf("MC : %s\n", dms(ascmc[1], round_flag | BIT_ZODIAC))); for (i = 1; i <= 12; i++) { do_print(buf, C.sprintf("house %2d: %s\n", i, dms(cusp[i], round_flag | BIT_ZODIAC))); } do_print(buf, C.sprintf("Vertex : %s\n", dms(ascmc[3], round_flag | BIT_ZODIAC))); //#endif return(0); }
//static int Main_TestValues(string[] args) { // int jyear = 2014, // jmon = 4, // jday = 21, // jhour = 20, // jmin = 41, // jsec = 23; // using (Sweph sweph = new Sweph()) { // double jut = jhour + (jmin / 60.0) + (jsec / 3600.0); // double tjd = sweph.swe_julday(jyear, jmon, jday, jut, SwissEph.SE_GREG_CAL); // double deltat = sweph.swe_deltat(tjd); // double te = tjd + deltat; // printf("date: %02d.%02d.%d at %02d:%02d:%02d\nDeltat : %f\nJulian Day : %f\nEphemeris Time : %f\n", jday, jmon, jyear, jhour, jmin, jsec, deltat, tjd, te); // var date = new DateUT(jyear, jmon, jday, jhour, jmin, jsec); // var jd = sweph.JulianDay(date, DateCalendar.Gregorian); // var et = sweph.EphemerisTime(jd); // printf("date: %02d.%02d.%d at %02d:%02d:%02d\nDeltat : %f\nJulian Day : %f\nEphemeris Time : %f\n", // date.Day, date.Month, date.Year, date.Hours, date.Minutes, date.Seconds, et.DeltaT, jd.Value, et.Value); // } // Console.ReadKey(); // return 0; //} static int Main_Mini(string[] args) { string sdate = String.Empty, snam = String.Empty, serr = String.Empty; int jday = 1, jmon = 1, jyear = 2000; double jut = 0.0; double[] x2 = new double[6]; Int32 iflag, iflgret; //int p; using (var swe = new SwissEph()) { swe.swe_set_ephe_path(null); iflag = SwissEph.SEFLG_SPEED; swe.OnLoadFile += swe_OnLoadFile; while (true) { Console.Write("\nDate (d.m.y) ? "); sdate = Console.ReadLine(); if (String.IsNullOrWhiteSpace(sdate)) { break; } /* * stop if a period . is entered */ if (sdate == ".") { return(SwissEph.OK); } var match = Regex.Match(sdate, @"(\d+)\.(\d+)\.(\d+)"); if (!match.Success) { continue; } jday = int.Parse(match.Groups[1].Value); jmon = int.Parse(match.Groups[2].Value); jyear = int.Parse(match.Groups[3].Value); /* * we have day, month and year and convert to Julian day number */ var jd = swe.swe_julday(jyear, jmon, jday, jut, SwissEph.SE_GREG_CAL); /* * compute Ephemeris time from Universal time by adding delta_t */ var te = jd + swe.swe_deltat(jd); Console.WriteLine("date: {0:00}.{1:00}.{2:D4} at 0:00 Universal time", jday, jmon, jyear); Console.WriteLine("planet \tlongitude\tlatitude\tdistance\tspeed long."); /* * a loop over all planets */ for (var p = SwissEph.SE_SUN; p <= SwissEph.SE_CHIRON; p++) { if (p == SwissEph.SE_EARTH) { continue; } /* * do the coordinate calculation for this planet p */ iflgret = swe.swe_calc(te, p, iflag, x2, ref serr); /* * if there is a problem, a negative value is returned and an * errpr message is in serr. */ if (iflgret < 0) { printf("error: %s\n", serr); } else if (iflgret != iflag) { printf("warning: iflgret != iflag. %s\n", serr); } /* * get the name of the planet p */ snam = swe.swe_get_planet_name(p); /* * print the coordinates */ printf("%10s\t%11.7f\t%10.7f\t%10.7f\t%10.7f\n", snam, x2[0], x2[1], x2[2], x2[3]); } } } #if DEBUG Console.Write("\nPress a key to quit..."); Console.ReadKey(); #endif return(0); }
public Int32 swe_calc(double tjd, int ipl, Int32 iflag, double[] xx, ref string serr) { CheckInitialized(); return(SwissEph.swe_calc(tjd, ipl, iflag, xx, ref serr)); }
public void TestSideral() { using (var sweph = new SwissEph()) { int jday = 1, jmon = 1, jyear = 2001; double jut = 0; double[] x2 = new double[6]; Int32 iflag, iflgret; iflag = SwissEph.SEFLG_MOSEPH | SwissEph.SEFLG_SIDEREAL | SwissEph.SEFLG_NONUT; string snam = string.Empty, serr = String.Empty; var tjd = sweph.swe_julday(jyear, jmon, jday, jut, SwissEph.SE_GREG_CAL); var te = tjd + sweph.swe_deltat(tjd); double delta = 0.000001; Assert.AreEqual(2451910.5, tjd); Assert.AreEqual(2451910.500742, te, delta); sweph.swe_set_sid_mode(SwissEph.SE_SIDM_LAHIRI, 0, 0); double ayanamsa = sweph.swe_get_ayanamsa(te); Assert.AreEqual(23.871032, ayanamsa, delta); iflgret = sweph.swe_calc(te, SwissEph.SE_SUN, iflag, x2, ref serr); Assert.AreEqual(iflgret, iflag); Assert.AreEqual(256.766845, x2[0], delta); iflgret = sweph.swe_calc(te, SwissEph.SE_MOON, iflag, x2, ref serr); Assert.AreEqual(iflgret, iflag); Assert.AreEqual(324.839238, x2[0], delta); iflgret = sweph.swe_calc(te, SwissEph.SE_MERCURY, iflag, x2, ref serr); Assert.AreEqual(iflgret, iflag); Assert.AreEqual(260.404949, x2[0], delta); iflgret = sweph.swe_calc(te, SwissEph.SE_VENUS, iflag, x2, ref serr); Assert.AreEqual(iflgret, iflag); Assert.AreEqual(303.100189, x2[0], delta); iflgret = sweph.swe_calc(te, SwissEph.SE_MARS, iflag, x2, ref serr); Assert.AreEqual(iflgret, iflag); Assert.AreEqual(191.071250, x2[0], delta); iflgret = sweph.swe_calc(te, SwissEph.SE_JUPITER, iflag, x2, ref serr); Assert.AreEqual(iflgret, iflag); Assert.AreEqual(38.323488, x2[0], delta); iflgret = sweph.swe_calc(te, SwissEph.SE_SATURN, iflag, x2, ref serr); Assert.AreEqual(iflgret, iflag); Assert.AreEqual(30.724496, x2[0], delta); iflgret = sweph.swe_calc(te, SwissEph.SE_URANUS, iflag, x2, ref serr); Assert.AreEqual(iflgret, iflag); Assert.AreEqual(294.783510, x2[0], delta); iflgret = sweph.swe_calc(te, SwissEph.SE_NEPTUNE, iflag, x2, ref serr); Assert.AreEqual(iflgret, iflag); Assert.AreEqual(281.460643, x2[0], delta); iflgret = sweph.swe_calc(te, SwissEph.SE_PLUTO, iflag, x2, ref serr); Assert.AreEqual(iflgret, iflag); Assert.AreEqual(229.901526, x2[0], delta); iflgret = sweph.swe_calc(te, SwissEph.SE_MEAN_NODE, iflag, x2, ref serr); Assert.AreEqual(iflgret, iflag); Assert.AreEqual(81.818882, x2[0], delta); } }
void RunTest(TestDefinition test, TestResult result) { string serr = String.Empty, serr_save = String.Empty, serr_warn = String.Empty; //string s, s1, s2; string star = String.Empty; string se_pname; string spnam, spnam2 = ""; string fmt = "PZBRS"; string plsel = String.Empty; //char psp; string gap = " "; double y_frac; double hpos = 0; int ipl, ipldiff = SwissEph.SE_SUN; double[] x = new double[6], xequ = new double[6], xcart = new double[6], xcartq = new double[6]; double[] cusp = new double[12 + 1]; /* cusp[0] + 12 houses */ double[] ascmc = new double[10]; /* asc, mc, vertex ...*/ //double ar, sinp; //double a, sidt, armc, lon, lat; //double eps_true, eps_mean, nutl, nuto; string fname = String.Empty; //int nast, iast; int[] astno = new int[100]; int iflag = 0, iflag2; /* external flag: helio, geo... */ //int iflgret; var whicheph = SwissEph.SEFLG_SWIEPH; bool universal_time = false; bool calc_house_pos = false; int gregflag; bool diff_mode = false; int round_flag = 0; string jul; char hsys = test.HouseSystem.ToString()[0]; var buf = Provider.Output; switch (test.Ephemeris) { case EphemerisType.JplEphemeris: whicheph = SwissEph.SEFLG_JPLEPH; fname = SwissEph.SE_FNAME_DE406; break; case EphemerisType.MoshierEphemeris: whicheph = SwissEph.SEFLG_MOSEPH; break; case EphemerisType.SwissEphemeris: default: whicheph = SwissEph.SEFLG_SWIEPH; break; } universal_time = test.EtUt == TimeType.UniversalTime; switch (test.Planets) { case PlanetsType.WithAsteroids: plsel = PLSEL_P; break; case PlanetsType.WithHypBodies: plsel = PLSEL_A; break; case PlanetsType.MainPlanets: default: plsel = PLSEL_D; break; } switch (test.Centric) { case CentricType.Topocentric: iflag |= SwissEph.SEFLG_TOPOCTR; calc_house_pos = true; break; case CentricType.Heliocentric: iflag |= SwissEph.SEFLG_HELCTR; break; case CentricType.Barycentric: iflag |= SwissEph.SEFLG_BARYCTR; break; case CentricType.SiderealFagan: iflag |= SwissEph.SEFLG_SIDEREAL; SwissEph.swe_set_sid_mode(SwissEph.SE_SIDM_FAGAN_BRADLEY, 0, 0); break; case CentricType.SiderealLahiri: iflag |= SwissEph.SEFLG_SIDEREAL; SwissEph.swe_set_sid_mode(SwissEph.SE_SIDM_LAHIRI, 0, 0); break; case CentricType.Geocentric: default: calc_house_pos = true; break; } result.Longitude = test.LongitudeDeg + test.LongitudeMin / 60.0 + test.LongitudeSec / 3600.0; if (test.LongitudeType == LongitudeType.West) { result.Longitude = -result.Longitude; } result.Latitude = test.LatitudeDeg + test.LatitudeMin / 60.0 + test.LatitudeSec / 3600.0; if (test.LatitudeType == LatitudeType.South) { result.Latitude = -result.Latitude; } do_print(buf, C.sprintf("Planet Positions from %s \n\n", test.Ephemeris)); if ((whicheph & SwissEph.SEFLG_JPLEPH) != 0) { SwissEph.swe_set_jpl_file(fname); } iflag = (iflag & ~SwissEph.SEFLG_EPHMASK) | whicheph; iflag |= SwissEph.SEFLG_SPEED; if (test.Date.Year * 10000 + test.Date.Month * 100 + test.Date.Day < 15821015) { gregflag = SwissEph.SE_JUL_CAL; } else { gregflag = SwissEph.SE_GREG_CAL; } result.UseGregorianDate = gregflag == SwissEph.SE_GREG_CAL; var jday = test.Date.Day; var jmon = test.Date.Month; var jyear = test.Date.Year; var jhour = test.Date.Hour; var jmin = test.Date.Minute; var jsec = test.Date.Second; var jut = jhour + (jmin / 60.0) + (jsec / 3600.0); result.JulianDateUT = SwissEph.swe_julday(jyear, jmon, jday, jut, gregflag); SwissEph.swe_revjul(result.JulianDateUT, gregflag, ref jyear, ref jmon, ref jday, ref jut); jut += 0.5 / 3600; jhour = (int)jut; jmin = (int)((jut * 60.0) % 60.0); jsec = (int)((jut * 3600.0) % 60.0); result.JulianDay = jday; result.JulianMonth = jmon; result.JulianYear = jyear; result.JulianHour = jhour; result.JulianMinute = jmin; result.JulianSecond = jsec; var bc = string.Empty; do_print(buf, $"Date: {test.Date}\n"); if (test.Date.Year <= 0) { bc = C.sprintf("(%d B.C.)", 1 - jyear); } if (jyear * 10000L + jmon * 100L + jday <= 15821004) { jul = "jul."; } else { jul = ""; } do_print(buf, C.sprintf("%d.%d.%d %s %s %#02d:%#02d:%#02d %s\n", jday, jmon, jyear, bc, jul, jhour, jmin, jsec, test.EtUt == TimeType.UniversalTime ? "UT" : "ET")); jut = jhour + jmin / 60.0 + jsec / 3600.0; if (universal_time) { result.DeltaTime = SwissEph.swe_deltat(result.JulianDateUT); do_print(buf, C.sprintf(" delta t: %f sec", result.DeltaTime * 86400.0)); result.JulianDateET = result.JulianDateUT + result.DeltaTime; } else { result.JulianDateET = result.JulianDateUT; } do_print(buf, C.sprintf(" jd (ET) = %f\n", result.JulianDateET)); var iflgret = SwissEph.swe_calc(result.JulianDateET, SwissEph.SE_ECL_NUT, iflag, x, ref serr); var eps_true = x[0]; var eps_mean = x[1]; var s1 = dms(eps_true, round_flag); var s2 = dms(eps_mean, round_flag); do_print(buf, C.sprintf("\n%-15s %s%s%s (true, mean)", "Ecl. obl.", s1, gap, s2)); var nutl = x[2]; var nuto = x[3]; s1 = dms(nutl, round_flag); s2 = dms(nuto, round_flag); do_print(buf, C.sprintf("\n%-15s %s%s%s (dpsi, deps)", "Nutation", s1, gap, s2)); do_print(buf, "\n\n"); do_print(buf, " ecl. long. ecl. lat. "); do_print(buf, " dist. speed"); if (calc_house_pos) { do_print(buf, " house"); } do_print(buf, "\n"); if ((iflag & SwissEph.SEFLG_TOPOCTR) != 0) { SwissEph.swe_set_topo(result.Longitude, result.Latitude, test.Altitude); } result.SideralTime = SwissEph.swe_sidtime(result.JulianDateUT) + result.Longitude / 15; if (result.SideralTime >= 24) { result.SideralTime -= 24; } if (result.SideralTime < 0) { result.SideralTime += 24; } result.ARMC = result.SideralTime * 15; /* additional asteroids */ //splan = plsel; if (String.Compare(plsel, PLSEL_P) == 0) { var cpos = test.Asteroids.Split(",;. \t".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); var j = cpos.Length; for (int i = 0, nast = 0; i < j; i++) { if ((astno[nast] = int.Parse(cpos[i])) > 0) { nast++; plsel += "+"; } } } for (int pspi = 0, iast = 0; pspi < plsel.Length; pspi++) { var psp = plsel[pspi]; if (psp == '+') { ipl = SwissEph.SE_AST_OFFSET + (int)astno[iast]; iast++; } else { ipl = letter_to_ipl(psp); } if ((iflag & SwissEph.SEFLG_HELCTR) != 0) { if (ipl == SwissEph.SE_SUN || ipl == SwissEph.SE_MEAN_NODE || ipl == SwissEph.SE_TRUE_NODE || ipl == SwissEph.SE_MEAN_APOG || ipl == SwissEph.SE_OSCU_APOG) { continue; } } else if ((iflag & SwissEph.SEFLG_BARYCTR) != 0) { if (ipl == SwissEph.SE_MEAN_NODE || ipl == SwissEph.SE_TRUE_NODE || ipl == SwissEph.SE_MEAN_APOG || ipl == SwissEph.SE_OSCU_APOG) { continue; } } else /* geocentric */ if (ipl == SwissEph.SE_EARTH) { continue; } /* ecliptic position */ if (ipl == SwissEph.SE_FIXSTAR) { iflgret = SwissEph.swe_fixstar(star, result.JulianDateET, iflag, x, ref serr); se_pname = star; } else { iflgret = SwissEph.swe_calc(result.JulianDateET, ipl, iflag, x, ref serr); se_pname = SwissEph.swe_get_planet_name(ipl); if (ipl > SwissEph.SE_AST_OFFSET) { var s = C.sprintf("#%d", (int)astno[iast - 1]); se_pname += new String(' ', 11 - s.Length) + s; } } if (iflgret >= 0) { if (calc_house_pos) { hpos = SwissEph.swe_house_pos(result.ARMC, result.Latitude, eps_true, hsys, x, ref serr); if (hpos == 0) { iflgret = SwissEph.ERR; } } } if (iflgret < 0) { if (!String.IsNullOrEmpty(serr) && String.Compare(serr, serr_save) != 0) { serr_save = serr; do_print(buf, "error: "); do_print(buf, serr); do_print(buf, "\n"); } } else if (!String.IsNullOrEmpty(serr) && String.IsNullOrEmpty(serr_warn)) { serr_warn = serr; } /* equator position */ if (fmt.IndexOfAny("aADdQ".ToCharArray()) >= 0) { iflag2 = iflag | SwissEph.SEFLG_EQUATORIAL; if (ipl == SwissEph.SE_FIXSTAR) { iflgret = SwissEph.swe_fixstar(star, result.JulianDateET, iflag2, xequ, ref serr); } else { iflgret = SwissEph.swe_calc(result.JulianDateET, ipl, iflag2, xequ, ref serr); } } /* ecliptic cartesian position */ if (fmt.IndexOfAny("XU".ToCharArray()) >= 0) { iflag2 = iflag | SwissEph.SEFLG_XYZ; if (ipl == SwissEph.SE_FIXSTAR) { iflgret = SwissEph.swe_fixstar(star, result.JulianDateET, iflag2, xcart, ref serr); } else { iflgret = SwissEph.swe_calc(result.JulianDateET, ipl, iflag2, xcart, ref serr); } } /* equator cartesian position */ if (fmt.IndexOfAny("xu".ToCharArray()) >= 0) { iflag2 = iflag | SwissEph.SEFLG_XYZ | SwissEph.SEFLG_EQUATORIAL; if (ipl == SwissEph.SE_FIXSTAR) { iflgret = SwissEph.swe_fixstar(star, result.JulianDateET, iflag2, xcartq, ref serr); } else { iflgret = SwissEph.swe_calc(result.JulianDateET, ipl, iflag2, xcartq, ref serr); } } double t2, ar, sinp; spnam = se_pname; /* * The string fmt contains a sequence of format specifiers; * each character in fmt creates a column, the columns are * sparated by the gap string. */ int spi = 0; for (spi = 0; spi < fmt.Length; spi++) { char sp = fmt[spi]; if (spi > 0) { do_print(buf, gap); } switch (sp) { case 'y': do_print(buf, "%d", jyear); break; case 'Y': jut = 0; t2 = SwissEph.swe_julday(jyear, 1, 1, jut, gregflag); y_frac = (result.JulianDateUT - t2) / 365.0; do_print(buf, "%.2lf", jyear + y_frac); break; case 'p': if (diff_mode) { do_print(buf, "%d-%d", ipl, ipldiff); } else { do_print(buf, "%d", ipl); } break; case 'P': if (diff_mode) { do_print(buf, "%.3s-%.3s", spnam, spnam2); } else { do_print(buf, "%-11s", spnam); } break; case 'J': case 'j': do_print(buf, "%.2f", result.JulianDateUT); break; case 'T': do_print(buf, "%02d.%02d.%d", jday, jmon, jyear); break; case 't': do_print(buf, "%02d%02d%02d", jyear % 100, jmon, jday); break; case 'L': do_print(buf, dms(x[0], round_flag)); break; case 'l': do_print(buf, "%# 11.7f", x[0]); break; case 'Z': do_print(buf, dms(x[0], round_flag | BIT_ZODIAC)); break; case 'S': case 's': var sp2i = spi + 1; char sp2 = fmt.Length <= sp2i ? '\0' : fmt[sp2i]; if (sp2 == 'S' || sp2 == 's' || fmt.IndexOfAny("XUxu".ToCharArray()) >= 0) { for (sp2i = 0; sp2i < fmt.Length; sp2i++) { sp2 = fmt[sp2i]; if (sp2i > 0) { do_print(buf, gap); } switch (sp2) { case 'L': /* speed! */ case 'Z': /* speed! */ do_print(buf, dms(x[3], round_flag)); break; case 'l': /* speed! */ do_print(buf, "%11.7f", x[3]); break; case 'B': /* speed! */ do_print(buf, dms(x[4], round_flag)); break; case 'b': /* speed! */ do_print(buf, "%11.7f", x[4]); break; case 'A': /* speed! */ do_print(buf, dms(xequ[3] / 15, round_flag | SwissEph.SEFLG_EQUATORIAL)); break; case 'a': /* speed! */ do_print(buf, "%11.7f", xequ[3]); break; case 'D': /* speed! */ do_print(buf, dms(xequ[4], round_flag)); break; case 'd': /* speed! */ do_print(buf, "%11.7f", xequ[4]); break; case 'R': /* speed! */ case 'r': /* speed! */ do_print(buf, "%# 14.9f", x[5]); break; case 'U': /* speed! */ case 'X': /* speed! */ if (sp == 'U') { ar = Math.Sqrt(square_sum(xcart)); } else { ar = 1; } do_print(buf, "%# 14.9f%s", xcart[3] / ar, gap); do_print(buf, "%# 14.9f%s", xcart[4] / ar, gap); do_print(buf, "%# 14.9f", xcart[5] / ar); break; case 'u': /* speed! */ case 'x': /* speed! */ if (sp == 'u') { ar = Math.Sqrt(square_sum(xcartq)); } else { ar = 1; } do_print(buf, "%# 14.9f%s", xcartq[3] / ar, gap); do_print(buf, "%# 14.9f%s", xcartq[4] / ar, gap); do_print(buf, "%# 14.9f", xcartq[5] / ar); break; default: break; } } if (fmt.Length <= spi + 1 && (fmt[spi + 1] == 'S' || fmt[sp + 1] == 's')) { spi++; sp = fmt[spi]; } } else { do_print(buf, dms(x[3], round_flag)); } break; case 'B': do_print(buf, dms(x[1], round_flag)); break; case 'b': do_print(buf, "%# 11.7f", x[1]); break; case 'A': /* rectascensio */ do_print(buf, dms(xequ[0] / 15, round_flag | SwissEph.SEFLG_EQUATORIAL)); break; case 'a': /* rectascensio */ do_print(buf, "%# 11.7f", xequ[0]); break; case 'D': /* declination */ do_print(buf, dms(xequ[1], round_flag)); break; case 'd': /* declination */ do_print(buf, "%# 11.7f", xequ[1]); break; case 'R': do_print(buf, "%# 14.9f", x[2]); break; case 'r': if (ipl == SwissEph.SE_MOON) { /* for moon print parallax */ sinp = 8.794 / x[2]; /* in seconds of arc */ ar = sinp * (1 + sinp * sinp * 3.917402e-12); /* the factor is 1 / (3600^2 * (180/pi)^2 * 6) */ do_print(buf, "%# 13.5f\"", ar); } else { do_print(buf, "%# 14.9f", x[2]); } break; case 'U': case 'X': if (sp == 'U') { ar = Math.Sqrt(square_sum(xcart)); } else { ar = 1; } do_print(buf, "%# 14.9f%s", xcart[0] / ar, gap); do_print(buf, "%# 14.9f%s", xcart[1] / ar, gap); do_print(buf, "%# 14.9f", xcart[2] / ar); break; case 'u': case 'x': if (sp == 'u') { ar = Math.Sqrt(square_sum(xcartq)); } else { ar = 1; } do_print(buf, "%# 14.9f%s", xcartq[0] / ar, gap); do_print(buf, "%# 14.9f%s", xcartq[1] / ar, gap); do_print(buf, "%# 14.9f", xcartq[2] / ar); break; case 'Q': do_print(buf, "%-15s", spnam); do_print(buf, dms(x[0], round_flag)); do_print(buf, dms(x[1], round_flag)); do_print(buf, " %# 14.9f", x[2]); do_print(buf, dms(x[3], round_flag)); do_print(buf, dms(x[4], round_flag)); do_print(buf, " %# 14.9f\n", x[5]); do_print(buf, " %s", dms(xequ[0], round_flag)); do_print(buf, dms(xequ[1], round_flag)); do_print(buf, " %s", dms(xequ[3], round_flag)); do_print(buf, dms(xequ[4], round_flag)); break; } /* switch */ } /* for sp */ if (calc_house_pos) { //sprintf(s, " %# 6.4f", hpos); do_print(buf, "%# 9.4f", hpos); } do_print(buf, "\n"); } /* for psp */ if (!String.IsNullOrEmpty(serr_warn)) { do_print(buf, "\nwarning: "); do_print(buf, serr_warn); do_print(buf, "\n"); } /* houses */ do_print(buf, C.sprintf("\nHouse Cusps (%s)\n\n", test.HouseSystem.ToString())); var a = result.SideralTime + 0.5 / 3600; do_print(buf, C.sprintf("sid. time : %4d:%#02d:%#02d ", (int)a, (int)((a * 60.0) % 60.0), (int)((a * 3600.0) % 60.0)) ); a = result.ARMC + 0.5 / 3600; do_print(buf, "armc : %4d%s%#02d'%#02d\"\n", (int)result.ARMC, MY_ODEGREE_STRING, (int)((result.ARMC * 60.0) % 60.0), (int)((a * 3600.0) % 60.0)); do_print(buf, "geo. lat. : %4d%c%#02d'%#02d\" ", test.LatitudeDeg, test.LatitudeType.ToString()[0], test.LatitudeMin, test.LatitudeSec); do_print(buf, "geo. long.: %4d%c%#02d'%#02d\"\n\n", test.LongitudeDeg, test.LongitudeType.ToString()[0], test.LongitudeMin, test.LongitudeSec); SwissEph.swe_houses_ex(result.JulianDateUT, iflag, result.Latitude, result.Longitude, hsys, cusp, ascmc); round_flag |= BIT_ROUND_SEC; do_print(buf, C.sprintf("AC : %s\n", dms(ascmc[0], round_flag | BIT_ZODIAC))); do_print(buf, C.sprintf("MC : %s\n", dms(ascmc[1], round_flag | BIT_ZODIAC))); for (int i = 1; i <= 12; i++) { do_print(buf, C.sprintf("house %2d: %s\n", i, dms(cusp[i], round_flag | BIT_ZODIAC))); } do_print(buf, C.sprintf("Vertex : %s\n", dms(ascmc[3], round_flag | BIT_ZODIAC))); }