ygrenier / SwissEphNet

Swiss Ephemeris for .Net. A Swiss Ephemeris portage for .Net.
Other
77 stars 35 forks source link

Planet position in house #24

Closed SkyQuant closed 5 years ago

SkyQuant commented 7 years ago

What's wrong in this method to get planet position in Placidus house system?

        public static double GetPlanetInHousePosition(int ipl, DateTimeOffset dtz, double lon, double lat, char hsys = 'P')
        {
            var serr = string.Empty;
            var dtu = dtz.UtcDateTime;

            using (var sweph = new SwissEph())
            {
                var jyear = dtu.Year;
                var jmon = dtu.Month;
                var jday = dtu.Day;
                var jhour = dtu.Hour;
                var jmin = dtu.Minute;
                var jsec = dtu.Second;

                var jut = jhour + (jmin / 60.0) + (jsec / 3600.0);
                var tjd_ut = sweph.swe_julday(jyear, jmon, jday, jut, SwissEph.SE_GREG_CAL);
                sweph.swe_revjul(tjd_ut, SwissEph.SE_GREG_CAL, ref jyear, ref jmon, ref jday, ref jut);
                var delt = sweph.swe_deltat(tjd_ut);
                var tjd_et = tjd_ut + delt;

                int iflag = 0;
                iflag = (iflag & ~SwissEph.SEFLG_EPHMASK) | SwissEph.SEFLG_SWIEPH;
                iflag |= SwissEph.SEFLG_SPEED;
                double[] x = new double[6];
                int iflgret = sweph.swe_calc(tjd_et, SwissEph.SE_ECL_NUT, iflag, x, ref serr);
                var eps_true = x[0];
                var sidt = sweph.swe_sidtime(tjd_ut) + lon / 15;
                if (sidt >= 24)
                    sidt -= 24;
                if (sidt < 0)
                    sidt += 24;
                var armc = sidt * 15;
                var hpos = sweph.swe_house_pos(armc, lat, eps_true, hsys , x, ref serr);
                return hpos;
            }
        }
ygrenier commented 7 years ago

Sorry for the delay.

I don't use the Library, I make it for a friend. So I'm not sure about the calculation and the result you expect. I can help about the use of the code, but not about the calculations.

But if I look the line 1960 of the SweTest program which using swe_house_pos(), I can see the armc with a different calculation than your code, line 1942 :

  armc = sweph.swe_degnorm(sweph.swe_sidtime(tut) * 15 + geopos[0]);

You can ask the question in the official SwissEphemeris Library group http://groups.yahoo.com/group/swisseph/ where there are the people are better about the ephemeris calculation. After you apply the response to the SwissEphNet.