Пример #1
0
        public EnumRelationshipTypes RelationshipWith(AstroNakath nakath)
        {
            IntCircle nakCycle = new IntCircle(27, this.CurrentInt);
            Mod       nakMod   = new Mod(27);
            int       id       = nakMod.sub(nakath.CurrentInt, this.CurrentInt);

            /*  var id = Math.Abs((this.CurrentInt < nakath.CurrentInt) ?
             *   27 - (this.CurrentInt - nakath.CurrentInt) :
             *   nakath.CurrentInt - this.CurrentInt) + 1;*/

            return((EnumRelationshipTypes)(((id % 9) == 0) ? 15 : id % 9 + 15));
        }
Пример #2
0
        public int ofRasi(EnumRasi rasi)
        {
            IntCircle circle = new IntCircle(12, (int)rasi);

            return(circle.Minus(CurrentInt));
        }
Пример #3
0
        public Horoscope CalculateHoroscope(List <AstroPlanet> pList)
        {
            swissEph.swe_set_ephe_path("C:\\SWEPH\\EPHE");

            DateTime dt    = new DateTime(Year, Month, Day, Hour, Minute, Second);
            TimeData tData = new TimeData(AstroPlace.GetUniversalTime(dt, LocationData.Longitude));

            tjd_ut = tData.JulianDateTime;

            double[] cusps = new double[13];
            double[] ascmc = new double[10];
            // cusps - the end point of a house
            swissEph.swe_houses_ex(tjd_ut, SwissEph.SEFLG_SIDEREAL, LocationData.Latitude, LocationData.Longitude, 'A', cusps, ascmc);
            Horoscope horoScope = new Horoscope();
            Mod       mod       = new Mod(360);

            int lagna = 0;

            // postion starts from 1
            for (int i = 1; i < cusps.Length; i++)
            {
                if ((cusps[i] > 0) && (cusps[i] < 30))
                {
                    lagna = i;
                }
            }
            if (lagna == 0)
            {
                for (int i = 1; i < cusps.Length; i++)
                {
                    if ((cusps[i] > 0) && (cusps[i] < 35))
                    {
                        lagna = i;
                    }
                }
            }

            int j = 0;

            horoScope.RasiHouseList  = new List <AstroRasi>();
            horoScope.BhavaHouseList = new List <AstroBhava>();
            IntCircle intCycle       = new IntCircle(12, lagna);
            double    lagnaAscendant = cusps[lagna];
            double    bIncrement     = 30.0;

            while (j != 12)
            {
                // The 14 is used as the adjustment required to
                // get the right lagna integer from the lagna integer
                AstroRasi rasi = new AstroRasi((EnumRasi)intCycle.ValueMinusCurrent(14));
                rasi.AscendentDegrees            = cusps[intCycle.Current];
                rasi.AscendentDegreesFromMesha   = (intCycle.Current == 1) ? 0.0 : mod.sub(cusps[1], cusps[intCycle.Current]) + cusps[intCycle.Current];
                rasi.RasiEndDegreesFromMesha     = (intCycle.Current == 1) ? 0.0 : mod.sub(cusps[1], cusps[intCycle.Current]);
                rasi.RasiEndDegreesFromHorizon   = cusps[intCycle.Current];
                rasi.RasiStartDegreesFromMesha   = (intCycle.Previous == 1) ? 360.0 : mod.sub(cusps[1], cusps[intCycle.Previous]);
                rasi.RasiStartDegreesFromHorizon = cusps[intCycle.Previous];
                rasi.RasiMidDegreesFromMesha     = (rasi.RasiStartDegreesFromMesha + rasi.RasiEndDegreesFromMesha) / 2.0;
                rasi.LengthDegrees = mod.sub(rasi.RasiEndDegreesFromMesha, rasi.RasiStartDegreesFromMesha);
                rasi.Length        = rasi.LengthDegrees;
                rasi.HouseNumber   = j + 1;
                foreach (AstroPlanet planet in pList)
                {
                    if (planet.Longitude >= rasi.RasiEndDegreesFromMesha &&
                        planet.Longitude <= rasi.RasiStartDegreesFromMesha ||
                        ((rasi.RasiStartDegreesFromMesha < rasi.RasiEndDegreesFromMesha) &&
                         (((planet.Longitude <= rasi.RasiStartDegreesFromMesha) && (planet.Longitude >= 0)) ||
                          ((planet.Longitude >= rasi.RasiEndDegreesFromMesha) && (planet.Longitude <= 360)))))
                    {
                        planet.Rasi             = rasi;
                        planet.AjustedLongitude = mod.sub(planet.Longitude, rasi.RasiEndDegreesFromMesha);
                        rasi.Planets.Add(planet);
                        horoScope.RasiPlanetList.Add(planet);
                    }
                }
                horoScope.RasiHouseList.Add(rasi);

                AstroBhava bhava = new AstroBhava();

                Bhava30DegreeStartingFromHorizon(pList, cusps, horoScope, mod, j, bIncrement, bhava);

                if (lagna == intCycle.Current)
                {
                    horoScope.LagnaRasi   = rasi;
                    horoScope.NavamsaRasi = new AstroRasi(AstroBase.GetNawamsaRasi(rasi.AscendentDegreesFromMesha));
                }
                intCycle.GoBackward();
                j++;
                bIncrement = mod.sub(bIncrement, 30.0);
                if (j == 12)
                {
                    break;
                }
            }

            return(horoScope);
        }