# Navigation.jl

`Navigation.Navigation`

— ModuleCalculate distances, angles, speeds and points for aviation navigation purposes.

All angles are in degrees, distances are standard in meters, and speeds are standard in m/s.

These methods are not to be used for operational purposes.

Implemented Functions:

- distance
- angular_distance
- bearing
- final_bearing
- midpoint
- intermediate_point
- destination_point
- intersection_point
- along
*track*distance - cross
*track*distance - Vground
- head_wind
- cross_wind
- normalize
- closest
*point*to_pole - isinside

Implemented Types:

- Point(ϕ, λ)
- Airspace

Implemented constants:

- Rₑ_m Radius Earth in [m]

Based on:

- source: www.movable-type.co.uk/scripts/latlong.html
- source: edwilliams.org/avform.htm

## Types

`Navigation.Point`

— TypePoint type with latitude `ϕ`

[deg] and longitude `λ`

[deg]

## Functions

`Navigation.Vground`

— Method`Vground(Vtas::Float64, Vwind::Float64, ∠wind::Float64, course::Float64)`

Return the ground speed `Vground`

[m/s] given the `course`

[deg], airspeed `Vtas`

[m/s], wind speed `Vwind`

[m/s] and wind direction (from) `∠wind`

[deg].

source: edwilliams.org/avform.htm

`Navigation.along_track_distance`

— Function`along_track_distance(pos₁::Point, pos₂::Point, pos₃::Point[,radius::Float64=Rₑ_m])`

The `along_track_distance`

from the start point `pos₁`

[deg] to the closest point on the great circle path (defined by points `pos₁`

and `pos₂`

[deg]) to the point `pos₃`

[deg]. Optionally a different `radius`

for the earth can be used.

Source: www.movable-type.co.uk/scripts/latlong.html

`Navigation.along_track_distance`

— Function```
along_track_distance(∠distance₁₃::Float64, cross_track_∠distance::Float64,
[radius::Float64=Rₑ_m])
```

The `along_track_distance`

from the start point `pos₁`

[deg] to the closest point on the great circle path (defined by angular distance `∠distance₁₃`

[deg] between `pos₁`

and `pos₃`

[deg] and the cross track angular distance `cross_track_∠distance`

[deg]) to the point `pos₃`

[deg]. Optionally a different `radius`

for the earth can be used.

Source: www.movable-type.co.uk/scripts/latlong.html

`Navigation.angular_distance`

— Function`angular_distance(distance::Float64[, radius::Float64=Rₑ_m])`

Return the `angular_distance`

in [deg] on a sphere, with an optionally given `radius`

.

Source: www.movable-type.co.uk/scripts/latlong.html

`Navigation.angular_distance`

— Function`angular_distance(pos₁::Point, pos₂::Point, radius::Float64=Rₑ_m)`

Return the `angular_distance`

in [deg] of the great circle line between the positions `pos₁`

[deg] and `pos₂`

[deg] on a sphere, with an optionally given `radius`

.

Source: www.movable-type.co.uk/scripts/latlong.html

`Navigation.bearing`

— Method`bearing(pos₁::Point, pos₂::Point)`

Return the initial `bearing`

[deg] of the great circle line between the positions `pos₁`

and `pos₂`

[deg] on a sphere.

Source: www.movable-type.co.uk/scripts/latlong.html

`Navigation.bearing`

— Method`bearing(section::RouteSection)`

Return the initial `bearing`

[deg] of the route section on a sphere.

Source: www.movable-type.co.uk/scripts/latlong.html

`Navigation.closest_point_to_pole`

— Methodclosest*point*to*pole(starting*point::Point, bearing::Float64)

Given a `starting_point`

[deg] and initial `bearing`

[deg] calculate the closest point [deg] to the next pole encountered.

Source: https://www.movable-type.co.uk/scripts/latlong.html

`Navigation.cross_track_distance`

— Function`cross_track_distance(pos₁::Point, pos₂::Point, pos₃::Point[, radius::Float64=Rₑ_m])`

Return the `cross_track_distance`

[m] from a point `pos₃`

[deg] to a great circle path defined by the points `pos₁`

and `pos₂`

[deg].

Source: www.movable-type.co.uk/scripts/latlong.html

`Navigation.cross_track_distance`

— Function```
cross_track_distance(section::RouteSection, pos₃::Point [,
radius::Float64=Rₑ_m])
```

Return the `cross_track_distance`

[m] from a point `pos₃`

[deg] to a route section.

Source: www.movable-type.co.uk/scripts/latlong.html

`Navigation.cross_track_distance`

— Function```
cross_track_distance(∠distance₁₃::Float64, bearing₁₂::Float64,
bearing₁₃::Float64[, radius::Float64=Rₑ_m])
```

Return the `cross_track_distance`

[m] from a point `pos₃`

[deg] to a great circle path. The distance is calculated using the angular distance between points `pos₁`

and `pos₃`

[deg], the `bearing`

[deg] between points `pos₁`

and `pos₃`

[deg] , the `bearing`

[deg] between points `pos₁`

and `pos₂`

[deg], and the `radius`

of the earth [m].

Source: www.movable-type.co.uk/scripts/latlong.html

`Navigation.cross_track_distance`

— Function`cross_track_distance(pos₁::Point, bearing::Float64, pos₃::Point[, radius::Float64=Rₑ_m])`

Return the `cross_track_distance`

[m] from a point `pos₃`

[deg] to a great circle path defined by the point `pos₁`

and `bearing`

[deg].

Source: www.movable-type.co.uk/scripts/latlong.html

`Navigation.cross_wind`

— Method`cross_wind(Vwind::Float64, ∠wind::Float64, course::Float64)`

Return the `cross_wind`

[m/s] component for a given wind speed `Vwind`

[m/s], `course`

[deg], and wind direction (from) `∠wind`

[deg]. A positive cross-wind component indicates a wind from the right.

source: edwilliams.org/avform.htm

`Navigation.destination_point`

— Function```
destination_point(start_pos::Point, distance::Float64, bearing::Float64[,
radius::Float64=Rₑ_m])
```

Given a `start_pos`

[deg], initial `bearing`

(clockwise from North) [deg], `distance`

[m], and the earth `radius`

[m] calculate the `destination_point`

[deg] travelling along a (shortest distance) great circle arc. (The distance must use the same radius as the radius of the earth.)

Source: www.movable-type.co.uk/scripts/latlong.html

`Navigation.distance`

— Function`distance(section::RouteSection [, radius::Float64=Rₑ_m])`

Return the `distance`

[m] of the great circle line on the route section on a sphere, with an optionally given `radius`

.

Source: www.movable-type.co.uk/scripts/latlong.html

`Navigation.distance`

— Function`distance(pos₁::Point, pos₂::Point[, radius::Float64=Rₑ_m])`

Return the `distance`

[m] of the great circle line between the positions `pos₁`

[deg] and `pos₂`

[deg] on a sphere, with an optionally given `radius`

.

Source: www.movable-type.co.uk/scripts/latlong.html

`Navigation.final_bearing`

— Method`final_bearing(pos₁::Point, pos₂::Point)`

Return the `final_bearing`

[deg] of the great circle line between the positions `pos₁`

and `pos₂`

[deg] on a sphere.

Source: www.movable-type.co.uk/scripts/latlong.html

`Navigation.final_bearing`

— Method`final_bearing(section::RouteSection)`

Return the `final_bearing`

[deg] of the route section on a sphere.

Source: www.movable-type.co.uk/scripts/latlong.html

`Navigation.head_wind`

— Method`head_wind(Vwind::Float64, ∠wind::Float64, course::Float64)`

Return the `head_wind`

[m/s] component for a given wind speed `Vwind`

[m/s], `course`

[deg], and wind direction (from) `∠wind`

[deg]. A tail-wind is a negative head-wind.

source: edwilliams.org/avform.htm

`Navigation.intermediate_point`

— Function`intermediate_point(section::RouteSection [, fraction::Float64 = 0.5])`

Return the `intermediate_point`

(Point) at any `fraction`

along the route section. The fraction along the great circle route is such that `fraction`

= 0.0 is at `pos₁`

and `fraction`

1.0 is at `pos₂`

.

Source: www.movable-type.co.uk/scripts/latlong.html

`Navigation.intermediate_point`

— Function`intermediate_point(pos₁::Point, pos₂::Point[, fraction::Float64 = 0.5])`

Return the `intermediate_point`

[deg] at any `fraction`

along the great circle path between two points with positions `pos₁`

and `pos₂`

[deg]. The fraction along the great circle route is such that `fraction`

= 0.0 is at `pos₁`

[deg] and `fraction`

1.0 is at `pos₂`

[deg].

Source: www.movable-type.co.uk/scripts/latlong.html

`Navigation.intersection_point`

— Method`intersection_point(pos₁::Point, pos₂::Point, airspace::Airspace)`

Return the intersection point `pos₃`

[deg] of a great circle section with an `Airspace`

. The great circle section is defined by two points [deg] `pos₁`

and `pos₂`

[deg].

`Navigation.intersection_point`

— Method`intersection_point(pos₁::Point, pos₂::Point, polygon::Vector{Point{Float64}})`

Return the intersection point `pos₃`

[deg] of a great circle section with a polygon. The great circle section is defined by two points [deg] `pos₁`

and `pos₂`

[deg].

`Navigation.intersection_point`

— Method`intersection_point(pos₁::Point, pos₂::Point, bearing₁₃::Float64, bearing₂₃::Float64)`

Return the intersection point `pos₃`

[deg] of two great circle paths given two start points [deg] `pos₁`

and `pos₂`

[deg] and two bearings [deg] from `pos₁`

to `pos₃`

[deg], and from `pos₂`

to `pos₃`

[deg].

Under certain circumstances the results can be an ∞ or *ambiguous solution*.

Source: edwilliams.org/avform.htm

`Navigation.max_latitude`

— Methodmax_latitude(latitude::Float64, bearing::Float64)

Using Clairaut's formula it is possible to calculate the maximum latitude [deg] of a great circle path, given a `bearing`

[deg] and `latitude`

[deg] on the great circle.

The minimum latitude is -max_latitude

Source: https://www.movable-type.co.uk/scripts/latlong.html

`Navigation.midpoint`

— Method`midpoint(pos₁::Point, pos₂::Point)`

Return the half-way point `midpoint`

[deg] on the great circle line between the positions `pos₁`

and `pos₂`

[deg] on a sphere.

Source: www.movable-type.co.uk/scripts/latlong.html

`Navigation.midpoint`

— Method`midpoint(section::RouteSection)`

Return the half-way point `midpoint`

[deg] on the route section on a sphere.

Source: www.movable-type.co.uk/scripts/latlong.html

`Navigation.opposite_point`

— Methodopposite_point(point::Point)

The point at the opposite site of the Sphere.