/// <summary>
        /// Initial course of great circle going to coordinate
        ///
        /// From http://williams.best.vwh.net/avform.htm:
        ///
        /// mod
        /// ( atan2
        ///   ( sin(lon1-lon2) * cos(lat2)
        ///   , cos(lat1)*sin(lat2) - sin(lat1)*cos(lat2)*cos(lon1-lon2)
        ///   )
        /// , 2*pi
        /// )
        /// </summary>
        /// <param name="coordinate">Target coordinate that we want to travel to</param>
        /// <returns>initial bearing</returns>
        public Bearing InitialCourse(Coordinate coordinate)
        {
            // TODO: resolve edge case: close to the poles
            // if (Latitude.Cos() < .0001)
            //  return Latitude.Hemisphere == Latitude.HemisphereType.North ? Bearing.South : Bearing.North;

            return(new Bearing(Angle.Atan2((Longitude - coordinate.Longitude).Sin() * coordinate.Latitude.Cos(), Latitude.Cos() * coordinate.Latitude.Sin() -
                                           Latitude.Sin() * coordinate.Latitude.Cos() * (Longitude - coordinate.Longitude).Cos())));
        }
        /// <summary>
        /// lat =asin(sin(lat1)*cos(d)+cos(lat1)*sin(d)*cos(tc))
        /// dlon=atan2(sin(tc)*sin(d)*cos(lat1),cos(d)-sin(lat1)*sin(lat))
        /// lon=mod( lon1-dlon +pi,2*pi )-pi
        /// </summary>
        /// <param name="coordinate"></param>
        /// <returns></returns>
        public Coordinate GreatCircle(Coordinate coordinate)
        {
            var latitude = new Latitude(
                Angle.Asin(coordinate.Latitude.Sin() * Distance.Cos() + coordinate.Latitude.Cos() * Distance.Sin() * Bearing.Cos()));

            var dlon = Angle.Atan2(Bearing.Sin() * Distance.Sin() * coordinate.Latitude.Cos(),
                                   Distance.Cos() - coordinate.Latitude.Sin() * latitude.Sin());

            var longitude = new Longitude((coordinate.Longitude - dlon + Angle.Pi) % (2 * Angle.Pi) - Angle.Pi);

            return(new Coordinate(latitude, longitude));
        }
 public Angle Atan2()
 {
     return(Angle.Atan2(X, Y));
 }