Exemplo n.º 1
0
        private void CalculatePlanetRasi(int bodyId, GCLocation loc, GregorianDateTime vcEnd, GregorianDateTime vcAdd, GCConfigRatedEvents rec)
        {
            int    nData;
            double JD, JDE;

            JD    = vcAdd.GetJulian() - 0.5 - loc.OffsetUtcHours / 24.0;
            JDE   = vcEnd.GetJulian() + 0.5 - loc.OffsetUtcHours / 24.0;
            nData = GCMath.IntFloor(GCMath.putIn360(GCVSOPAstronomy.GetPlanetLongitude(bodyId, JD) - GCAyanamsha.GetAyanamsa(JD)) / 30.0);

            // initial rasi at the start date 00:00
            AddRating(JD, loc, rec.rateGrahaRasi[bodyId, nData], rec.rateGrahaRasi[bodyId, Prev(nData, 12)]);

            while ((JD = FindNextRasiChange(JD, JDE, bodyId, out nData)) < JDE)
            {
                AddRating(JD, loc, rec.rateGrahaRasi[bodyId, nData], rec.rateGrahaRasi[bodyId, Prev(nData, 12)]);
                JD += 1.0;
            }
        }
Exemplo n.º 2
0
        private void CalculatePlanetHouse(int bodyId, GCLocation loc, GregorianDateTime vcEnd, GregorianDateTime vcAdd, GCConfigRatedEvents rec)
        {
            int         nData;
            double      JD, JDE;
            GCEarthData earth = loc.GetEarthData();

            JD  = vcAdd.GetJulian() - 0.5 - loc.OffsetUtcHours / 24.0;
            JDE = vcEnd.GetJulian() + 0.5 - loc.OffsetUtcHours / 24.0;

            // initial rasi at the start date 00:00
            nData = GCMath.IntFloor(GetPlanetHouse(GCVSOPAstronomy.GetPlanetLongitude(bodyId, JD), JD, earth));
            AddRating(JD, loc, rec.rateGrahaHouse[bodyId, nData], rec.rateGrahaHouse[bodyId, Prev(nData, 12)]);

            while ((JD = FindNextHouseChange(JD, JDE, bodyId, earth, out nData)) < JDE)
            {
                AddRating(JD, loc, rec.rateGrahaHouse[bodyId, nData], rec.rateGrahaHouse[bodyId, Prev(nData, 12)]);
                JD += 1.0 / 24.0;
            }
        }
Exemplo n.º 3
0
        public double FindNextHouseChange(double startJD, double endJD, int bodyId, GCEarthData earth, out int nNextHouse)
        {
            double jd = startJD;
            double A, B, B1;
            int    C, D;
            double step = 1.0 / 24.0;

            A   = GetPlanetHouse(GCVSOPAstronomy.GetPlanetLongitude(bodyId, jd), jd, earth);
            jd += step;
            B1  = A;
            B   = GetPlanetHouse(GCVSOPAstronomy.GetPlanetLongitude(bodyId, jd), jd, earth);
            C   = GCMath.IntFloor(A);
            D   = GCMath.IntFloor(B);

            while (jd < endJD && Math.Abs(B1 - B) >= 1 / 86400.0)
            {
                if (C == D)
                {
                    // goto next date
                    A = B;
                    C = D;
                }
                else if (C < D)
                {
                    jd    = jd - step;
                    step *= (D - A) / (B - A);
                }
                else // C > D
                {
                    jd    = jd - step;
                    step *= (A - C) / (A - B);
                }

                jd += step;
                B1  = B;
                B   = GetPlanetHouse(GCVSOPAstronomy.GetPlanetLongitude(bodyId, jd), jd, earth);
                D   = GCMath.IntFloor(B);
            }

            nNextHouse = GCMath.IntFloor(GetPlanetHouse(GCVSOPAstronomy.GetPlanetLongitude(bodyId, jd + 0.5 / 24.0), jd + 0.5 / 24.0, earth));
            return(jd);
        }
Exemplo n.º 4
0
        public double FindNextRasiChange(double startJD, double endJD, int bodyId, out int nNextRasi)
        {
            double jd = startJD;
            double A, B, B1;
            int    C, D;
            double step = 1.0;

            A   = (GCVSOPAstronomy.GetPlanetLongitude(bodyId, jd) - GCAyanamsha.GetAyanamsa(jd)) / 30.0;
            jd += step;
            B1  = A;
            B   = (GCVSOPAstronomy.GetPlanetLongitude(bodyId, jd) - GCAyanamsha.GetAyanamsa(jd)) / 30.0;
            C   = GCMath.IntFloor(A);
            D   = GCMath.IntFloor(B);

            while (jd < endJD && Math.Abs(B1 - B) >= 1 / 86400.0)
            {
                if (C == D)
                {
                    // goto next date
                    A = B;
                    C = D;
                }
                else if (C < D)
                {
                    jd    = jd - step;
                    step *= (D - A) / (B - A);
                }
                else // C > D
                {
                    jd    = jd - step;
                    step *= (C - B) / (A - B);
                }

                jd += step;
                B1  = B;
                B   = (GCVSOPAstronomy.GetPlanetLongitude(bodyId, jd) - GCAyanamsha.GetAyanamsa(jd)) / 30.0;
                D   = GCMath.IntFloor(B);
            }

            nNextRasi = GCMath.IntFloor((GCVSOPAstronomy.GetPlanetLongitude(bodyId, jd + 0.1) - GCAyanamsha.GetAyanamsa(jd)) / 30.0);
            return(jd);
        }