Skip to main content

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

NameTypeDescription
centerReadonly<Omit<Float64Array, "set" | "sort" | "copyWithin">>The center of the new small circle, represented as a position vector in the standard geographic cartesian reference system.
radiusnumberThe radius of the new small circle in great-arc radians.

Returns

GeoCircle

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

NameTypeDefault valueDescription
startReadonly<Omit<Float64Array, "set" | "sort" | "copyWithin">> | LatLonInterfaceundefinedA point on this circle which marks the beginning of an arc.
endReadonly<Omit<Float64Array, "set" | "sort" | "copyWithin">> | LatLonInterfaceundefinedA point on this circle which marks the end of an arc.
tolerancenumberGeoCircle.ANGULAR_TOLERANCEThe error tolerance, in great-arc radians, when checking if start and end lie on this circle. Defaults to GeoCircle.ANGULAR_TOLERANCE if not specified.
equalityTolerancenumber0The 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

NameTypeDescription
lengthnumberAn 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

NameTypeDescription
anglenumberA 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

NameTypeDefault valueDescription
pointReadonly<Omit<Float64Array, "set" | "sort" | "copyWithin">> | LatLonInterfaceundefinedA point on this circle.
tolerancenumberGeoCircle.ANGULAR_TOLERANCEThe 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

NameTypeDescription
pointReadonly<Omit<Float64Array, "set" | "sort" | "copyWithin">> | LatLonInterfaceA point, represented as either a position vector or lat/long coordinates.
outFloat64ArrayA 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

NameTypeDescription
pointReadonly<Omit<Float64Array, "set" | "sort" | "copyWithin">> | LatLonInterfaceA point, represented as either a position vector or lat/long coordinates.
outGeoPointA GeoPoint object to which to write the result.

Returns

GeoPoint

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

NameTypeDescription
pointReadonly<Omit<Float64Array, "set" | "sort" | "copyWithin">> | LatLonInterfaceA 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

NameTypeDefault valueDescription
startReadonly<Omit<Float64Array, "set" | "sort" | "copyWithin">> | LatLonInterfaceundefinedA point on this circle which marks the beginning of an arc.
endReadonly<Omit<Float64Array, "set" | "sort" | "copyWithin">> | LatLonInterfaceundefinedA point on this circle which marks the end of an arc.
tolerancenumberGeoCircle.ANGULAR_TOLERANCEThe error tolerance, in great-arc radians, when checking if start and end lie on this circle. Defaults to GeoCircle.ANGULAR_TOLERANCE if not specified.
equalityTolerancenumber0The 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

NameTypeDefault valueDescription
pointReadonly<Omit<Float64Array, "set" | "sort" | "copyWithin">> | LatLonInterfaceundefinedA point, represented as either a position vector or lat/long coordinates.
inclusivebooleantrueWhether points that lie on this circle should pass the check. True by default.
tolerancenumberGeoCircle.ANGULAR_TOLERANCEThe 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

NameTypeDefault valueDescription
pointReadonly<Omit<Float64Array, "set" | "sort" | "copyWithin">> | LatLonInterfaceundefinedA point, represented as either a position vector or lat/long coordinates.
tolerancenumberGeoCircle.ANGULAR_TOLERANCEThe 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

NameTypeDescription
otherGeoCircleThe other circle to test for intersections.
outFloat64Array[]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

NameTypeDescription
otherGeoCircleThe other circle to test for intersections.
outGeoPoint[]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

NameTypeDefault valueDescription
otherGeoCircleundefinedThe other circle to test for intersections.
tolerancenumberGeoCircle.ANGULAR_TOLERANCEThe 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

NameTypeDescription
pointReadonly<Omit<Float64Array, "set" | "sort" | "copyWithin">> | LatLonInterfaceThe point to offset.
anglenumberThe angular distance by which to offset, in radians.
outFloat64ArrayA Float64Array object to which to write the result.
tolerance?numberThe 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

NameTypeDescription
pointReadonly<Omit<Float64Array, "set" | "sort" | "copyWithin">> | LatLonInterfaceThe point to offset.
anglenumberThe angular distance by which to offset, in radians.
outGeoPointA GeoPoint object to which to write the result.
tolerance?numberThe error tolerance, in great-arc radians, when checking if point lies on this circle. Defaults to GeoCircle.ANGULAR_TOLERANCE if not specified.

Returns

GeoPoint

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

NameTypeDescription
pointReadonly<Omit<Float64Array, "set" | "sort" | "copyWithin">> | LatLonInterfaceThe point to offset.
distancenumberThe distance by which to offset, in great-arc radians.
outFloat64ArrayA Float64Array object to which to write the result.
tolerance?numberThe 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

NameTypeDescription
pointReadonly<Omit<Float64Array, "set" | "sort" | "copyWithin">> | LatLonInterfaceThe point to offset.
distancenumberThe distance by which to offset, in great-arc radians.
outGeoPointA GeoPoint object to which to write the result.
tolerance?numberThe error tolerance, in great-arc radians, when checking if point lies on this circle. Defaults to GeoCircle.ANGULAR_TOLERANCE if not specified.

Returns

GeoPoint

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

NameTypeDescription
centerReadonly<Omit<Float64Array, "set" | "sort" | "copyWithin">> | LatLonInterfaceThe new center.
radiusnumberThe 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

NameTypeDescription
point1Readonly<Omit<Float64Array, "set" | "sort" | "copyWithin">> | LatLonInterfaceThe first point that lies on the great circle.
point2Readonly<Omit<Float64Array, "set" | "sort" | "copyWithin">> | LatLonInterfaceThe 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

NameTypeDescription
pointReadonly<Omit<Float64Array, "set" | "sort" | "copyWithin">> | LatLonInterfaceA point that lies on the great circle.
bearingnumberThe 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

NameTypeDescription
pointLatLonInterfaceThe center of the new small circle.
radiusnumberThe radius of the new small circle, in great-arc radians.

Returns

GeoCircle

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

NameTypeDescription
point1Readonly<Omit<Float64Array, "set" | "sort" | "copyWithin">> | LatLonInterfaceThe first point that lies on the new great circle.
point2Readonly<Omit<Float64Array, "set" | "sort" | "copyWithin">> | LatLonInterfaceThe second point that lies on the new great circle.

Returns

GeoCircle

a great circle.

Defined in

src/sdk/geo/GeoCircle.ts:632

createGreatCircle(point, bearing): GeoCircle

Parameters

NameType
pointReadonly<Omit<Float64Array, "set" | "sort" | "copyWithin">> | LatLonInterface
bearingnumber

Returns

GeoCircle

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

NameTypeDescription
pointReadonly<Omit<Float64Array, "set" | "sort" | "copyWithin">> | LatLonInterfaceA point that lies on the new great circle.
bearingnumberThe initial bearing from the point.

Returns

GeoCircle

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

NameTypeDescription
point1Readonly<Omit<Float64Array, "set" | "sort" | "copyWithin">> | LatLonInterfaceThe first point that lies on the great circle.
point2Readonly<Omit<Float64Array, "set" | "sort" | "copyWithin">> | LatLonInterfaceThe second point that lies on the great circle.
outFloat64ArrayThe 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

NameTypeDescription
pointReadonly<Omit<Float64Array, "set" | "sort" | "copyWithin">> | LatLonInterfaceA point that lies on the great circle.
bearingnumberThe initial bearing from the point.
outFloat64ArrayThe vector to which to write the result.

Returns

Float64Array

the normal vector for the great circle.

Defined in

src/sdk/geo/GeoCircle.ts:667