src/AircraftTrajectories/Models/Space3D/GeoPoint3D.cs
/// <summary>
/// Calculates the heading to the given GeoPoint 3D
/// </summary>
/// <param name="destination"></param>
/// <returns></returns>
Calculates the heading to the given GeoPoint 3D
Calculates the heading to the given GeoPoint 3D
public double HeadingTo(GeoPoint3D destination)
        {
            var dLon = (destination.Longitude - Longitude) * (Math.PI / 180);
            var dPhi = Math.Log(
                Math.Tan((destination.Latitude * (Math.PI / 180)) / 2 + Math.PI / 4) / Math.Tan((Latitude * (Math.PI / 180)) / 2 + Math.PI / 4));
            if (Math.Abs(dLon) > Math.PI)
                dLon = dLon > 0 ? -(2 * Math.PI - dLon) : (2 * Math.PI + dLon);
            return ((Math.Atan2(dLon, dPhi) * 180 / Math.PI) + 180) % 360;
        }
public double HeadingTo ( GeoPoint3D destination ) { var dLon = ( destination . Longitude - Longitude ) * ( Math . PI / 180 ) ; var dPhi = Math . Log ( Math . Tan ( ( destination . Latitude * ( Math . PI / 180 ) ) / 2 + Math . PI / 4 ) / Math . Tan ( ( Latitude * ( Math . PI / 180 ) ) / 2 + Math . PI / 4 ) ) ; if ( Math . Abs ( dLon ) > Math . PI ) dLon = dLon > 0 ? - ( 2 * Math . PI - dLon ) : ( 2 * Math . PI + dLon ) ; return ( ( Math . Atan2 ( dLon , dPhi ) * 180 / Math . PI ) + 180 ) % 360 ; }
Calculates the heading to the given GeoPoint 3D
Calculates the heading to the given GeoPoint 3D
None
destination
GeoPoint3D
None