Spherical Util
Distances, headings, offsets, interpolation and areas on the Earth as a sphere, e.g. to move a vehicle marker along its route and turn it the way it travels.
The methods have the names, parameters and units of SphericalUtil in android-maps-utils, so code using it only needs another import. Distances are in meters, headings in degrees clockwise from north, between -180 and 180.
Example:
val heading = SphericalUtil.computeHeading(from, to)
marker.position = SphericalUtil.interpolate(from, to, fraction)
marker.rotation = heading.toFloat()Properties
Functions
Returns the area of a closed path in square meters, 0 for fewer than 3 points.
Returns the great-circle distance between two locations in meters.
Returns the heading from one location to another, in degrees clockwise from north, between -180 and 180: 0 is north, 90 east, -90 west and -180 south.
Returns the length of a path in meters, 0 for fewer than 2 points.
Returns the location from which going distance meters at heading degrees reaches to, the inverse of computeOffset, or null if there is none.
Returns the signed area of a closed path in square meters: positive if the points go counter-clockwise, negative if clockwise, 0 for fewer than 3 points.