Пример #1
0
 public EquatorialCoordinate(Angle ra, Angle dec)
 {
     _ra = ra; _dec = dec;
 }
Пример #2
0
        // All wikipedia below is accessed 7 may 2012

        /// <summary>
        /// Calculates the alt/az coordinates on the specified time and view coordinates
        /// </summary>
        /// <param name="moment"></param>
        /// <param name="longitude"></param>
        /// <param name="latitude"></param>
        /// <returns></returns>
        public HorizontalCoordinate GetHorizontalCoordinate(DateTimeOffset moment, Angle longitude, Angle latitude)
        {
            // Careful reading of http://en.wikipedia.org/wiki/Hour_angle#Relation_with_the_right_ascension
            var hourangle = moment.GreenwichMeanSiderialTime() - longitude - RightAscention;
            // Code adapted from http://en.wikipedia.org/wiki/Horizontal_coordinate_system#equatorial_to_horizontal 20120504
            // This is some sphere trigonometry
            var sinAlt      = sin(latitude) * sin(Declination) + cos(latitude) * cos(Declination) * cos(hourangle);
            var cosAzCosAlt = cos(latitude) * sin(Declination) - sin(latitude) * cos(Declination) * cos(hourangle);
            var sinAzCosAlt = -cos(Declination) * sin(hourangle);

            var radius = Pythagoras(cosAzCosAlt, sinAzCosAlt);
            // Using Atan2 makes sure that the angle from the right quadrant is calculated
            var azimuth  = (Angle)Math.Atan2(sinAzCosAlt, cosAzCosAlt);
            var altitude = (Angle)Math.Atan2(sinAlt, radius);

            var test = Pythagoras(radius, sinAlt);

            return(new HorizontalCoordinate(altitude, azimuth));
        }
Пример #3
0
 public HorizontalCoordinate(Angle alt, Angle az)
 {
     _alt = alt.Normalized; _az = az.Normalized;
 }