Ejemplo n.º 1
0
        // カスプを計算
        public double[] CuspCalc(DateTime d, double lat, double lng, int houseKind)
        {
            int    utc_year   = 0;
            int    utc_month  = 0;
            int    utc_day    = 0;
            int    utc_hour   = 0;
            int    utc_minute = 0;
            double utc_second = 0;
            string serr       = "";

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

            SwissEph s = new SwissEph();

            // utcに変換
            s.swe_utc_time_zone(d.Year, d.Month, d.Day, d.Hour, d.Minute, d.Second, 0.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);

            double[] cusps = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
            double[] ascmc = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

            if (houseKind == 0)
            {
                // Placidas
                s.swe_houses(dret[1], lat, lng, 'P', cusps, ascmc);
            }
            else if (houseKind == 1)
            {
                // Koch
                s.swe_houses(dret[1], lat, lng, 'K', cusps, ascmc);
            }
            else if (houseKind == 2)
            {
                // Campanus
                s.swe_houses(dret[1], lat, lng, 'C', cusps, ascmc);
            }
            else
            {
                // Equal
                s.swe_houses(dret[1], lat, lng, 'E', cusps, ascmc);
            }
            s.swe_close();

            return(cusps);
        }
Ejemplo n.º 2
0
        // 天体の位置を計算する
        public Dictionary <int, PlanetData> PositionCalc(DateTime d, double lat, double lng, int houseKind, int subIndex)
        {
            Dictionary <int, PlanetData> planetdata = new Dictionary <int, 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 };

            int ii = 0;

            // utcに変換
            // 本来ここにJSTの9.0を入れるのだが・・・
            s.swe_utc_time_zone(d.Year, d.Month, d.Day, d.Hour, d.Minute, d.Second, 0.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);
                }
                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 <AspectInfo>(),
                    secondAspects = new List <AspectInfo>(),
                    thirdAspects  = new List <AspectInfo>(),
                    sensitive     = false
                };
                if (i < 10 && subIndex >= 0)
                {
                    if (main.currentSetting.dispPlanet[subIndex][main.dispListMap[i]])
                    {
                        p.isDisp = true;
                    }
                    else
                    {
                        p.isDisp = false;
                    }
                    if (main.currentSetting.dispAspectPlanet[subIndex][main.dispListMap[i]])
                    {
                        p.isAspectDisp = true;
                    }
                    else
                    {
                        p.isAspectDisp = false;
                    }
                }
                if (config.centric == ECentric.HELIO_CENTRIC && i == 0)
                {
                    // ヘリオセントリック太陽
                    p.isDisp       = false;
                    p.isAspectDisp = false;
                }
                if (i == 10)
                {
                    // MEAN NODE
                    p.isDisp       = false;
                    p.isAspectDisp = false;
                }
                if (i == 11 && subIndex >= 0 && config.centric == ECentric.GEO_CENTRIC)
                {
                    // TRUE NODE ヘッド
                    if (main.currentSetting.dispPlanet[subIndex][11])
                    {
                        p.isDisp = true;
                    }
                    else
                    {
                        p.isDisp = false;
                    }
                    if (main.currentSetting.dispAspectPlanet[subIndex][11])
                    {
                        p.isAspectDisp = true;
                    }
                    else
                    {
                        p.isAspectDisp = false;
                    }
                }
                if (i == 12)
                {
                    // mean apogee、どうでもいい
                    p.isDisp       = false;
                    p.isAspectDisp = false;
                }
                if (i == 13 && subIndex >= 0)
                {
                    // true apogee、要はリリス
                    if (main.currentSetting.dispPlanet[subIndex][CommonData.ZODIAC_LILITH])
                    {
                        p.isDisp = true;
                    }
                    else
                    {
                        p.isDisp = false;
                    }
                    if (main.currentSetting.dispAspectPlanet[subIndex][CommonData.ZODIAC_LILITH])
                    {
                        p.isAspectDisp = true;
                    }
                    else
                    {
                        p.isAspectDisp = false;
                    }
                }
                if (config.centric == ECentric.HELIO_CENTRIC && i == 14 && subIndex >= 0)
                {
                    // ヘリオセントリック地球
                    if (main.currentSetting.dispPlanet[subIndex][main.dispListMap[i]])
                    {
                        p.isDisp = true;
                    }
                    else
                    {
                        p.isDisp = false;
                    }
                    if (main.currentSetting.dispAspectPlanet[subIndex][main.dispListMap[i]])
                    {
                        p.isAspectDisp = true;
                    }
                    else
                    {
                        p.isAspectDisp = false;
                    }
                }
                if (i == 15 && subIndex >= 0)
                {
                    if (main.currentSetting.dispPlanet[subIndex][CommonData.ZODIAC_CHIRON])
                    {
                        p.isDisp = true;
                    }
                    else
                    {
                        p.isDisp = false;
                    }
                    if (main.currentSetting.dispAspectPlanet[subIndex][CommonData.ZODIAC_CHIRON])
                    {
                        p.isAspectDisp = true;
                    }
                    else
                    {
                        p.isAspectDisp = false;
                    }
                }
                ii            = i;
                planetdata[i] = p;
            });

            s.swe_close();
            // ハウスを後ろにくっつける
            double[] houses = CuspCalc(d, lat, lng, houseKind);
            planetdata = setHouse(planetdata, houses, main.currentSetting, subIndex);

            return(planetdata);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// ハウス計算
        /// </summary>
        /// <returns>The calculate.</returns>
        /// <param name="d">時刻</param>
        /// <param name="lat">緯度</param>
        /// <param name="lng">経度</param>
        /// <param name="houseKind">ハウス種別
        /// 0:Placidus
        /// 1:Koch
        /// 2:Campanus
        ///
        /// </param>
        ///
        public double[] CuspCalc(DateTime d, double lat, double lng, double timezone, EHouseCalc houseKind)
        {
            s.swe_set_ephe_path(Windows.Storage.ApplicationData.Current.LocalFolder.Path + "/ephe");
            s.OnLoadFile += (sender, e) => {
                if (File.Exists(e.FileName))
                {
                    e.File = new FileStream(e.FileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
                }
            };

            int    utc_year   = 0;
            int    utc_month  = 0;
            int    utc_day    = 0;
            int    utc_hour   = 0;
            int    utc_minute = 0;
            double utc_second = 0;
            string serr       = "";

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

            // utcに変換
            s.swe_utc_time_zone(d.Year, d.Month, d.Day, d.Hour, d.Minute, d.Second, timezone, 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);

            double[] cusps = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
            double[] ascmc = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

            if (houseKind == EHouseCalc.PLACIDUS)
            {
                // Placidas
                s.swe_houses(dret[1], lat, lng, 'P', cusps, ascmc);
            }
            else if (houseKind == EHouseCalc.KOCH)
            {
                // Koch
                s.swe_houses(dret[1], lat, lng, 'K', cusps, ascmc);
            }
            else if (houseKind == EHouseCalc.CAMPANUS)
            {
                // Campanus
                s.swe_houses(dret[1], lat, lng, 'C', cusps, ascmc);
            }
            else if (houseKind == EHouseCalc.PORPHYRY)
            {
                // Porphyrious
                s.swe_houses(dret[1], lat, lng, 'O', cusps, ascmc);
            }
            else if (houseKind == EHouseCalc.REGIOMONTANUS)
            {
                // Porphyrious
                s.swe_houses(dret[1], lat, lng, 'R', cusps, ascmc);
            }
            else if (houseKind == EHouseCalc.EQUAL)
            {
                // Equal
                s.swe_houses(dret[1], lat, lng, 'E', cusps, ascmc);
            }
            else if (houseKind == EHouseCalc.SOLAR)
            {
                // Solar
                // 太陽の度数をASCとして30度
            }
            else if (houseKind == EHouseCalc.SOLARSIGN)
            {
                // SolarSign
                // 太陽のサインの0度をASCとして30度
            }
            s.swe_close();

            return(cusps);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// planet position calcurate.
        /// </summary>
        /// <param name="timezone">Timezone. JST=9.0</param>
        public List <PlanetData> PositionCalc(DateTime date, double timezone)
        {
            List <PlanetData> planetList = new List <PlanetData>();

            //          s.swe_set_ephe_path(path);
            s.OnLoadFile += (sender, e) => {
                var path = Path.Combine(NSBundle.MainBundle.BundlePath, "Contents", "Resources", "ephe");
                var f    = e.FileName.Split('\\');
                if (File.Exists(path + "/" + f[1]))
                {
                    e.File = new FileStream(path + "/" + f[1], FileMode.Open, FileAccess.Read, FileShare.Read);
                }
            };
            int    utc_year   = 0;
            int    utc_month  = 0;
            int    utc_day    = 0;
            int    utc_hour   = 0;
            int    utc_minute = 0;
            double utc_second = 0;

            double[] dret = { 0.0, 0.0 };
            double[] x    = { 0, 0, 0, 0, 0, 0 };
            string   serr = "";

            s.swe_utc_time_zone(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, timezone,
                                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);

            int flag = SwissEph.SEFLG_SWIEPH | SwissEph.SEFLG_SPEED;

            foreach (int planet_number in Common.CommonData.target_numbers)
            {
                s.swe_calc_ut(dret[1], planet_number, flag, x, ref serr);

                int save_number = planet_number;
                if (planet_number == 100377)
                {
                    save_number = 90377;
                }
                if (planet_number == 146108)
                {
                    save_number = 136108;
                }
                if (planet_number == 146199)
                {
                    save_number = 136199;
                }
                if (planet_number == 146472)
                {
                    save_number = 136472;
                }
                PlanetData p = new PlanetData()
                {
                    no = save_number,
                    absolute_position = x[0],
                    speed             = x[3], // AMATERUでもここ使ってたからたぶん良い
                    aspects0          = new List <AspectInfo>(),
                    aspects1          = new List <AspectInfo>(),
                    aspects2          = new List <AspectInfo>(),
                    aspects3          = new List <AspectInfo>(),
                    aspects4          = new List <AspectInfo>(),
                    aspects5          = new List <AspectInfo>(),
                    aspects6          = new List <AspectInfo>(),
                };
                if (planet_number == CommonData.ZODIAC_NUMBER_ASC ||
                    planet_number == CommonData.ZODIAC_NUMBER_MC ||
                    planet_number == CommonData.ZODIAC_NUMBER_DH_TRUENODE ||
                    planet_number == CommonData.ZODIAC_NUMBER_LILITH ||
                    planet_number == CommonData.ZODIAC_NUMBER_VT ||
                    planet_number == CommonData.ZODIAC_NUMBER_POF
                    )
                {
                    p.sensitive = true;
                }
                else
                {
                    p.sensitive = false;
                }
                planetList.Add(p);
            }
            s.swe_close();
            return(planetList);
        }