Class Vincenty

java.lang.Object
net.okapia.osid.torrefacto.math.Vincenty

public final class Vincenty extends Object
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

    Constructors
    Constructor
    Description
    Vincenty(double semiMajorAxis, double flattening)
    Constructs a Vincenty solver for an ellipsoid.
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    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.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Vincenty

      public Vincenty(double semiMajorAxis, double flattening)
      Constructs a Vincenty solver 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 degrees
      lon1 - the longitude of the start point, in degrees
      lat2 - the latitude of the end point, in degrees
      lon2 - 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 degrees
      lon1 - the longitude of the start point, in degrees
      alpha1 - the initial bearing, in radians
      s - 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