Exemplo n.º 1
0
        public CalculationBase(AstroPlace locationData, bool IsWithDetails)
        {
            NakathEndDateTime = null;
            ThithiEndDateTime = null;
            KarnaEndDateTime  = null;
            YogaEndDateTime   = null;
            swissEph.swe_set_topo(locationData.Longitude, locationData.Latitude, 0.0);

            DateTime dateTime = locationData.BirthDateTime;

            LocationData    = locationData;
            CurrentDateTime = dateTime;
            Year            = dateTime.Year;
            Month           = dateTime.Month;
            Day             = dateTime.Day;
            Hour            = dateTime.Hour;
            Minute          = dateTime.Minute;
            Second          = dateTime.Second;
            List <AstroPlanet> pList = (IsWithDetails)? CalculatePlanetPositionWithDetailsOptmized():CalculatePlanetPosition();

            Sun     = pList.Find(x => x.Current == EnumPlanet.Sun);
            Moon    = pList.Find(x => x.Current == EnumPlanet.Moon);
            Mars    = pList.Find(x => x.Current == EnumPlanet.Mars);
            Mercury = pList.Find(x => x.Current == EnumPlanet.Mercury);
            Jupiter = pList.Find(x => x.Current == EnumPlanet.Jupiter);
            Venus   = pList.Find(x => x.Current == EnumPlanet.Venus);
            Saturn  = pList.Find(x => x.Current == EnumPlanet.Saturn);
            Uranus  = pList.Find(x => x.Current == EnumPlanet.Uranus);
            Neptune = pList.Find(x => x.Current == EnumPlanet.Neptune);
            Pluto   = pList.Find(x => x.Current == EnumPlanet.Pluto);
            Rahu    = pList.Find(x => x.Current == EnumPlanet.Rahu);
            Kethu   = pList.Find(x => x.Current == EnumPlanet.Kethu);

            Nakath         = new AstroNakath(this.Moon.Longitude);
            Nakath.EndTime = NakathEndDateTime;
            WeekDay        = new AstroWeekDay((EnumWeekDay)((int)dateTime.DayOfWeek + 1));
            Thithi         = new AstroThithi(new AstroThithi(EnumThithi.Amavasya).ofDeg(this.Sun.Longitude, this.Moon.Longitude));
            Thithi.EndTime = ThithiEndDateTime;
            Yoga           = new AstroYoga(new AstroYoga(EnumYoga.Shula).ofDeg(this.Sun.Longitude, this.Moon.Longitude));
            Yoga.EndTime   = YogaEndDateTime;
            Karna          = new AstroKarna(new AstroKarna(EnumKarana.Balava).ofDeg(this.Sun.Longitude, this.Moon.Longitude));
            Karna.EndTime  = KarnaEndDateTime;

            Horoscope = CalculateHoroscope(pList);
            Horoscope.ExtraDetails = new BirthRasiExtra(Horoscope);
            Horoscope.ExtraDetails.ThithiNumber = Thithi.Current;
            Horoscope.ExtraDetails.IsPura       = (Thithi.ThithiPaksha == EnumPaksha.Krishna);
            Horoscope.Nakath = Nakath;

            Init();
        }
Exemplo n.º 2
0
        private void KarnaEndTime(double[] cusps, AstroPlanet curSun, double orgSunLong, double orgMoonLong, Mod mod360)
        {
            double     karnaEnd     = Math.Truncate(mod360.sub(cusps[0], orgSunLong) / AstroConsts.KaranaLength) * AstroConsts.KaranaLength;
            AstroKarna tempKarna    = new AstroKarna(new AstroKarna(EnumKarana.Balava).ofDeg(curSun.Longitude, cusps[0]));
            AstroKarna currentKarna = new AstroKarna(new AstroKarna(EnumKarana.Balava).ofDeg(orgSunLong, orgMoonLong));

            if (currentKarna.Current != tempKarna.Current)
            {
                double difSpeed   = cusps[3] - curSun.SpeedInLongitude;
                double karTimeDif = ((mod360.sub(cusps[0], curSun.Longitude) - karnaEnd) / ((difSpeed == 0) ? 1 : difSpeed)) * 1440 * -1;
                if (KarnaEndDateTime == null)
                {
                    KarnaEndDateTime = TimeData.JulianToDateTime(tjd_ut, LocationData.TimeZone).AddMinutes(karTimeDif);
                }
            }
        }
Exemplo n.º 3
0
        public void KarnaTestMethod()
        {
            AstroKarna karna  = new AstroKarna(EnumKarana.Balava);
            double     sepDeg = 5.0;
            EnumKarana myKarn = karna.ofDeg(sepDeg);

            Assert.IsTrue(myKarn == EnumKarana.Kimstughna);
            for (int i = 1; i < 8; i++)
            {
                sepDeg += 6;
                myKarn  = karna.ofDeg(sepDeg);
                Assert.IsTrue(myKarn == (EnumKarana)i);
            }
            for (int i = 1; i < 8; i++)
            {
                sepDeg += 6;
                myKarn  = karna.ofDeg(sepDeg);
                Assert.IsTrue(myKarn == (EnumKarana)i);
            }
            for (int i = 1; i < 8; i++)
            {
                sepDeg += 6;
                myKarn  = karna.ofDeg(sepDeg);
                Assert.IsTrue(myKarn == (EnumKarana)i);
            }
            for (int i = 1; i < 8; i++)
            {
                sepDeg += 6;
                myKarn  = karna.ofDeg(sepDeg);
                Assert.IsTrue(myKarn == (EnumKarana)i);
            }
            for (int i = 1; i < 8; i++)
            {
                sepDeg += 6;
                myKarn  = karna.ofDeg(sepDeg);
                Assert.IsTrue(myKarn == (EnumKarana)i);
            }
            for (int i = 1; i < 8; i++)
            {
                sepDeg += 6;
                myKarn  = karna.ofDeg(sepDeg);
                Assert.IsTrue(myKarn == (EnumKarana)i);
            }
            for (int i = 1; i < 8; i++)
            {
                sepDeg += 6;
                myKarn  = karna.ofDeg(sepDeg);
                Assert.IsTrue(myKarn == (EnumKarana)i);
            }
            for (int i = 1; i < 8; i++)
            {
                sepDeg += 6;
                myKarn  = karna.ofDeg(sepDeg);
                Assert.IsTrue(myKarn == (EnumKarana)i);
            }
            sepDeg += 6;
            myKarn  = karna.ofDeg(sepDeg);
            Assert.IsTrue(myKarn == EnumKarana.Sakuna);

            sepDeg += 6;
            myKarn  = karna.ofDeg(sepDeg);
            Assert.IsTrue(myKarn == EnumKarana.Chatushpada);

            sepDeg += 6;
            myKarn  = karna.ofDeg(sepDeg);
            Assert.IsTrue(myKarn == EnumKarana.Naga);
        }