Esempio n. 1
0
 private void UpdateRotationMatrix(ATime atime)
 {
     if (PaintEnabled)
     {
         Matrix mtxPrec    = Matrix.PrecMatrix(Astro.JD2000, atime.JD);
         Matrix mtxEqt2Ecl = Matrix.RotateX(ATime.GetEp(atime.JD));
         MtxToEcl   = mtxEqt2Ecl.Mul(mtxPrec);
         EpochToEcl = atime.JD;
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Create Precession Matrix
        /// </summary>
        /// <param name="oldEpoch"></param>
        /// <param name="newEpoch"></param>
        /// <returns></returns>
        public static Matrix PrecMatrix(double oldEpoch, double newEpoch)
        {
            double jd           = 0.0;
            bool   swapEpoch    = false;
            bool   outerNewcomb = false;

            if (newEpoch == oldEpoch)
            {
                return(new Matrix(1.0, 0.0, 0.0,
                                  0.0, 1.0, 0.0,
                                  0.0, 0.0, 1.0));
            }

            double T = (oldEpoch - Astro.JD2000) / 36525.0;

            if (T < -PrecLimit || PrecLimit < T)
            {
                swapEpoch = true;
                double temp = newEpoch;
                newEpoch = oldEpoch;
                oldEpoch = temp;
                T        = (oldEpoch - Astro.JD2000) / 36525.0;
            }

            double T2 = T * T;
            double tt, t;

            tt = t = (newEpoch - oldEpoch) / 36525.0;

            if (tt < -PrecLimit)
            {
                outerNewcomb = true;
                t            = -PrecLimit;
                jd           = -PrecLimit * 36525.0 + Astro.JD2000;
            }

            if (PrecLimit < tt)
            {
                outerNewcomb = true;
                t            = PrecLimit;
                jd           = PrecLimit * 36525.0 + Astro.JD2000;
            }

            double t2 = t * t;
            double t3 = t2 * t;

            double zeta0 = ((2306.2181 + 1.39656 * T - 0.000139 * T2) * t + (0.30188 - 0.000344 * T) * t2 + 0.017998 * t3) / 3600.0;
            double zpc   = ((2306.2181 + 1.39656 * T - 0.000139 * T2) * t + (1.09468 + 0.000066 * T) * t2 + 0.018203 * t3) / 3600.0;
            double theta = ((2004.3109 - 0.85330 * T - 0.000217 * T2) * t - (0.42665 + 0.000217 * T) * t2 - 0.041833 * t3) / 3600.0;

            Matrix mtx1, mtx2, mtx3;

            mtx1 = RotateZ((90.0 - zeta0) * Math.PI / 180.0);
            mtx2 = RotateX(theta * Math.PI / 180.0);
            mtx3 = mtx2.Mul(mtx1);
            mtx1 = RotateZ((-90 - zpc) * Math.PI / 180.0);

            Matrix mtxPrec;

            mtxPrec = mtx1.Mul(mtx3);

            if (outerNewcomb)
            {
                double dJd;

                if (tt < -PrecLimit)
                {
                    dJd = (newEpoch - oldEpoch) + PrecLimit * 36525.0;
                }
                else
                {
                    dJd = (newEpoch - oldEpoch) - PrecLimit * 36525.0;
                }

                double precPrm = -dJd / 365.24 * GeneralPrec * Math.PI / 180.0;
                double eps     = ATime.GetEp(jd);
                mtx1    = RotateX(eps);
                mtx2    = RotateZ(precPrm);
                mtx3    = mtx2.Mul(mtx1);
                mtx2    = RotateX(-eps);
                mtx1    = mtx2.Mul(mtx3);
                mtxPrec = mtx1.Mul(mtxPrec);
            }

            if (swapEpoch)
            {
                mtxPrec.Invert();
            }

            return(mtxPrec);
        }