コード例 #1
0
        private static double CalcAltOffset(Vect3 horz0, PairA scope0, Vect3 horz1, PairA scope1)
        {
            double cosA1A2 = Math.Cos(scope0.Azm - scope1.Azm);
            double den     = 1 - cosA1A2;

            if (den == 0)
            {
                throw new ApplicationException("Error2");
            }

            double x = (Math.Cos(scope0.Alt - scope1.Alt) * (cosA1A2 + 1) - 2 * Vect3.SMul(horz0, horz1)) / den;

            if (x < -1 || x > 1)
            {
                throw new ApplicationException("Error3");
            }

            return((-Math.Acos(x) + scope0.Alt + scope1.Alt) / 2);
        }
コード例 #2
0
        private static double CalcRotationAngle(Vect3 n, Vect3 a0, Vect3 a1)
        {
            double an = Vect3.SMul(a0, n);

            return(Math.Atan2(Vect3.SMul(n, Vect3.VMul(a0, a1)), Vect3.SMul(a0, a1) - an * an));
        }