SphericalUtil

Functions

Link copied to clipboard
fun computeAngleBetween(from: LatLng, to: LatLng): Double

Returns the angle between two LatLngs, in radians. This is the same as the distance on the unit sphere.

Link copied to clipboard
fun computeArea(path: List<LatLng>): Double

Returns the area of a closed path on Earth.

Link copied to clipboard
fun computeDistanceBetween(from: LatLng, to: LatLng): Double

Returns the distance between two LatLngs, in meters.

Link copied to clipboard
fun computeHeading(from: LatLng, to: LatLng): Double

Returns the heading from one LatLng to another LatLng. Headings are expressed in degrees clockwise from North within the range [-180,180).

Link copied to clipboard
fun computeLength(path: List<LatLng>): Double

Returns the length of the given path, in meters, on Earth.

Link copied to clipboard
fun computeOffset(from: LatLng, distance: Double, heading: Double): LatLng

Returns the LatLng resulting from moving a distance from an origin in the specified heading (expressed in degrees clockwise from north).

Link copied to clipboard
fun computeOffsetOrigin(to: LatLng, distance: Double, heading: Double): LatLng?

Returns the location of origin when provided with a LatLng destination, meters travelled and original heading. Headings are expressed in degrees clockwise from North. This function returns null when no solution is available.

Link copied to clipboard

Returns the signed area of a closed path on Earth. The sign of the area may be used to determine the orientation of the path. "inside" is the surface that does not contain the South Pole.

fun computeSignedArea(path: List<LatLng>, radius: Double): Double

Returns the signed area of a closed path on a sphere of given radius. The computed area uses the same units as the radius squared. Used by SphericalUtilTest.

Link copied to clipboard
fun interpolate(from: LatLng, to: LatLng, fraction: Double): LatLng

Returns the LatLng which lies the given fraction of the way between the origin LatLng and the destination LatLng.