Ejemplo n.º 1
0
        // CPS
        // 月、水星、金星、太陽は一日一年法
        // 火星以降および感受点は一度一年法
        // 一年を365.24日で計算、当然ずれが生じる
        // 面倒なのでとりあえず放置
        public List<PlanetData> CompositProgressionCalc(List<PlanetData> natallist, DateTime natalTime, DateTime transitTime)
        {
            List<PlanetData> progresslist = new List<PlanetData>();
            TimeSpan ts = transitTime - natalTime;
            double years = ts.TotalDays / year_days;

            // 日付を秒数に変換する
            int seconds = (int)(years * 86400);

            TimeSpan add = TimeSpan.FromSeconds(seconds);

            DateTime newTime = natalTime + add;

            // absolute position
            double[] x = { 0, 0, 0, 0, 0, 0 };
            string serr = "";

            int utc_year = 0;
            int utc_month = 0;
            int utc_day = 0;
            int utc_hour = 0;
            int utc_minute = 0;
            double utc_second = 0;

            // [0]:Ephemeris Time [1]:Universal Time
            double[] dret = { 0.0, 0.0 };

            // utcに変換
            s.swe_utc_time_zone(newTime.Year, newTime.Month, newTime.Day, newTime.Hour, newTime.Minute, newTime.Second, 9.0, ref utc_year, ref utc_month, ref utc_day, ref utc_hour, ref utc_minute, ref utc_second);
            s.swe_utc_to_jd(utc_year, utc_month, utc_day, utc_hour, utc_minute, utc_second, 1, dret, ref serr);

            natallist.ForEach( data => 
            {
                PlanetData progressdata;
                if ((data.no != Common.ZODIAC_MOON) && (data.no != Common.ZODIAC_MERCURY) && (data.no != Common.ZODIAC_VENUS) && (data.no != Common.ZODIAC_SUN))
                {
                    progressdata = new PlanetData() { absolute_position = data.absolute_position, no = data.no, sensitive = data.sensitive, speed = data.speed, aspects = new List<Aspect>(), progressAspects = new List<Aspect>(), transitAspects = new List<Aspect>() };
                    progressdata.absolute_position += years;
                    progressdata.absolute_position %= 365;
                    progresslist.Add(progressdata);
                    return;
                }
                int flag = SwissEph.SEFLG_SWIEPH | SwissEph.SEFLG_SPEED;
                if (config.centric == ECentric.HELIO_CENTRIC)
                    flag |= SwissEph.SEFLG_HELCTR;
                if (config.sidereal == Esidereal.SIDEREAL)
                {
                    flag |= SwissEph.SEFLG_SIDEREAL;
                    s.swe_set_sid_mode(SwissEph.SE_SIDM_LAHIRI, 0, 0);
                    // ayanamsa計算
                    double daya = 0.0;
                    double ut = s.swe_get_ayanamsa_ex_ut(dret[1], SwissEph.SEFLG_SWIEPH, out daya, ref serr);

                    // Ephemeris Timeで計算, 結果はxに入る
                    s.swe_calc_ut(dret[1], data.no, flag, x, ref serr);
                    // tropicalからayanamsaをマイナス
                    x[0] = x[0] > daya ? x[0] - daya : x[0] - daya + 360;
                }
                else
                {
                    // Universal Timeで計算, 結果はxに入る
                    s.swe_calc_ut(dret[1], data.no, flag, x, ref serr);
                }

                progressdata = new PlanetData() { absolute_position = x[0], no = data.no, sensitive = data.sensitive, speed = data.speed, aspects = new List<Aspect>(), progressAspects = new List<Aspect>(), transitAspects = new List<Aspect>() };
                progresslist.Add(progressdata);

            });


            return progresslist;
        }
Ejemplo n.º 2
0
        // 天体の位置を計算する
        public List<PlanetData> PositionCalc(int year, int month, int day, int hour, int min, double sec, double lat, double lng)
        {
            List<PlanetData> planetdata = new List<PlanetData>(); ;

            // absolute position
            double[] x = { 0, 0, 0, 0, 0, 0 };
            string serr = "";

            int utc_year = 0;
            int utc_month = 0;
            int utc_day = 0;
            int utc_hour = 0;
            int utc_minute = 0;
            double utc_second = 0;

            // [0]:Ephemeris Time [1]:Universal Time
            double[] dret = {0.0, 0.0};

            // utcに変換
            s.swe_utc_time_zone(year, month, day, hour, min, sec, 9.0, ref utc_year, ref utc_month, ref utc_day, ref utc_hour, ref utc_minute, ref utc_second);
            s.swe_utc_to_jd(utc_year, utc_month, utc_day, utc_hour, utc_minute, utc_second, 1, dret, ref serr);

            // 10天体ループ
            // 11(DH/TrueNode)、14(Earth)、15(Chiron)もついでに計算
            Enumerable.Range(0, 16).ToList().ForEach(i =>
            {
                int flag = SwissEph.SEFLG_SWIEPH | SwissEph.SEFLG_SPEED;
                if (config.centric == ECentric.HELIO_CENTRIC)
                    flag |= SwissEph.SEFLG_HELCTR;
                if (config.sidereal == Esidereal.SIDEREAL)
                {
                    flag |= SwissEph.SEFLG_SIDEREAL;
                    s.swe_set_sid_mode(SwissEph.SE_SIDM_LAHIRI, 0, 0);
                    // ayanamsa計算
                    double daya = 0.0;
                    double ut = s.swe_get_ayanamsa_ex_ut(dret[1], SwissEph.SEFLG_SWIEPH, out daya, ref serr);

                    // Ephemeris Timeで計算, 結果はxに入る
                    s.swe_calc_ut(dret[1], i, flag, x, ref serr);
                    // tropicalからayanamsaをマイナス
                    if (x[0] > daya)
                    {
                        x[0] -= daya;
                    }
                    else
                    {
                        x[0] = x[0] - daya + 360;
                    }
                }
                else
                {
                    // Universal Timeで計算, 結果はxに入る
                    s.swe_calc_ut(dret[1], i, flag, x, ref serr);
                }


                PlanetData p = new PlanetData() { no = i, absolute_position = x[0], speed = x[3], aspects = new List<Aspect>(), progressAspects = new List<Aspect>(), transitAspects = new List<Aspect>(), sensitive = false, isDisp = true, isAspectDisp = true };
                if (config.centric == ECentric.HELIO_CENTRIC && i == 0)
                {
                    // ヘリオセントリック太陽
                    p.isDisp = false;
                    p.isAspectDisp = false;
                }
                if (i >= 10)
                {
                    p.isDisp = false;
                    p.isAspectDisp = false;
                }
                if (i == 11)
                {
                    // ヘッド
                    p.isDisp = true;
                    p.isAspectDisp = true;
                }
                if (config.centric == ECentric.HELIO_CENTRIC && i == 14)
                {
                    // ヘリオセントリック地球
                    p.isDisp = true;
                    p.isAspectDisp = true;
                }
                planetdata.Add(p);
            });

            s.swe_close();
            return planetdata;
        }
Ejemplo n.º 3
0
        // 一度一年法
        // 一年を365.24日で計算、当然ずれが生じる
        // 面倒なのでとりあえず放置
        public List<PlanetData> PrimaryProgressionCalc(List<PlanetData> natallist, DateTime natalTime, DateTime transitTime)
        {
            List<PlanetData> progresslist = new List<PlanetData>();
            TimeSpan ts = transitTime - natalTime;
            double years = ts.TotalDays / year_days;
            natallist.ForEach(data =>
            {
                PlanetData progressdata = new PlanetData() { absolute_position = data.absolute_position, no = data.no, sensitive = data.sensitive, speed = data.speed, aspects = new List<Aspect>(), progressAspects = new List<Aspect>(), transitAspects = new List<Aspect>() };
                progressdata.absolute_position += years;
                progressdata.absolute_position %= 365;
                progresslist.Add(progressdata);
            });

            return progresslist;
        }