Пример #1
0
        /*********************************************************************/
        /*                                                                   */
        /*   finds next time when starts next yoga                           */
        /*                                                                   */
        /*   timezone is not changed                                         */
        /*                                                                   */
        /*   return value: index of yoga 0..26                               */
        /*                 or -1 if failed                                   */
        /*********************************************************************/

        public static int GetNextStart(GPGregorianTime startDate, out GPGregorianTime nextDate)
        {
            double          phi = 40 / 3.0;
            double          l1, l2, sunl;
            double          jday = startDate.getJulianGreenwichTime();
            double          xj;
            double          ayanamsa  = GPAyanamsa.GetAyanamsa(jday);
            GPMoon          moon      = new GPMoon();
            GPGregorianTime d         = new GPGregorianTime(startDate);
            GPGregorianTime xd        = new GPGregorianTime(startDate.getLocationProvider());
            double          scan_step = 0.5;
            int             prev_tit  = 0;
            int             new_tit   = -1;

            moon.MoonCalc(jday);
            sunl     = GPSun.GetSunLongitude(jday);
            l1       = GPMath.putIn360(moon.longitude_deg + sunl - 2 * ayanamsa);
            prev_tit = Convert.ToInt32(Math.Floor(l1 * 3 / 40.0));

            int counter = 0;

            while (counter < 20)
            {
                xj = jday;
                xd.Copy(d);

                jday += scan_step;
                d.setDayHours(d.getDayHours() + scan_step);
                if (d.getDayHours() > 1.0)
                {
                    d.setDayHours(d.getDayHours() - 1.0);
                    d.NextDay();
                }

                moon.MoonCalc(jday);
                //SunPosition(d, ed, sun, d.shour - 0.5 + d.tzone/24.0);
                //l2 = put_in_360(moon.longitude_deg - sun.longitude_deg - 180.0);
                sunl = GPSun.GetSunLongitude(jday);
                l2   = GPMath.putIn360(moon.longitude_deg + sunl - 2 * ayanamsa);
                //Debugger.Log(0, "", "Current position: " + l2/12.0 + "   date: " + jday + "\n");
                new_tit = Convert.ToInt32(Math.Floor(l2 / phi));

                if (prev_tit != new_tit)
                {
                    jday = xj;
                    d.Copy(xd);
                    scan_step *= 0.5;
                    counter++;
                    continue;
                }
                else
                {
                    l1 = l2;
                }
            }
            nextDate = d;
            //	nextDate.shour += startDate.tzone / 24.0;
            //	nextDate.NormalizeValues();
            return(new_tit);
        }
Пример #2
0
        protected double calculatePosition()
        {
            pMoon.MoonCalc(pJulianDate);
            pLastSunLongitude = GPSun.GetSunLongitude(pJulianDate);
            double l1 = GPMath.putIn360(pMoon.longitude_deg - pLastSunLongitude - opositeLongitude);

            return(GPMath.putIn180(l1));
        }
Пример #3
0
        /*********************************************************************/
        /*                                                                   */
        /*   finds previous time when starts next yoga                       */
        /*                                                                   */
        /*   timezone is not changed                                         */
        /*                                                                   */
        /*   return value: index of yoga 0..26                               */
        /*                 or -1 if failed                                   */
        /*********************************************************************/

        public static int GetPrevStart(GPGregorianTime startDate, out GPGregorianTime nextDate)
        {
            double          phi = 12.0;
            double          l1, l2, sunl;
            double          jday = startDate.getJulianGreenwichTime();
            double          xj;
            double          ayanamsa  = GPAyanamsa.GetAyanamsa(jday);
            GPMoon          moon      = new GPMoon();
            GPGregorianTime d         = new GPGregorianTime(startDate);
            GPGregorianTime xd        = new GPGregorianTime(startDate.getLocationProvider());
            double          scan_step = 0.5;
            int             prev_tit  = 0;
            int             new_tit   = -1;

            moon.MoonCalc(jday);
            sunl     = GPSun.GetSunLongitude(jday);
            l1       = GPMath.putIn360(moon.longitude_deg + sunl - 2 * ayanamsa);
            prev_tit = Convert.ToInt32(Math.Floor(l1 / phi));

            int counter = 0;

            while (counter < 20)
            {
                xj = jday;
                xd.Copy(d);

                jday -= scan_step;
                d.setDayHours(d.getDayHours() - scan_step);
                if (d.getDayHours() < 0.0)
                {
                    d.setDayHours(d.getDayHours() + 1.0);
                    d.PreviousDay();
                }

                moon.MoonCalc(jday);
                sunl    = GPSun.GetSunLongitude(jday);
                l2      = GPMath.putIn360(moon.longitude_deg + sunl - 2 * ayanamsa);
                new_tit = Convert.ToInt32(Math.Floor(l2 / phi));

                if (prev_tit != new_tit)
                {
                    jday = xj;
                    d.Copy(xd);
                    scan_step *= 0.5;
                    counter++;
                    continue;
                }
                else
                {
                    l1 = l2;
                }
            }
            nextDate = d;
            //	nextDate.shour += startDate.tzone / 24.0;
            //	nextDate.NormalizeValues();
            return(new_tit);
        }
Пример #4
0
        public override double calculatePosition()
        {
            pMoon.MoonCalc(pJulianDate);
            //pSun.calculateCoordinates(pStartDate, pStartDate.getLocation(), pStartDate.getDayHours());
            //	SunPosition(d, ed, sun, d.shour - 0.5 + d.tzone/24.0);
            double l1 = GPMath.putIn360(pMoon.longitude_deg - /*pSun.eclipticalLongitude*/
                                        GPSun.GetSunLongitude(pJulianDate) - 180.0);

            return(l1 / 12.0);
        }
Пример #5
0
        /*********************************************************************/
        /*  Finds next time when rasi is changed                             */
        /*                                                                   */
        /*  startDate - starting date and time, timezone member must be valid */
        /*  zodiac [out] - found zodiac sign into which is changed           */
        /*                                                                   */
        /*********************************************************************/

        public static GPGregorianTime GetNextSankranti(GPGregorianTime startDate, out int zodiac)
        {
            GPGregorianTime d;
            double          step = 1.0;
            int             count = 0;
            double          ld, prev;
            int             prev_rasi, new_rasi;
            GPGregorianTime prevday = new GPGregorianTime(startDate.getLocation());

            zodiac = 0;
            d      = new GPGregorianTime(startDate);
            double jdate = d.getJulianGreenwichTime();

            prev      = GPMath.putIn360(GPSun.GetSunLongitude(jdate) - GPAyanamsa.GetAyanamsa(jdate));
            prev_rasi = Convert.ToInt32(Math.Floor(prev / 30.0));

            while (count < 20)
            {
                prevday.Copy(d);
                d.setDayHours(d.getDayHours() + step);
                if (d.getDayHours() > 1.0)
                {
                    d.setDayHours(d.getDayHours() - 1.0);
                    d.NextDay();
                }
                jdate    = d.getJulianGreenwichTime();
                ld       = GPMath.putIn360(GPSun.GetSunLongitude(jdate) - GPAyanamsa.GetAyanamsa(jdate));
                new_rasi = Convert.ToInt32(Math.Floor(ld / 30.0));

                if (prev_rasi != new_rasi)
                {
                    zodiac = new_rasi;
                    //v uplynulom dni je sankranti
                    step *= 0.5;
                    d.Copy(prevday);
                    count++;
                    continue;
                }
            }

            return(d);
        }
Пример #6
0
        public override double calculatePosition()
        {
            double prev = GPMath.putIn360(GPSun.GetSunLongitude(pJulianDate) - GPAyanamsa.GetAyanamsa(pJulianDate));

            return(prev / 30.0);
        }