コード例 #1
0
        /* solve a spherical triangle:
         *           A
         *          /  \
         *         /    \
         *      c /      \ b
         *       /        \
         *      /          \
         *    B ____________ C
         *           a
         *
         * given A, b, c find B and a in range 0..B..2PI and 0..a..PI, respectively..
         * cap and Bp may be NULL if not interested in either one.
         * N.B. we pass in cos(c) and sin(c) because in many problems one of the sides
         *   remains constant for many values of A and b.
         */
        static void solve_sphere(double A, double b, double cc, double sc, ref double cap, ref double Bp)
        {
            double cb = Math.Cos(b), sb = Math.Sin(b);
            double sA, cA = Math.Cos(A);
            double x, y;
            double ca;
            double B;

            ca = cb * cc + sb * sc * cA;
            if (ca > 1.0)
            {
                ca = 1.0;
            }
            if (ca < -1.0)
            {
                ca = -1.0;
            }
            cap = ca;

            if (sc < 1e-7)
            {
                B = cc < 0 ? A : Math.PI - A;
            }
            else
            {
                sA = Math.Sin(A);
                y  = sA * sb * sc;
                x  = cb - ca * cc;
                B  = Math.Atan2(y, x);
            }

            Bp = AstroConvert.Range2Pi(B);
        }
コード例 #2
0
        public static double FlipDecAxisRadians(double rad)
        {
            if (rad == 0.0)
            {
                return(rad);
            }
            bool   isNegative   = (rad < 0.0);
            double absRad       = AstroConvert.Range2Pi(Math.Abs(rad)); // Converts to an absolute value from 0-360
            double flippedValue = Constants.TWO_PI - absRad;

            if (isNegative)
            {
                flippedValue = flippedValue * -1.0;
            }
            return(flippedValue);
        }
コード例 #3
0
        public static double FlipDecAxisDegrees(double degrees)
        {
            if (degrees == 0.0)
            {
                return(degrees);
            }
            bool   isNegative   = (degrees < 0.0);
            double absDegrees   = AstroConvert.Range360Degrees(Math.Abs(degrees)); // Converts to an absolute value from 0-360
            double flippedValue = 360.0 - absDegrees;

            if (isNegative)
            {
                flippedValue = flippedValue * -1.0;
            }
            return(flippedValue);
        }
コード例 #4
0
 public AltAzCoordinate GetAltAz(double rightAscension, double declination, DateTime when)
 {
     _Transform.JulianDateTT = _Util.DateLocalToJulian(when);
     _Transform.SetTopocentric(rightAscension, declination);
     return(new AltAzCoordinate(_Transform.ElevationTopocentric, AstroConvert.RangeAzimuth(_Transform.AzimuthTopocentric)));
 }