Ejemplo n.º 1
0
 public void Reset()
 {
     fidat   = Enumerable.Range(0, SEI_NEPHFILES).Select(i => new file_data()).ToArray();
     savedat = Enumerable.Range(0, SwissEph.SE_NPLANETS + 1).Select(i => new save_positions()).ToArray();
     pldat   = Enumerable.Range(0, SEI_NPLANETS).Select(i => new plan_data()).ToArray();
     nddat   = Enumerable.Range(0, SEI_NNODE_ETC).Select(i => new plan_data()).ToArray();
     topd    = new topo_data();
     dpsi    = new double[36525];
     deps    = new double[36525];
     nut     = new nut();
     nut2000 = new nut();
     nutv    = new nut();
     oec     = new epsilon();
     oec2000 = new epsilon();
 }
Ejemplo n.º 2
0
 public void Reset(bool full)
 {
     if (full)
     {
         fidat   = Enumerable.Range(0, SEI_NEPHFILES).Select(i => new file_data()).ToArray();
         savedat = Enumerable.Range(0, SwissEph.SE_NPLANETS + 1).Select(i => new save_positions()).ToArray();
         pldat   = Enumerable.Range(0, SEI_NPLANETS).Select(i => new plan_data()).ToArray();
         nddat   = Enumerable.Range(0, SEI_NNODE_ETC).Select(i => new plan_data()).ToArray();
         topd    = new topo_data();
         //dpsi = new double[36525];
         //deps = new double[36525];
         astro_models = new Int32[Sweph.SEI_NMODELS];
     }
     oec     = new epsilon();
     oec2000 = new epsilon();
     nut     = new nut();
     nut2000 = new nut();
     nutv    = new nut();
 }
Ejemplo n.º 3
0
        /* transforms the position of the moon in a way we can use it
         * for calculation of osculating node and apogee:
         * precession and nutation (attention to speed vector!)
         * according to flags
         * iflag	flags
         * tjd          time for which the element is computed
         *              i.e. date of ecliptic
         * xx           array equatorial cartesian position and speed
         * serr         error string
         */
        public int swi_plan_for_osc_elem(Int32 iflag, double tjd, CPointer<double> xx)
        {
            int i;
            double[] x = new double[6];
            nut nuttmp = new nut();
            nut nutp = nuttmp;	/* dummy assign, to silence gcc warning */
            epsilon oe = swed.oec;
            epsilon oectmp = new epsilon();
            sid_data sip = new sid_data(); ;
            /* ICRS to J2000 */
            if (0 == (iflag & SwissEph.SEFLG_ICRS) && get_denum(SEI_SUN, iflag) >= 403) {
                SE.SwephLib.swi_bias(xx, tjd, iflag, false);
            }/**/
            /************************************************
             * precession, equator 2000 -> equator of date  *
             * attention: speed vector has to be rotated,   *
             * but daily precession 0.137" may not be added!*/
            /*
            #if SID_TNODE_FROM_ECL_T0
              sid_data sip = &swed.sidd;
              /* For sidereal calculation we need node refered*
               * to ecliptic of t0 of ayanamsa                *
               ************************************************ /
              if (iflag & SEFLG_SIDEREAL) {
            tjd = sip.t0;
            swi_precess(xx, tjd, iflag, J2000_TO_J);
            swi_precess(xx+3, tjd, iflag, J2000_TO_J);
            calc_epsilon(tjd, iflag, &oectmp);
            oe = &oectmp;
              } else if (!(iflag & SEFLG_J2000)) {
            #endif
            swi_precess(xx, tjd, iflag, J2000_TO_J);
            swi_precess(xx + 3, tjd, iflag, J2000_TO_J);
            /* epsilon * /
            if (tjd == swed.oec.teps)
                oe = swed.oec;
            else if (tjd == J2000)
                oe = swed.oec2000;
            else {
                calc_epsilon(tjd, iflag, oectmp);
                oe = oectmp;
            }
            #if SID_TNODE_FROM_ECL_T0
              } else	/* if SEFLG_J2000 * /
            oe = &swed.oec2000;
            #endif
            */

            if (SID_TNODE_FROM_ECL_T0) {
                sip = swed.sidd;
                /* For sidereal calculation we need node refered*
                 * to ecliptic of t0 of ayanamsa                *
                 ************************************************/
                if ((iflag & SwissEph.SEFLG_SIDEREAL) != 0) {
                    tjd = sip.t0;
                    SE.SwephLib.swi_precess(xx, tjd, iflag, J2000_TO_J);
                    SE.SwephLib.swi_precess(xx + 3, tjd, iflag, J2000_TO_J);
                    calc_epsilon(tjd, iflag, oectmp);
                    oe = oectmp;
                } else if (0 == (iflag & SwissEph.SEFLG_J2000)) {
                    SE.SwephLib.swi_precess(xx, tjd, iflag, J2000_TO_J);
                    SE.SwephLib.swi_precess(xx + 3, tjd, iflag, J2000_TO_J);
                    /* epsilon */
                    if (tjd == swed.oec.teps)
                        oe = swed.oec;
                    else if (tjd == J2000)
                        oe = swed.oec2000;
                    else {
                        calc_epsilon(tjd, iflag, oectmp);
                        oe = oectmp;
                    }

                } else	/* if SEFLG_J2000 */
                    oe = swed.oec2000;
            } else {
                SE.SwephLib.swi_precess(xx, tjd, iflag, J2000_TO_J);
                SE.SwephLib.swi_precess(xx + 3, tjd, iflag, J2000_TO_J);
                /* epsilon */
                if (tjd == swed.oec.teps)
                    oe = swed.oec;
                else if (tjd == J2000)
                    oe = swed.oec2000;
                else {
                    calc_epsilon(tjd, iflag, oectmp);
                    oe = oectmp;
                }
            }

            /************************************************
               * nutation                                     *
               * again: speed vector must be rotated, but not *
               * added 'speed' of nutation                    *
               ************************************************/
            if (0 == (iflag & SwissEph.SEFLG_NONUT)) {
                if (tjd == swed.nut.tnut) {
                    nutp = swed.nut;
                } else if (tjd == J2000) {
                    nutp = swed.nut2000;
                } else if (tjd == swed.nutv.tnut) {
                    nutp = swed.nutv;
                } else {
                    nutp = nuttmp;
                    SE.SwephLib.swi_nutation(tjd, iflag, nutp.nutlo);
                    nutp.tnut = tjd;
                    nutp.snut = Math.Sin(nutp.nutlo[1]);
                    nutp.cnut = Math.Cos(nutp.nutlo[1]);
                    nut_matrix(nutp, oe);
                }
                for (i = 0; i <= 2; i++) {
                    x[i] = xx[0] * nutp.matrix[0, i] +
                       xx[1] * nutp.matrix[1, i] +
                       xx[2] * nutp.matrix[2, i];
                }
                /* speed:
                 * rotation only */
                for (i = 0; i <= 2; i++) {
                    x[i + 3] = xx[3] * nutp.matrix[0, i] +
                         xx[4] * nutp.matrix[1, i] +
                         xx[5] * nutp.matrix[2, i];
                }
                for (i = 0; i <= 5; i++)
                    xx[i] = x[i];
            }
            /************************************************
             * transformation to ecliptic                   *
             ************************************************/
            SE.SwephLib.swi_coortrf2(xx, xx, oe.seps, oe.ceps);
            SE.SwephLib.swi_coortrf2(xx + 3, xx + 3, oe.seps, oe.ceps);
            if (SID_TNODE_FROM_ECL_T0 && (iflag & SwissEph.SEFLG_SIDEREAL) != 0) {
                /* subtract ayan_t0 */
                SE.SwephLib.swi_cartpol_sp(xx, xx);
                xx[0] -= sip.ayan_t0;
                SE.SwephLib.swi_polcart_sp(xx, xx);
            } else
                if (0 == (iflag & SwissEph.SEFLG_NONUT)) {
                    SE.SwephLib.swi_coortrf2(xx, xx, nutp.snut, nutp.cnut);
                    SE.SwephLib.swi_coortrf2(xx + 3, xx + 3, nutp.snut, nutp.cnut);
                }
            return (OK);
        }
Ejemplo n.º 4
0
 public void Reset(bool full)
 {
     if (full)
     {
         fidat = Enumerable.Range(0, SEI_NEPHFILES).Select(i => new file_data()).ToArray();
         savedat = Enumerable.Range(0, SwissEph.SE_NPLANETS + 1).Select(i => new save_positions()).ToArray();
         pldat = Enumerable.Range(0, SEI_NPLANETS).Select(i => new plan_data()).ToArray();
         nddat = Enumerable.Range(0, SEI_NNODE_ETC).Select(i => new plan_data()).ToArray();
         topd = new topo_data();
         //dpsi = new double[36525];
         //deps = new double[36525];
         astro_models = new Int32[Sweph.SEI_NMODELS];
     }
     oec = new epsilon();
     oec2000 = new epsilon();
     nut = new nut();
     nut2000 = new nut();
     nutv = new nut();
 }