Object LocationCompute.Companion
-
- All Implemented Interfaces:
public class LocationCompute.Companion
-
-
Field Summary
Fields Modifier and Type Field Description public final static LocationCompute.CompanionINSTANCE
-
Method Summary
Modifier and Type Method Description final UnitcomputeDistanceAndBearing(Double lat1, Double lon1, Double lat2, Double lon2, FloatArray results)final UnitcomputeDistanceAndBearing(Double latP1, Double lonP1, Double latP2, Double lonP2, Double a, Double b, Double f, FloatArray results)final UnitdistanceBetween(Double startLatitude, Double startLongitude, Double endLatitude, Double endLongitude, FloatArray results)Computes the approximate distance in meters between two locations, and optionally the initial and final bearings of the shortest path between them. final DoublecomputeDistanceFast(Location loc1, Location loc2)Compute distance on Earth approximated as sphere. final DoublecomputeDistanceFast(Double lat1, Double lon1, Double lat2, Double lon2)Compute distance on Earth approximated as sphere. final UnitcomputeDistanceAndBearingFast(Double latP1, Double lonP1, Double latP2, Double lonP2, DoubleArray results)Compute distance and bearing on Earth approximated as sphere. -
-
Method Detail
-
computeDistanceAndBearing
final Unit computeDistanceAndBearing(Double lat1, Double lon1, Double lat2, Double lon2, FloatArray results)
-
computeDistanceAndBearing
final Unit computeDistanceAndBearing(Double latP1, Double lonP1, Double latP2, Double lonP2, Double a, Double b, Double f, FloatArray results)
-
distanceBetween
final Unit distanceBetween(Double startLatitude, Double startLongitude, Double endLatitude, Double endLongitude, FloatArray results)
Computes the approximate distance in meters between two locations, and optionally the initial and final bearings of the shortest path between them. Distance and bearing are defined using the WGS84 ellipsoid.
The computed distance is stored in results0. If results has length 2 or greater, the initial bearing is stored in results1. If results has length 3 or greater, the final bearing is stored in results2.
- Parameters:
startLatitude- the starting latitudestartLongitude- the starting longitudeendLatitude- the ending latitudeendLongitude- the ending longituderesults- an array of floats to hold the results
-
computeDistanceFast
@Synchronized() final Double computeDistanceFast(Location loc1, Location loc2)
Compute distance on Earth approximated as sphere.
- Parameters:
loc1- first locationloc2- second location
-
computeDistanceFast
@Synchronized() final Double computeDistanceFast(Double lat1, Double lon1, Double lat2, Double lon2)
Compute distance on Earth approximated as sphere.
- Parameters:
lat1- latitude of first pointlon1- longitude of first pointlat2- latitude of second pointlon2- longitude of second point
-
computeDistanceAndBearingFast
final Unit computeDistanceAndBearingFast(Double latP1, Double lonP1, Double latP2, Double lonP2, DoubleArray results)
Compute distance and bearing on Earth approximated as sphere. <br></br><br></br>Compute is based on Haversine formula http://en.wikipedia.org/wiki/Haversine_formula <br></br><br></br>Precision is around 99.9%, speed around 5x faster then above method.
- Parameters:
latP1- latitude of first pointlonP1- longitude of first pointlatP2- latitude of second pointlonP2- longitude of second pointresults- one (only distance) or two sized array for a results
-
-
-
-