Class Vincenty
java.lang.Object
net.okapia.osid.torrefacto.math.Vincenty
Vincenty's formulae for geodesics on an oblate ellipsoid of
revolution: the inverse problem (the distance and initial bearing
between two points) and the direct problem (the point reached from a
start along a bearing for a distance). A flattening of zero reduces
the ellipsoid to a sphere.
The formulae are transcendental and solved iteratively, so the
results are
double approximations -- accurate to roughly a
millimeter on the Earth, not to the last digit -- rather than exact.
Angles are in degrees and distances in the same unit as the ellipsoid
axis given to the constructor (meters, for the usual radii).
This class holds no state between calls and is safe to share.
Developed by Thaddeus Vincenty in 1975, these formulae are widely
used in geographic information systems (GIS) because they are
accurate to within 0.5 millimeters on the Earth ellipsoid.-
Constructor Summary
ConstructorsConstructorDescriptionVincenty(double semiMajorAxis, double flattening) Constructs aVincentysolver for an ellipsoid. -
Method Summary
Modifier and TypeMethodDescriptiondouble[]direct(double lat1, double lon1, double alpha1, double s) Vincenty's direct formula: the point reached from a start by traveling a distance along a bearing.double[]inverse(double lat1, double lon1, double lat2, double lon2) Vincenty's inverse formula: the geodesic distance and initial bearing from one point to another.
-
Constructor Details
-
Vincenty
public Vincenty(double semiMajorAxis, double flattening) Constructs aVincentysolver for an ellipsoid.- Parameters:
semiMajorAxis- the equatorial radius (the semi-major axis)flattening- the flattening of the ellipsoid; zero for a sphere
-
-
Method Details
-
inverse
public double[] inverse(double lat1, double lon1, double lat2, double lon2) Vincenty's inverse formula: the geodesic distance and initial bearing from one point to another. The bearing changes along a geodesic; this is the heading to set out on.- Parameters:
lat1- the latitude of the start point, in degreeslon1- the longitude of the start point, in degreeslat2- the latitude of the end point, in degreeslon2- the longitude of the end point, in degrees- Returns:
- a two-element array of the distance (in the axis unit) and the initial bearing (in radians)
-
direct
public double[] direct(double lat1, double lon1, double alpha1, double s) Vincenty's direct formula: the point reached from a start by traveling a distance along a bearing.- Parameters:
lat1- the latitude of the start point, in degreeslon1- the longitude of the start point, in degreesalpha1- the initial bearing, in radianss- the distance to travel, in the axis unit- Returns:
- a two-element array of the destination latitude and longitude, in degrees; the longitude is not normalized
-