Class: GeoCircle
A circle on Earth's surface, defined as the set of points on the Earth's surface equidistant (as measured geodetically) from a central point.
Constructors
constructor
• new GeoCircle(center
, radius
): GeoCircle
Constructor.
Parameters
Name | Type | Description |
---|---|---|
center | Readonly <Omit <Float64Array , "set" | "sort" | "copyWithin" >> | The center of the new small circle, represented as a position vector in the standard geographic cartesian reference system. |
radius | number | The radius of the new small circle in great-arc radians. |
Returns
Defined in
src/sdk/geo/GeoCircle.ts:29
Properties
ANGULAR_TOLERANCE
▪ Static
Readonly
ANGULAR_TOLERANCE: 1e-7
Defined in
src/sdk/geo/GeoCircle.ts:11
Accessors
center
• get
center(): Readonly
<Omit
<Float64Array
, "set"
| "sort"
| "copyWithin"
>>
The center of this circle.
Returns
Readonly
<Omit
<Float64Array
, "set"
| "sort"
| "copyWithin"
>>
Defined in
src/sdk/geo/GeoCircle.ts:37
radius
• get
radius(): number
The radius of this circle, in great-arc radians.
Returns
number
Defined in
src/sdk/geo/GeoCircle.ts:45
Methods
angleAlong
▸ angleAlong(start
, end
, tolerance?
, equalityTolerance?
): number
Gets the angular distance along an arc between two points that lie on this circle. The arc extends from the first point to the second in a counterclockwise direction when viewed from above the center of the circle.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
start | Readonly <Omit <Float64Array , "set" | "sort" | "copyWithin" >> | LatLonInterface | undefined | A point on this circle which marks the beginning of an arc. |
end | Readonly <Omit <Float64Array , "set" | "sort" | "copyWithin" >> | LatLonInterface | undefined | A point on this circle which marks the end of an arc. |
tolerance | number | GeoCircle.ANGULAR_TOLERANCE | The error tolerance, in great-arc radians, when checking if start and end lie on this circle. Defaults to GeoCircle.ANGULAR_TOLERANCE if not specified. |
equalityTolerance | number | 0 | The angular tolerance for considering the start and end points to be equal, in radians. If the absolute (direction-agnostic) angular distance between the start and end points is less than or equal to this value, then the zero will be returned. Defaults to 0 . |
Returns
number
the angular width of the arc between the two points, in radians.
Throws
Error if either point does not lie on this circle.
Defined in
src/sdk/geo/GeoCircle.ts:248
angularWidth
▸ angularWidth(length
): number
Calculates the central angle which subtends an arc along this circle of given length.
Parameters
Name | Type | Description |
---|---|---|
length | number | An arc length, in great-arc radians. |
Returns
number
The central angle which subtends an arc along this circle of the given length, in radians.
Defined in
src/sdk/geo/GeoCircle.ts:72
arcLength
▸ arcLength(angle
): number
Calculates the length of an arc along this circle subtended by a central angle.
Parameters
Name | Type | Description |
---|---|---|
angle | number | A central angle, in radians. |
Returns
number
The length of the arc subtended by the angle, in great-arc radians.
Defined in
src/sdk/geo/GeoCircle.ts:63
bearingAt
▸ bearingAt(point
, tolerance?
): number
Calculates the true bearing along this circle at a point on the circle.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
point | Readonly <Omit <Float64Array , "set" | "sort" | "copyWithin" >> | LatLonInterface | undefined | A point on this circle. |
tolerance | number | GeoCircle.ANGULAR_TOLERANCE | The error tolerance, in great-arc radians, when checking if point lies on this circle. Defaults to GeoCircle.ANGULAR_TOLERANCE if not specified. |
Returns
number
the bearing along this circle at the point.
Throws
Error if the point does not lie on this circle.
Defined in
src/sdk/geo/GeoCircle.ts:309
closest
▸ closest(point
, out
): Float64Array
Finds the closest point on this circle to a specified point. In other words, projects the specified point onto this circle. If the specified point is equidistant from all points on this circle (i.e. it is coincident with or antipodal to this circle's center), NaN will be written to all fields of the result.
Parameters
Name | Type | Description |
---|---|---|
point | Readonly <Omit <Float64Array , "set" | "sort" | "copyWithin" >> | LatLonInterface | A point, represented as either a position vector or lat/long coordinates. |
out | Float64Array | A Float64Array object to which to write the result. |
Returns
Float64Array
The closest point on this circle to the specified point.
Defined in
src/sdk/geo/GeoCircle.ts:159
▸ closest(point
, out
): GeoPoint
Finds the closest point on this circle to a specified point. In other words, projects the specified point onto this circle. If the specified point is equidistant from all points on this circle (i.e. it is coincident with or antipodal to this circle's center), NaN will be written to all fields of the result.
Parameters
Name | Type | Description |
---|---|---|
point | Readonly <Omit <Float64Array , "set" | "sort" | "copyWithin" >> | LatLonInterface | A point, represented as either a position vector or lat/long coordinates. |
out | GeoPoint | A GeoPoint object to which to write the result. |
Returns
The closest point on this circle to the specified point.
Defined in
src/sdk/geo/GeoCircle.ts:168
distance
▸ distance(point
): number
Calculates and returns the great-circle distance from a specified point to the closest point that lies on this circle. In other words, calculates the shortest distance from a point to this circle. The distance is signed, with positive distances representing deviation away from the center of the circle, and negative distances representing deviation toward the center of the circle.
Parameters
Name | Type | Description |
---|---|---|
point | Readonly <Omit <Float64Array , "set" | "sort" | "copyWithin" >> | LatLonInterface | A point, represented as either a position vector or lat/long coordinates. |
Returns
number
the great circle distance, in great-arc radians, from the point to the closest point on this circle.
Defined in
src/sdk/geo/GeoCircle.ts:202
distanceAlong
▸ distanceAlong(start
, end
, tolerance?
, equalityTolerance?
): number
Gets the distance along an arc between two points that lie on this circle. The arc extends from the first point to the second in a counterclockwise direction when viewed from above the center of the circle.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
start | Readonly <Omit <Float64Array , "set" | "sort" | "copyWithin" >> | LatLonInterface | undefined | A point on this circle which marks the beginning of an arc. |
end | Readonly <Omit <Float64Array , "set" | "sort" | "copyWithin" >> | LatLonInterface | undefined | A point on this circle which marks the end of an arc. |
tolerance | number | GeoCircle.ANGULAR_TOLERANCE | The error tolerance, in great-arc radians, when checking if start and end lie on this circle. Defaults to GeoCircle.ANGULAR_TOLERANCE if not specified. |
equalityTolerance | number | 0 | The tolerance for considering the start and end points to be equal, in great-arc radians. If the absolute (direction-agnostic) along-arc distance between the start and end points is less than or equal to this value, then the zero will be returned. Defaults to 0 . |
Returns
number
the length of the arc between the two points, in great-arc radians.
Throws
Error if either point does not lie on this circle.
Defined in
src/sdk/geo/GeoCircle.ts:292
encircles
▸ encircles(point
, inclusive?
, tolerance?
): boolean
Checks whether a point lies within the boundary defined by this circle. This is equivalent to checking whether the distance of the point from the center of this circle is less than or equal to this circle's radius.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
point | Readonly <Omit <Float64Array , "set" | "sort" | "copyWithin" >> | LatLonInterface | undefined | A point, represented as either a position vector or lat/long coordinates. |
inclusive | boolean | true | Whether points that lie on this circle should pass the check. True by default. |
tolerance | number | GeoCircle.ANGULAR_TOLERANCE | The error tolerance, in great-arc radians, of this operation. Defaults to GeoCircle.ANGULAR_TOLERANCE if not specified. |
Returns
boolean
whether the point lies within the boundary defined by this circle.
Defined in
src/sdk/geo/GeoCircle.ts:228
includes
▸ includes(point
, tolerance?
): boolean
Checks whether a point lies on this circle.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
point | Readonly <Omit <Float64Array , "set" | "sort" | "copyWithin" >> | LatLonInterface | undefined | A point, represented as either a position vector or lat/long coordinates. |
tolerance | number | GeoCircle.ANGULAR_TOLERANCE | The error tolerance, in great-arc radians, of this operation. Defaults to GeoCircle.ANGULAR_TOLERANCE if not specified. |
Returns
boolean
whether the point lies on this circle.
Defined in
src/sdk/geo/GeoCircle.ts:214
intersection
▸ intersection(other
, out
): number
Calculates and returns the set of intersection points between this circle and another one, and writes the results to an array of position vectors.
Parameters
Name | Type | Description |
---|---|---|
other | GeoCircle | The other circle to test for intersections. |
out | Float64Array [] | An array in which to store the results. The results will be stored at indexes 0 and 1. If these indexes are empty, then new Float64Array objects will be created and inserted into the array. |
Returns
number
The number of solutions written to the out array. Either 0, 1, or 2.
Defined in
src/sdk/geo/GeoCircle.ts:478
intersectionGeoPoint
▸ intersectionGeoPoint(other
, out
): number
Calculates and returns the set of intersection points between this circle and another one, and writes the results to an array of GeoPoint objects.
Parameters
Name | Type | Description |
---|---|---|
other | GeoCircle | The other circle to test for intersections. |
out | GeoPoint [] | An array in which to store the results. The results will be stored at indexes 0 and 1. If these indexes are empty, then new GeoPoint objects will be created and inserted into the array. |
Returns
number
The number of solutions written to the out array. Either 0, 1, or 2.
Defined in
src/sdk/geo/GeoCircle.ts:551
isGreatCircle
▸ isGreatCircle(): boolean
Checks whether this circle is a great circle, or equivalently, whether its radius is equal to pi / 2 great-arc radians.
Returns
boolean
Whether this circle is a great circle.
Defined in
src/sdk/geo/GeoCircle.ts:54
numIntersectionPoints
▸ numIntersectionPoints(other
, tolerance?
): number
Calculates and returns the number of intersection points between this circle and another one. Returns NaN if there are an infinite number of intersection points.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
other | GeoCircle | undefined | The other circle to test for intersections. |
tolerance | number | GeoCircle.ANGULAR_TOLERANCE | The error tolerance, in great-arc radians, of this operation. Defaults to GeoCircle.ANGULAR_TOLERANCE if not specified. |
Returns
number
the number of intersection points between this circle and the other one.
Defined in
src/sdk/geo/GeoCircle.ts:570
offsetAngleAlong
▸ offsetAngleAlong(point
, angle
, out
, tolerance?
): Float64Array
Offsets a point on this circle by a specified angular distance. The direction of the offset for positive distances is counterclockwise when viewed from above the center of this circle.
Parameters
Name | Type | Description |
---|---|---|
point | Readonly <Omit <Float64Array , "set" | "sort" | "copyWithin" >> | LatLonInterface | The point to offset. |
angle | number | The angular distance by which to offset, in radians. |
out | Float64Array | A Float64Array object to which to write the result. |
tolerance? | number | The error tolerance, in great-arc radians, when checking if point lies on this circle. Defaults to GeoCircle.ANGULAR_TOLERANCE if not specified. |
Returns
Float64Array
The offset point.
Throws
Error if the point does not lie on this circle.
Defined in
src/sdk/geo/GeoCircle.ts:375
▸ offsetAngleAlong(point
, angle
, out
, tolerance?
): GeoPoint
Offsets a point on this circle by a specified angular distance. The direction of the offset for positive distances is counterclockwise when viewed from above the center of this circle.
Parameters
Name | Type | Description |
---|---|---|
point | Readonly <Omit <Float64Array , "set" | "sort" | "copyWithin" >> | LatLonInterface | The point to offset. |
angle | number | The angular distance by which to offset, in radians. |
out | GeoPoint | A GeoPoint object to which to write the result. |
tolerance? | number | The error tolerance, in great-arc radians, when checking if point lies on this circle. Defaults to GeoCircle.ANGULAR_TOLERANCE if not specified. |
Returns
The offset point.
Throws
Error if the point does not lie on this circle.
Defined in
src/sdk/geo/GeoCircle.ts:387
offsetDistanceAlong
▸ offsetDistanceAlong(point
, distance
, out
, tolerance?
): Float64Array
Offsets a point on this circle by a specified distance. The direction of the offset for positive distances is counterclockwise when viewed from above the center of this circle.
Parameters
Name | Type | Description |
---|---|---|
point | Readonly <Omit <Float64Array , "set" | "sort" | "copyWithin" >> | LatLonInterface | The point to offset. |
distance | number | The distance by which to offset, in great-arc radians. |
out | Float64Array | A Float64Array object to which to write the result. |
tolerance? | number | The error tolerance, in great-arc radians, when checking if point lies on this circle. Defaults to GeoCircle.ANGULAR_TOLERANCE if not specified. |
Returns
Float64Array
The offset point.
Throws
Error if the point does not lie on this circle.
Defined in
src/sdk/geo/GeoCircle.ts:340
▸ offsetDistanceAlong(point
, distance
, out
, tolerance?
): GeoPoint
Offsets a point on this circle by a specified distance. The direction of the offset for positive distances is counterclockwise when viewed from above the center of this circle.
Parameters
Name | Type | Description |
---|---|---|
point | Readonly <Omit <Float64Array , "set" | "sort" | "copyWithin" >> | LatLonInterface | The point to offset. |
distance | number | The distance by which to offset, in great-arc radians. |
out | GeoPoint | A GeoPoint object to which to write the result. |
tolerance? | number | The error tolerance, in great-arc radians, when checking if point lies on this circle. Defaults to GeoCircle.ANGULAR_TOLERANCE if not specified. |
Returns
The offset point.
Throws
Error if the point does not lie on this circle.
Defined in
src/sdk/geo/GeoCircle.ts:352
reverse
▸ reverse(): this
Reverses the direction of this circle. This sets the center of the circle to its antipode and the radius to its
complement with Math.PI
.
Returns
this
This circle, after it has been reversed.
Defined in
src/sdk/geo/GeoCircle.ts:129
set
▸ set(center
, radius
): this
Sets the center and radius of this circle.
Parameters
Name | Type | Description |
---|---|---|
center | Readonly <Omit <Float64Array , "set" | "sort" | "copyWithin" >> | LatLonInterface | The new center. |
radius | number | The new radius in great-arc radians. |
Returns
this
this circle, after it has been changed.
Defined in
src/sdk/geo/GeoCircle.ts:82
setAsGreatCircle
▸ setAsGreatCircle(point1
, point2
): this
Sets this circle to be a great circle which contains two given points. There are two possible great circles that contain any two unique points; these circles differ only by their directionality (equivalently, the sign of their normal vectors). The order of points passed to this method and the right-hand rule determines which of the two is returned.
Parameters
Name | Type | Description |
---|---|---|
point1 | Readonly <Omit <Float64Array , "set" | "sort" | "copyWithin" >> | LatLonInterface | The first point that lies on the great circle. |
point2 | Readonly <Omit <Float64Array , "set" | "sort" | "copyWithin" >> | LatLonInterface | The second point that lies on the great circle. |
Returns
this
this circle, after it has been changed.
Defined in
src/sdk/geo/GeoCircle.ts:109
▸ setAsGreatCircle(point
, bearing
): this
Sets this circle to be a great circle defined by a point and bearing offset, equivalent to the path projected from the point with the specified initial bearing (forward azimuth).
Parameters
Name | Type | Description |
---|---|---|
point | Readonly <Omit <Float64Array , "set" | "sort" | "copyWithin" >> | LatLonInterface | A point that lies on the great circle. |
bearing | number | The initial bearing from the point. |
Returns
this
this circle, after it has been changed.
Defined in
src/sdk/geo/GeoCircle.ts:117
createFromPoint
▸ createFromPoint(point
, radius
): GeoCircle
Creates a new small circle from a lat/long coordinate pair and radius.
Parameters
Name | Type | Description |
---|---|---|
point | LatLonInterface | The center of the new small circle. |
radius | number | The radius of the new small circle, in great-arc radians. |
Returns
a small circle.
Defined in
src/sdk/geo/GeoCircle.ts:619
createGreatCircle
▸ createGreatCircle(point1
, point2
): GeoCircle
Creates a new great circle that contains two points. There are two possible great circles that contain any two unique points; these circles differ only by their directionality (equivalently, the sign of their normal vectors). The order of points passed to this method and the right-hand rule determines which of the two is returned.
Parameters
Name | Type | Description |
---|---|---|
point1 | Readonly <Omit <Float64Array , "set" | "sort" | "copyWithin" >> | LatLonInterface | The first point that lies on the new great circle. |
point2 | Readonly <Omit <Float64Array , "set" | "sort" | "copyWithin" >> | LatLonInterface | The second point that lies on the new great circle. |
Returns
a great circle.
Defined in
src/sdk/geo/GeoCircle.ts:632
▸ createGreatCircle(point
, bearing
): GeoCircle
Parameters
Name | Type |
---|---|
point | Readonly <Omit <Float64Array , "set" | "sort" | "copyWithin" >> | LatLonInterface |
bearing | number |
Returns
Defined in
src/sdk/geo/GeoCircle.ts:633
createGreatCircleFromPointBearing
▸ createGreatCircleFromPointBearing(point
, bearing
): GeoCircle
Creates a new great circle defined by one point and a bearing offset. The new great circle will be equivalent to the path projected from the point with the specified initial bearing (forward azimuth).
Parameters
Name | Type | Description |
---|---|---|
point | Readonly <Omit <Float64Array , "set" | "sort" | "copyWithin" >> | LatLonInterface | A point that lies on the new great circle. |
bearing | number | The initial bearing from the point. |
Returns
a great circle.
Defined in
src/sdk/geo/GeoCircle.ts:646
getGreatCircleNormal
▸ getGreatCircleNormal(point1
, point2
, out
): Float64Array
Calculates a normal vector for a great circle given two points which lie on the circle. The order of points passed to this method and the right-hand rule determines which of the two possible normal vectors for the great circle is returned.
Parameters
Name | Type | Description |
---|---|---|
point1 | Readonly <Omit <Float64Array , "set" | "sort" | "copyWithin" >> | LatLonInterface | The first point that lies on the great circle. |
point2 | Readonly <Omit <Float64Array , "set" | "sort" | "copyWithin" >> | LatLonInterface | The second point that lies on the great circle. |
out | Float64Array | The vector to which to write the result. |
Returns
Float64Array
the normal vector for the great circle.
Defined in
src/sdk/geo/GeoCircle.ts:659
▸ getGreatCircleNormal(point
, bearing
, out
): Float64Array
Calculates a normal vector for a great circle given a point and initial bearing.
Parameters
Name | Type | Description |
---|---|---|
point | Readonly <Omit <Float64Array , "set" | "sort" | "copyWithin" >> | LatLonInterface | A point that lies on the great circle. |
bearing | number | The initial bearing from the point. |
out | Float64Array | The vector to which to write the result. |
Returns
Float64Array
the normal vector for the great circle.
Defined in
src/sdk/geo/GeoCircle.ts:667