Class: FlightPathUtils
Defined in: src/sdk/flightplan/flightpath/FlightPathUtils.ts:14
Utility class for working with flight path calculations.
Constructors
Constructor
new FlightPathUtils():
FlightPathUtils
Returns
FlightPathUtils
Methods
createEmptyVector()
static
createEmptyVector():FlightPathVector
Defined in: src/sdk/flightplan/flightpath/FlightPathUtils.ts:23
Creates an empty flight path vector.
Returns
An empty flight path vector.
deepCopyVectorArray()
static
deepCopyVectorArray(from
,to
,fromStartIndex
,fromEndIndex
,toStartIndex
):FlightPathVector
[]
Defined in: src/sdk/flightplan/flightpath/FlightPathUtils.ts:652
Performs a deep copy of a flight path vector array into another array.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
from | readonly Readonly <FlightPathVector >[] | undefined | The array to copy from. |
to | FlightPathVector [] | undefined | The array to copy to. |
fromStartIndex | number | 0 | The lowest index in the source array to copy, inclusive. Defaults to zero. |
fromEndIndex | number | from.length | The highest index in the source array to copy, exclusive. Defaults to the length of the source array. |
toStartIndex | number | 0 | The index in the target array to which to copy the lowest copied index in the source array. Each index i copied from the source array will be copied to the index in the target array equal to toStartIndex + i - fromStartIndex . Defaults to zero. |
Returns
The target array, after the copy is complete.
getAlongArcNormalizedDistance()
static
getAlongArcNormalizedDistance(circle
,start
,end
,pos
,tolerance
):number
Defined in: src/sdk/flightplan/flightpath/FlightPathUtils.ts:460
Gets the normalized distance along an arc from a defined start point to a query point. The start, query, and end points will be projected onto the arc's parent circle if they do not already lie on it. The distance is normalized such that 1 equals the arc length from the start point to the end point. A negative distance indicates that the query point lies somewhere before the start of the arc but after the point on the arc's parent circle that is diametrically opposed to the midpoint of the arc.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
circle | ReadonlyGeoCircle | undefined | The arc's parent circle. |
start | Readonly <Omit <Float64Array <ArrayBufferLike >, "set" | "sort" | "copyWithin" >> | LatLonInterface | undefined | The start point of the arc. |
end | Readonly <Omit <Float64Array <ArrayBufferLike >, "set" | "sort" | "copyWithin" >> | LatLonInterface | undefined | The end point of the arc. |
pos | Readonly <Omit <Float64Array <ArrayBufferLike >, "set" | "sort" | "copyWithin" >> | LatLonInterface | undefined | The query point. |
tolerance | number | GeoCircle.ANGULAR_TOLERANCE | The error tolerance, in great-arc radians, when checking if start and query are equal. Defaults to GeoCircle.ANGULAR_TOLERANCE if not specified. |
Returns
number
The normalized distance along the arc from the start point to the query point.
getAlongArcSignedDistance()
static
getAlongArcSignedDistance(circle
,start
,end
,pos
,tolerance
):number
Defined in: src/sdk/flightplan/flightpath/FlightPathUtils.ts:428
Gets the signed distance along an arc from a defined start point to a query point. The start, query, and end points will be projected onto the arc's parent circle if they do not already lie on it. A negative distance indicates that the query point lies somewhere before the start of the arc but after the point on the arc's parent circle that is diametrically opposed to the midpoint of the arc.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
circle | ReadonlyGeoCircle | undefined | The arc's parent circle. |
start | Readonly <Omit <Float64Array <ArrayBufferLike >, "set" | "sort" | "copyWithin" >> | LatLonInterface | undefined | The start point of the arc. |
end | Readonly <Omit <Float64Array <ArrayBufferLike >, "set" | "sort" | "copyWithin" >> | LatLonInterface | undefined | The end point of the arc. |
pos | Readonly <Omit <Float64Array <ArrayBufferLike >, "set" | "sort" | "copyWithin" >> | LatLonInterface | undefined | The query point. |
tolerance | number | GeoCircle.ANGULAR_TOLERANCE | The error tolerance, in great-arc radians, when checking if start and query are equal. Defaults to GeoCircle.ANGULAR_TOLERANCE if not specified. |
Returns
number
The signed distance along the arc from the start point to the query point, in great-arc radians.
getGreatCircleTangentToPath()
static
getGreatCircleTangentToPath(point
,path
,out
):GeoCircle
Defined in: src/sdk/flightplan/flightpath/FlightPathUtils.ts:336
Gets the great circle tangent to a given path at a given tangent point. The tangent circle will contain the tangent point and have the same direction as the path at the tangent point.
Parameters
Parameter | Type | Description |
---|---|---|
point | Readonly <Omit <Float64Array <ArrayBufferLike >, "set" | "sort" | "copyWithin" >> | LatLonInterface | The tangent point. If the point does not lie on the path, it will be projected onto the path. |
path | ReadonlyGeoCircle | The geo circle describing the path. |
out | GeoCircle | A GeoCircle object to which to write the result. |
Returns
The great circle tangent to the specified path at the specified point.
getGreatCircleTangentToVector()
static
getGreatCircleTangentToVector(point
,vector
,out
):GeoCircle
Defined in: src/sdk/flightplan/flightpath/FlightPathUtils.ts:352
Gets the great circle tangent to a given flight path vector at a given tangent point. The tangent circle will contain the tangent point and have the same direction as the vector at the tangent point.
Parameters
Parameter | Type | Description |
---|---|---|
point | Readonly <Omit <Float64Array <ArrayBufferLike >, "set" | "sort" | "copyWithin" >> | LatLonInterface | The tangent point. If the point does not lie on the vector, it will be projected onto the vector. |
vector | FlightPathVector | The flight path vector. |
out | GeoCircle | A GeoCircle object to which to write the result. |
Returns
The great circle tangent to the specified flight path vector at the specified point.
getLegDesiredTurnDirection()
static
getLegDesiredTurnDirection(leg
):undefined
|VectorTurnDirection
Defined in: src/sdk/flightplan/flightpath/FlightPathUtils.ts:151
Gets the desired turn direction defined by a flight plan leg.
Parameters
Parameter | Type | Description |
---|---|---|
leg | FlightPlanLeg | A flight plan leg. |
Returns
undefined
| VectorTurnDirection
The desired turn direction defined by the specified flight plan leg, or undefined
if the leg does not
define a desired turn direction.
getLegFinalCourse()
static
getLegFinalCourse(legCalc
):undefined
|number
Defined in: src/sdk/flightplan/flightpath/FlightPathUtils.ts:174
Gets the final true course of a calculated leg.
Parameters
Parameter | Type | Description |
---|---|---|
legCalc | LegCalculations | A set of leg calculations. |
Returns
undefined
| number
The final true course of the leg, or undefined
if one could not be obtained.
getLegFinalPosition()
static
getLegFinalPosition(legCalc
,out
):undefined
|GeoPoint
Defined in: src/sdk/flightplan/flightpath/FlightPathUtils.ts:161
Gets the final position of a calculated leg.
Parameters
Parameter | Type | Description |
---|---|---|
legCalc | LegCalculations | A set of leg calculations. |
out | GeoPoint | The GeoPoint object to which to write the result. |
Returns
undefined
| GeoPoint
The final position of the leg, or undefined
if one could not be obtained.
getShortestTurnDirection()
static
getShortestTurnDirection(initialCourse
,finalCourse
):undefined
|VectorTurnDirection
Defined in: src/sdk/flightplan/flightpath/FlightPathUtils.ts:253
Gets the direction of a turn from an initial course to a final course that sweeps through the least angular distance.
Parameters
Parameter | Type | Description |
---|---|---|
initialCourse | number | The initial course, in degrees. |
finalCourse | number | The final course, in degrees. |
Returns
undefined
| VectorTurnDirection
The direction of the turn from the specified initial course to final course that sweeps through the
least angular distance, or undefined
if the two courses are exactly equal or exactly 180 degrees apart.
getTangentPointBetweenCircles()
static
getTangentPointBetweenCircles<T
>(circle1
,circle2
,out
):T
Defined in: src/sdk/flightplan/flightpath/FlightPathUtils.ts:400
Gets the point where two tangent geo circles meet.
Type Parameters
Type Parameter |
---|
T extends Float64Array <ArrayBufferLike > | GeoPoint |
Parameters
Parameter | Type | Description |
---|---|---|
circle1 | ReadonlyGeoCircle | The first geo circle. |
circle2 | ReadonlyGeoCircle | The second geo circle. |
out | T | A GeoPoint or 3D vector object to which to write the result. |
Returns
T
The tangent point between the two specified geo circles. If the geo circles are not tangent, then the value of the result is not meaningful.
getTurnCenterFromCircle()
static
getTurnCenterFromCircle<T
>(circle
,out
):T
Defined in: src/sdk/flightplan/flightpath/FlightPathUtils.ts:233
Gets the center of a turn described by a circle.
Type Parameters
Type Parameter |
---|
T extends Float64Array <ArrayBufferLike > | GeoPoint |
Parameters
Parameter | Type | Description |
---|---|---|
circle | ReadonlyGeoCircle | The geo circle describing the turn. |
out | T | A GeoPoint or 3D vector object to which to write the result. |
Returns
T
The center of a turn described by the circle.
getTurnCircle()
static
getTurnCircle(center
,radius
,turnDirection
,out
):GeoCircle
Defined in: src/sdk/flightplan/flightpath/FlightPathUtils.ts:191
Gets the circle describing the path of a turn.
Parameters
Parameter | Type | Description |
---|---|---|
center | Readonly <Omit <Float64Array <ArrayBufferLike >, "set" | "sort" | "copyWithin" >> | LatLonInterface | The center of the turn. |
radius | number | The radius of the turn, in great-arc radians. |
turnDirection | VectorTurnDirection | The direction of the turn. |
out | GeoCircle | A GeoCircle object to which to write the result. |
Returns
The circle describing the path of the turn.
getTurnCircleStartingFromPath()
static
getTurnCircleStartingFromPath(start
,path
,turnRadius
,turnDirection
,out
):GeoCircle
Defined in: src/sdk/flightplan/flightpath/FlightPathUtils.ts:370
Calculates and returns a circle describing a turn starting from a path at a specified point.
Parameters
Parameter | Type | Description |
---|---|---|
start | Readonly <Omit <Float64Array <ArrayBufferLike >, "set" | "sort" | "copyWithin" >> | LatLonInterface | The starting point of the turn. |
path | ReadonlyGeoCircle | The circle describing the path from which the turn starts. |
turnRadius | number | The radius of the turn, in great-arc radians. |
turnDirection | VectorTurnDirection | The direction of the turn. |
out | GeoCircle | A GeoCircle object to which to write the result. |
Returns
The circle describing the path of the specified turn.
getTurnDirectionFromCircle()
static
getTurnDirectionFromCircle(circle
):VectorTurnDirection
Defined in: src/sdk/flightplan/flightpath/FlightPathUtils.ts:214
Gets the direction of a turn described by a circle.
Parameters
Parameter | Type | Description |
---|---|---|
circle | ReadonlyGeoCircle | The geo circle describing the turn. |
Returns
The direction of the turn described by the circle.
getTurnRadiusFromCircle()
static
getTurnRadiusFromCircle(circle
):number
Defined in: src/sdk/flightplan/flightpath/FlightPathUtils.ts:223
Gets the radius of a turn described by a circle.
Parameters
Parameter | Type | Description |
---|---|---|
circle | ReadonlyGeoCircle | The geo circle describing the turn. |
Returns
number
The radius of the turn described by the circle, in great-arc radians.
getVectorFinalCourse()
static
getVectorFinalCourse(vector
):number
Defined in: src/sdk/flightplan/flightpath/FlightPathUtils.ts:138
Gets the final true course bearing of a flight path vector.
Parameters
Parameter | Type | Description |
---|---|---|
vector | Readonly <FlightPathVector > | A flight path vector. |
Returns
number
The final true course bearing of the vector, or undefined
if one could not be calculated.
getVectorInitialCourse()
static
getVectorInitialCourse(vector
):number
Defined in: src/sdk/flightplan/flightpath/FlightPathUtils.ts:126
Gets the initial true course bearing of a flight path vector.
Parameters
Parameter | Type | Description |
---|---|---|
vector | Readonly <FlightPathVector > | A flight path vector. |
Returns
number
The initial true course bearing of the vector, or undefined if one could not be calculated.
getVectorTurnDirection()
static
getVectorTurnDirection(vector
):VectorTurnDirection
Defined in: src/sdk/flightplan/flightpath/FlightPathUtils.ts:108
Gets the direction of a turn described by a flight path circle vector.
Parameters
Parameter | Type | Description |
---|---|---|
vector | Readonly <FlightPathVector > | The flight path circle vector describing the turn. |
Returns
The direction of the turn described by the flight path circle vector.
getVectorTurnRadius()
static
getVectorTurnRadius(vector
):number
Defined in: src/sdk/flightplan/flightpath/FlightPathUtils.ts:117
Gets the radius of a turn described by a flight path circle vector.
Parameters
Parameter | Type | Description |
---|---|---|
vector | Readonly <FlightPathVector > | The flight path circle vector describing the turn. |
Returns
number
The radius of the turn described by the flight path circle vector, in great-arc radians.
isPointAlongArc()
Call Signature
static
isPointAlongArc(circle
,start
,end
,pos
,inclusive?
,tolerance?
):boolean
Defined in: src/sdk/flightplan/flightpath/FlightPathUtils.ts:493
Checks if a point lies between the start and end points of an arc along a geo circle. The start, end, and query points will be projected onto the arc's parent circle if they do not already lie on it.
Parameters
Parameter | Type | Description |
---|---|---|
circle | ReadonlyGeoCircle | The arc's parent circle. |
start | Readonly <Omit <Float64Array <ArrayBufferLike >, "set" | "sort" | "copyWithin" >> | LatLonInterface | The start point of the arc. |
end | Readonly <Omit <Float64Array <ArrayBufferLike >, "set" | "sort" | "copyWithin" >> | LatLonInterface | The end point of the arc. |
pos | Readonly <Omit <Float64Array <ArrayBufferLike >, "set" | "sort" | "copyWithin" >> | LatLonInterface | The query point. |
inclusive? | boolean | Whether the arc includes the start and end points. Defaults to true . |
tolerance? | number | The error tolerance, in great-arc radians. Defaults to GeoCircle.ANGULAR_TOLERANCE. |
Returns
boolean
Whether the query point lies between the start and end points of the specified arc.
Call Signature
static
isPointAlongArc(circle
,start
,angularWidth
,pos
,inclusive?
,tolerance?
):boolean
Defined in: src/sdk/flightplan/flightpath/FlightPathUtils.ts:512
Checks if a point lies between the start and end points (inclusive) of an arc along a geo circle. The start and query points will be projected onto the arc's parent circle if they do not already lie on it.
Parameters
Parameter | Type | Description |
---|---|---|
circle | ReadonlyGeoCircle | The arc's parent circle. |
start | Readonly <Omit <Float64Array <ArrayBufferLike >, "set" | "sort" | "copyWithin" >> | LatLonInterface | The start point of the arc. |
angularWidth | number | The angular width of the arc, in radians. |
pos | Readonly <Omit <Float64Array <ArrayBufferLike >, "set" | "sort" | "copyWithin" >> | LatLonInterface | The query point. |
inclusive? | boolean | Whether the arc includes the start and end points. Defaults to true . |
tolerance? | number | The error tolerance, in great-arc radians. Defaults to GeoMath.ANGULAR_TOLERANCE. |
Returns
boolean
Whether the query point lies between the start and end points (inclusive) of the specified arc.
isVectorGreatCircle()
static
isVectorGreatCircle(vector
):boolean
Defined in: src/sdk/flightplan/flightpath/FlightPathUtils.ts:89
Checks whether a circle vector describes a great-circle path.
Parameters
Parameter | Type | Description |
---|---|---|
vector | Readonly <FlightPathVector > | A flight path circle vector. |
Returns
boolean
Whether the vector describes a great-circle path.
pathAngleDistance()
static
pathAngleDistance(initialPath
,finalPath
,point
,turnDirection
,tolerance
):number
Defined in: src/sdk/flightplan/flightpath/FlightPathUtils.ts:275
Gets the angular distance, in radians, swept when turning from an initial path to a final path at a given point.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
initialPath | ReadonlyGeoCircle | undefined | The initial path. |
finalPath | ReadonlyGeoCircle | undefined | The final path. |
point | Readonly <Omit <Float64Array <ArrayBufferLike >, "set" | "sort" | "copyWithin" >> | LatLonInterface | undefined | The point at which to turn from the initial path to the final path. Must lie on both paths. |
turnDirection | null | VectorTurnDirection | undefined | The direction in which to turn from the initial path to the final path, or null to choose the turn direction that results in the smallest angular distance. |
tolerance | number | GeoMath.ANGULAR_TOLERANCE | The error tolerance, in great-arc radians, to use when checking whether point lies on both initialPath and finalPath . Defaults to GeoMath.ANGULAR_TOLERANCE. |
Returns
number
The angular distance, in radians, swept when turning from the specified initial path to the final path at
the specified point, or NaN
if an angular distance could not be calculated.
Throws
Error if point
does not lie on both initialPath
and finalPath
.
projectVelocityToCircle()
Call Signature
static
projectVelocityToCircle(speed
,position
,bearing
,projectTo
):number
Defined in: src/sdk/flightplan/flightpath/FlightPathUtils.ts:569
Projects an instantaneous velocity at a point along a bearing onto a geo circle.
The projected velocity is defined as the limit as dt goes to 0 of:
distance( project(p(0)), project(p(dt)) ) / dt
p(0)
is the position at which the velocity to project is measured.p(x)
returnsp(0)
offset by the velocity to project afterx
time has elapsed.project(x)
projectsx
onto the geo circle onto which the velocity is to be projected.distance(x, y)
returns the distance fromx
toy
along the geo circle onto which the velocity is to be projected, in the range(-c / 2, c / 2]
, wherec
is the circumference of the geo circle.
Parameters
Parameter | Type | Description |
---|---|---|
speed | number | The magnitude of the velocity to project. |
position | Readonly <Omit <Float64Array <ArrayBufferLike >, "set" | "sort" | "copyWithin" >> | LatLonInterface | The position at which the velocity is measured. |
bearing | number | The true bearing, in degrees, defining the direction of the velocity to project. |
projectTo | ReadonlyGeoCircle | The geo circle to which to project the velocity. |
Returns
number
The signed magnitude of the velocity projected onto the specified geo circle. A positive sign indicates the projected velocity follows the same direction as the circle, while a negative sign indicates the projected velocity follows the opposite direction as the circle.
Call Signature
static
projectVelocityToCircle(speed
,position
,path
,projectTo
):number
Defined in: src/sdk/flightplan/flightpath/FlightPathUtils.ts:595
Projects an instantaneous velocity at a point along a geo circle onto another geo circle.
The projected velocity is defined as the limit as dt goes to 0 of:
distance( project(p(0)), project(p(dt)) ) / dt
p(0)
is the position at which the velocity to project is measured.p(x)
returnsp(0)
offset by the velocity to project afterx
time has elapsed.project(x)
projectsx
onto the geo circle onto which the velocity is to be projected.distance(x, y)
returns the distance fromx
toy
along the geo circle onto which the velocity is to be projected, in the range(-c / 2, c / 2]
, wherec
is the circumference of the geo circle.
Parameters
Parameter | Type | Description |
---|---|---|
speed | number | The magnitude of the velocity to project. |
position | Readonly <Omit <Float64Array <ArrayBufferLike >, "set" | "sort" | "copyWithin" >> | LatLonInterface | The position at which the velocity is measured. |
path | GeoCircle | The geo circle defining the path parallel to the velocity to project. |
projectTo | ReadonlyGeoCircle | The geo circle to which to project the velocity. |
Returns
number
The signed magnitude of the velocity projected onto the specified geo circle. A positive sign indicates the projected velocity follows the same direction as the circle, while a negative sign indicates the projected velocity follows the opposite direction as the circle.
resolveIngressToEgress()
static
resolveIngressToEgress<T
>(legCalc
):T
Defined in: src/sdk/flightplan/flightpath/FlightPathUtils.ts:683
Resolves the ingress to egress vectors for a set of flight plan leg calculations. This operation will populate the
ingressToEgress
array with a sequence of vectors connecting the ingress transition to the egress transition
while following the flight path defined by the vectors in the flightPath
array.
Type Parameters
Type Parameter |
---|
T extends LegCalculations |
Parameters
Parameter | Type | Description |
---|---|---|
legCalc | T | A set of flight plan leg calculations. |
Returns
T
The flight plan leg calculations, after the ingress to egress vectors have been resolved.
reverseTurnCircle()
static
reverseTurnCircle(circle
,out
):GeoCircle
Defined in: src/sdk/flightplan/flightpath/FlightPathUtils.ts:205
Reverses the direction of a turn circle while keeping the turn center and turn radius constant.
Parameters
Parameter | Type | Description |
---|---|---|
circle | ReadonlyGeoCircle | The turn circle to reverse. |
out | GeoCircle | A GeoCircle object to which to write the result. |
Returns
A turn circle which has the same turn center and turn radius, but the opposite direction as circle
.
setGeoCircleFromVector()
static
setGeoCircleFromVector(vector
,out
):GeoCircle
Defined in: src/sdk/flightplan/flightpath/FlightPathUtils.ts:99
Sets the parameters of a GeoCircle from a flight path circle vector.
Parameters
Parameter | Type | Description |
---|---|---|
vector | Readonly <FlightPathVector > | A flight path circle vector. |
out | GeoCircle | The GeoCircle to set. |
Returns
The GeoCircle, after its parameters have been set.
setVectorFromCircle()
static
setVectorFromCircle(vector
,circle
,start
,end
,flags
,heading
,isHeadingTrue
):FlightPathVector
Defined in: src/sdk/flightplan/flightpath/FlightPathUtils.ts:53
Sets the parameters of a flight path vector using a GeoCircle.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
vector | FlightPathVector | undefined | The fligh path vector to set. |
circle | ReadonlyGeoCircle | undefined | The GeoCircle defining the vector's path. |
start | Readonly <Omit <Float64Array <ArrayBufferLike >, "set" | "sort" | "copyWithin" >> | LatLonInterface | undefined | The start of the vector. |
end | Readonly <Omit <Float64Array <ArrayBufferLike >, "set" | "sort" | "copyWithin" >> | LatLonInterface | undefined | The end of the vector. |
flags | number | undefined | The flags to set on the vector. |
heading | null | number | null | The heading-to-fly to assign to the vector, in degrees, or null if no heading is to be assigned. Defaults to null . |
isHeadingTrue | boolean | false | Whether the heading-to-fly assigned to the vector is relative to true north instead of magnetic north. Defaults to false . |
Returns
The circle vector, after its parameters have been set.