Class: NavMath
Navigational mathematics functions.
Constructors
constructor
• new NavMath(): NavMath
Returns
Methods
alongTrack
▸ alongTrack(start
, end
, pos
): number
Calculates the along-track distance from a starting point to another point along a great-circle track running through the starting point.
Parameters
Name | Type | Description |
---|---|---|
start | LatLonInterface | The start of the great-circle track. |
end | LatLonInterface | The end of the great-circle track. |
pos | LatLonInterface | The point for which to calculate the along-track distance. |
Returns
number
The along-track distance, in nautical miles.
Defined in
src/sdk/geo/NavMath.ts:252
angleToHeading
▸ angleToHeading(angle
, turnDirection
): number
Converts a degrees north turn circle angle to a degrees north heading.
Parameters
Name | Type | Description |
---|---|---|
angle | number | The turn circle angle to convert. |
turnDirection | "left" | "right" | The direction of the turn. |
Returns
number
A degrees north heading.
Defined in
src/sdk/geo/NavMath.ts:208
bankAngle
▸ bankAngle(airspeedTrue
, radius
): number
Gets the required bank angle for a given true airspeed and turn radius.
Parameters
Name | Type | Description |
---|---|---|
airspeedTrue | number | The true airspeed of the plane, in knots. |
radius | number | The airplane turn radius, in meters. |
Returns
number
The required bank angle, in degrees.
Defined in
src/sdk/geo/NavMath.ts:65
bearingIsBetween
▸ bearingIsBetween(bearing
, start
, end
): boolean
Checks if a degrees north bearing is between two other degrees north bearings.
Parameters
Name | Type | Description |
---|---|---|
bearing | number | The bearing in degrees north to check. |
start | number | The start bearing in degrees north. |
end | number | The end bearing, in degrees north. |
Returns
boolean
True if the bearing is between the two provided bearings, false otherwise.
Defined in
src/sdk/geo/NavMath.ts:185
calculateArcDistance
▸ calculateArcDistance(startBearing
, endBearing
, radius
): number
Calculates the distance along an arc on Earth's surface. The arc begins at the intersection of the great circle
passing through the center of a circle of radius radius
meters in the direction of 'startBearing', and ends at
the intersection of the great circle passing through the center of the circle in the direction of 'endBearing',
proceeding clockwise (as viewed from above).
Parameters
Name | Type | Description |
---|---|---|
startBearing | number | The degrees of the start of the arc. |
endBearing | number | The degrees of the end of the arc. |
radius | number | The radius of the arc, in meters. |
Returns
number
The arc distance.
Defined in
src/sdk/geo/NavMath.ts:108
circleIntersection
▸ circleIntersection(x1
, y1
, x2
, y2
, cx
, cy
, r
, sRef
): 0
| 2
| 1
Calculates the intersection of a line and a circle.
Parameters
Name | Type | Description |
---|---|---|
x1 | number | The start x of the line. |
y1 | number | The start y of the line. |
x2 | number | The end x of the line. |
y2 | number | The end y of the line. |
cx | number | The circle center x. |
cy | number | The circle center y. |
r | number | The radius of the circle. |
sRef | CircleIntersection | The reference to the solution object to write the solution to. |
Returns
0
| 2
| 1
The number of solutions (0, 1 or 2).
Defined in
src/sdk/geo/NavMath.ts:126
clamp
▸ clamp(val
, min
, max
): number
Clamps a value to a min and max.
Parameters
Name | Type | Description |
---|---|---|
val | number | The value to clamp. |
min | number | The minimum value to clamp to. |
max | number | The maximum value to clamp to. |
Returns
number
The clamped value.
Defined in
src/sdk/geo/NavMath.ts:21
crossTrack
▸ crossTrack(start
, end
, pos
): number
Calculates the cross track deviation from the provided leg fixes.
Parameters
Name | Type | Description |
---|---|---|
start | LatLonInterface | The location of the starting fix of the leg. |
end | LatLonInterface | The location of the ending fix of the leg. |
pos | LatLonInterface | The current plane location coordinates. |
Returns
number
The amount of cross track deviation, in nautical miles.
Defined in
src/sdk/geo/NavMath.ts:234
crossTrackArc
▸ crossTrackArc(center
, radius
, pos
): number
Gets the cross track distance for a given arc.
Parameters
Name | Type | Description |
---|---|---|
center | LatLonInterface | The center of the arc. |
radius | number | The radius of the arc, in meters. |
pos | LatLonInterface | The current plane position. |
Returns
number
The cross track distance, in NM.
Defined in
src/sdk/geo/NavMath.ts:341
degreesNorthToPolar
▸ degreesNorthToPolar(degrees
): number
Converts degrees north to polar radians.
Parameters
Name | Type | Description |
---|---|---|
degrees | number | The degrees to convert. |
Returns
number
The angle radians, in polar.
Defined in
src/sdk/geo/NavMath.ts:94
desiredTrack
▸ desiredTrack(start
, end
, pos
): number
Calculates the desired track from the provided leg fixes.
Parameters
Name | Type | Description |
---|---|---|
start | LatLonInterface | The location of the starting fix of the leg. |
end | LatLonInterface | The location of the ending fix of the leg. |
pos | LatLonInterface | The current plane location coordinates. |
Returns
number
The desired track, in degrees true.
Defined in
src/sdk/geo/NavMath.ts:270
desiredTrackArc
▸ desiredTrackArc(center
, turnDirection
, pos
): number
Gets the desired track for a given arc.
Parameters
Name | Type | Description |
---|---|---|
center | LatLonInterface | The center of the arc. |
turnDirection | "left" | "right" | The direction of the turn. |
pos | LatLonInterface | The current plane position. |
Returns
number
The desired track.
Defined in
src/sdk/geo/NavMath.ts:287
diffAngle
▸ diffAngle(a
, b
): number
Gets the total difference in degrees between two angles.
Parameters
Name | Type | Description |
---|---|---|
a | number | The first angle. |
b | number | The second angle. |
Returns
number
The difference between the two angles, in degrees.
Defined in
src/sdk/geo/NavMath.ts:351
getTurnDirection
▸ getTurnDirection(startCourse
, endCourse
): "left"
| "right"
Get the turn direction for a given course change.
Parameters
Name | Type | Description |
---|---|---|
startCourse | number | The start course. |
endCourse | number | The end course. |
Returns
"left"
| "right"
The turn direction for the course change.
Defined in
src/sdk/geo/NavMath.ts:76
headingToAngle
▸ headingToAngle(heading
, turnDirection
): number
Converts a degrees north heading to a degrees north turn circle angle.
Parameters
Name | Type | Description |
---|---|---|
heading | number | The heading to convert. |
turnDirection | "left" | "right" | The direction of the turn. |
Returns
number
A degrees north turn circle angle.
Defined in
src/sdk/geo/NavMath.ts:198
napierSide
▸ napierSide(b
, c
, beta
, gamma
): number
Finds side a given sides b, c, and angles beta, gamma.
Parameters
Name | Type | Description |
---|---|---|
b | number | The length of side b, as a trigonometric ratio. |
c | number | The length of side c, as a trigonometric ratio. |
beta | number | The angle, in radians, of the opposite of side b. |
gamma | number | The angle, in radians, of the opposite of side c |
Returns
number
The length of side a, as a trigonometric ratio.
Defined in
src/sdk/geo/NavMath.ts:370
normal
▸ normal(course
, turnDirection
, outVector
): void
Calculates a normal vector to a provided course in degrees north.
Parameters
Name | Type | Description |
---|---|---|
course | number | The course in degrees north. |
turnDirection | "left" | "right" | The direction of the turn to orient the normal. |
outVector | Float64Array | The normal vector for the provided course. |
Returns
void
Defined in
src/sdk/geo/NavMath.ts:381
normalizeHeading
▸ normalizeHeading(heading
): number
Normalizes a heading to a 0-360 range.
Parameters
Name | Type | Description |
---|---|---|
heading | number | The heading to normalize. |
Returns
number
The normalized heading.
Defined in
src/sdk/geo/NavMath.ts:30
northAngle
▸ northAngle(cx
, cy
, x
, y
): number
Gets the degrees north that a point lies on a circle.
Parameters
Name | Type | Description |
---|---|---|
cx | number | The x point of the center of the circle. |
cy | number | The y point of the center of the circle. |
x | number | The x point to get the bearing for. |
y | number | The y point to get the bearing for. |
Returns
number
The angle in degrees north that the point is relative to the center.
Defined in
src/sdk/geo/NavMath.ts:174
percentAlongTrackArc
▸ percentAlongTrackArc(start
, end
, center
, turnDirection
, pos
): number
Gets the percentage along the arc path that the plane currently is.
Parameters
Name | Type | Description |
---|---|---|
start | number | The start of the arc, in degrees north. |
end | number | The end of the arc, in degrees north. |
center | LatLonInterface | The center location of the arc. |
turnDirection | "left" | "right" | The direction of the turn. |
pos | LatLonInterface | The current plane position. |
Returns
number
The percentage along the arc the plane is.
Defined in
src/sdk/geo/NavMath.ts:302
polarToDegreesNorth
▸ polarToDegreesNorth(radians
): number
Converts polar radians to degrees north.
Parameters
Name | Type | Description |
---|---|---|
radians | number | The radians to convert. |
Returns
number
The angle, in degrees north.
Defined in
src/sdk/geo/NavMath.ts:85
positionAlongArc
▸ positionAlongArc(start
, center
, radius
, turnDirection
, distance
, out
): GeoPoint
Gets a position given an arc and a distance from the arc start.
Parameters
Name | Type | Description |
---|---|---|
start | number | The start bearing of the arc. |
center | GeoPoint | The center of the arc. |
radius | number | The radius of the arc. |
turnDirection | "left" | "right" | The turn direction for the arc. |
distance | number | The distance along the arc to get the position for. |
out | GeoPoint | The position to write to. |
Returns
The position along the arc that was written to.
Defined in
src/sdk/geo/NavMath.ts:324
reciprocateHeading
▸ reciprocateHeading(heading
): number
Inverts a heading value by adding 180 and normalizing.
Parameters
Name | Type | Description |
---|---|---|
heading | number | The heading to invert/reciprocate. |
Returns
number
The inverted/reciprocated heading.
Defined in
src/sdk/geo/NavMath.ts:44
turnRadius
▸ turnRadius(airspeedTrue
, bankAngle
): number
Gets the turn radius for a given true airspeed.
Parameters
Name | Type | Description |
---|---|---|
airspeedTrue | number | The true airspeed of the plane, in knots. |
bankAngle | number | The bank angle of the plane, in degrees. |
Returns
number
The airplane turn radius, in meters.
Defined in
src/sdk/geo/NavMath.ts:54
windCorrectionAngle
▸ windCorrectionAngle(course
, airspeedTrue
, windDirection
, windSpeed
): number
Calculates the wind correction angle.
Parameters
Name | Type | Description |
---|---|---|
course | number | The current plane true course. |
airspeedTrue | number | The current plane true airspeed. |
windDirection | number | The direction of the wind, in degrees true. |
windSpeed | number | The current speed of the wind. |
Returns
number
The calculated wind correction angle.
Defined in
src/sdk/geo/NavMath.ts:220