-
public class SphericalUtil
-
-
Method Summary
Modifier and Type Method Description static doublecomputeHeading(LatLng from, LatLng to)Returns the heading from one LatLng to another LatLng. static LatLngcomputeOffset(LatLng from, double distance, double heading)Returns the LatLng resulting from moving a distance from an originin the specified heading (expressed in degrees clockwise from north). static LatLngcomputeOffsetOrigin(LatLng to, double distance, double heading)Returns the location of origin when provided with a LatLng destination,meters travelled and original heading. static LatLnginterpolate(LatLng from, LatLng to, double fraction)Returns the LatLng which lies the given fraction of the way between theorigin LatLng and the destination LatLng. static doublecomputeDistanceBetween(LatLng from, LatLng to)Returns the distance between two LatLngs, in meters. static doublecomputeLength(List<LatLng> path)Returns the length of the given path, in meters, on Earth. static doublecomputeArea(List<LatLng> path)Returns the area of a closed path on Earth. static doublecomputeSignedArea(List<LatLng> path)Returns the signed area of a closed path on Earth. -
-
Method Detail
-
computeHeading
static double computeHeading(LatLng from, LatLng to)
Returns the heading from one LatLng to another LatLng. Headings areexpressed in degrees clockwise from North within the range [-180,180).
-
computeOffset
static LatLng computeOffset(LatLng from, double distance, double heading)
Returns the LatLng resulting from moving a distance from an originin the specified heading (expressed in degrees clockwise from north).
- Parameters:
from- The LatLng from which to start.distance- The distance to travel.heading- The heading in degrees clockwise from north.
-
computeOffsetOrigin
static LatLng computeOffsetOrigin(LatLng to, double distance, double heading)
Returns the location of origin when provided with a LatLng destination,meters travelled and original heading. Headings are expressed in degreesclockwise from North. This function returns null when no solution isavailable.
- Parameters:
to- The destination LatLng.distance- The distance travelled, in meters.heading- The heading in degrees clockwise from north.
-
interpolate
static LatLng interpolate(LatLng from, LatLng to, double fraction)
Returns the LatLng which lies the given fraction of the way between theorigin LatLng and the destination LatLng.
- Parameters:
from- The LatLng from which to start.to- The LatLng toward which to travel.fraction- A fraction of the distance to travel.
-
computeDistanceBetween
static double computeDistanceBetween(LatLng from, LatLng to)
Returns the distance between two LatLngs, in meters.
-
computeLength
static double computeLength(List<LatLng> path)
Returns the length of the given path, in meters, on Earth.
-
computeArea
static double computeArea(List<LatLng> path)
Returns the area of a closed path on Earth.
- Parameters:
path- A closed path.
-
computeSignedArea
static double computeSignedArea(List<LatLng> path)
Returns the signed area of a closed path on Earth. The sign of the area may be used todetermine the orientation of the path."inside" is the surface that does not contain the South Pole.
- Parameters:
path- A closed path.
-
-
-
-