Class Bearing

java.lang.Object
slash.navigation.common.Bearing

public class Bearing extends Object
Computes the distance, azimuth, and back azimuth between two lat-lon positions on the Earth's surface. Reference ellipsoid is the WGS-84. Modified to return meters with millimeter precision
Author:
Unidata Development Team, modified by Christian Pesch
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final double
    Earth radius in meters
  • Constructor Summary

    Constructors
    Constructor
    Description
    Bearing(double azimuth, double backazimuth, double distance)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Bearing
    calculateBearing(double longitude1, double latitude1, double longitude2, double latitude2)
    Computes distance (in meters), azimuth (degrees clockwise positive from North, 0 to 360), and back azimuth (degrees clockwise positive from North, 0 to 360), from latitude-longituide point pt1 to latitude-longituide pt2.
    double
    Get the azimuth in degrees, 0 = north, clockwise positive
    double
    Get the back azimuth in degrees, 0 = north, clockwise positive
    double
    Get the distance in meters

    Methods inherited from class java.lang.Object

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

    • EARTH_RADIUS

      public static final double EARTH_RADIUS
      Earth radius in meters
      See Also:
  • Constructor Details

    • Bearing

      public Bearing(double azimuth, double backazimuth, double distance)
  • Method Details

    • getAngle

      public double getAngle()
      Get the azimuth in degrees, 0 = north, clockwise positive
      Returns:
      azimuth in degrees
    • getBackAzimuth

      public double getBackAzimuth()
      Get the back azimuth in degrees, 0 = north, clockwise positive
      Returns:
      back azimuth in degrees
    • getDistance

      public double getDistance()
      Get the distance in meters
      Returns:
      distance in m
    • calculateBearing

      public static Bearing calculateBearing(double longitude1, double latitude1, double longitude2, double latitude2)
      Computes distance (in meters), azimuth (degrees clockwise positive from North, 0 to 360), and back azimuth (degrees clockwise positive from North, 0 to 360), from latitude-longituide point pt1 to latitude-longituide pt2.

      Algorithm from U.S. National Geodetic Survey, FORTRAN program "inverse," subroutine "INVER1," by L. PFEIFER and JOHN G. GERGEN. See http://www.ngs.noaa.gov/TOOLS/Inv_Fwd/Inv_Fwd.html

      Original documentation:
      SOLUTION OF THE GEODETIC INVERSE PROBLEM AFTER T.VINCENTY
      MODIFIED RAINSFORD'S METHOD WITH HELMERT'S ELLIPTICAL TERMS
      EFFECTIVE IN ANY AZIMUTH AND AT ANY DISTANCE SHORT OF ANTIPODAL
      STANDPOINT/FOREPOINT MUST NOT BE THE GEOGRAPHIC POLE

      Reference ellipsoid is the WGS-84 ellipsoid.
      See http://www.colorado.edu/geography/gcraft/notes/datum/elist.html Requires close to 1.4 E-5 seconds wall clock time per call on a 550 MHz Pentium with Linux 7.2.
      Parameters:
      longitude1 - Lon of point 1
      latitude1 - Lat of point 1
      longitude2 - Lon of point 2
      latitude2 - Lat of point 2
      Returns:
      a Bearing object with distance (in meters), azimuth from pt1 to pt2 (degrees, 0 = north, clockwise positive)