src/AircraftTrajectories/Models/Space3D/GeoPoint3D.cs
/// <summary>
/// Calculates the GeoPoint 3D that is reached with the given distance and heading 
/// </summary>
/// <param name="distance"></param>
/// <param name="heading"></param>
/// <returns></returns>
Calculates the GeoPoint 3D that is reached with the given distance and heading
Calculates the GeoPoint 3D that is reached with the given distance and heading
public GeoPoint3D MoveInDirection(double distance, double heading)
        {
            var R = 6378137;
            var brng = heading * Math.PI / 180;
            var lat1 = Latitude * Math.PI / 180;
            var lon1 = Longitude * Math.PI / 180;
            var lat2 = Math.Asin(Math.Sin(lat1) * Math.Cos(distance / R) +
                 Math.Cos(lat1) * Math.Sin(distance / R) * Math.Cos(brng));
            var lon2 = lon1 + Math.Atan2(Math.Sin(brng) * Math.Sin(distance / R) * Math.Cos(lat1),
                         Math.Cos(distance / R) - Math.Sin(lat1) * Math.Sin(lat2));
            double newLatitude = lat2 / (Math.PI / 180);
            double newLongitude = lon2 / (Math.PI / 180);
            return new GeoPoint3D(newLongitude, newLatitude, Z);
        }
public GeoPoint3D MoveInDirection ( double distance , double heading ) { var R = 6378137 ; var brng = heading * Math . PI / 180 ; var lat1 = Latitude * Math . PI / 180 ; var lon1 = Longitude * Math . PI / 180 ; var lat2 = Math . Asin ( Math . Sin ( lat1 ) * Math . Cos ( distance / R ) + Math . Cos ( lat1 ) * Math . Sin ( distance / R ) * Math . Cos ( brng ) ) ; var lon2 = lon1 + Math . Atan2 ( Math . Sin ( brng ) * Math . Sin ( distance / R ) * Math . Cos ( lat1 ) , Math . Cos ( distance / R ) - Math . Sin ( lat1 ) * Math . Sin ( lat2 ) ) ; double newLatitude = lat2 / ( Math . PI / 180 ) ; double newLongitude = lon2 / ( Math . PI / 180 ) ; return new GeoPoint3D ( newLongitude , newLatitude , Z ) ; }
Calculates the GeoPoint 3D that is reached with the given distance and heading
Calculates the GeoPoint 3D that is reached with the given distance and heading
None
distance
double
None
heading
double
None