NASA World Wind

gov.nasa.worldwind.geom
Class LatLon

java.lang.Object
  extended by gov.nasa.worldwind.geom.LatLon

public class LatLon
extends Object

Represents a point on the two-dimensional surface of a globe. Latitude is the degrees North and ranges between [-90, 90], while longitude refers to degrees East, and ranges between (-180, 180].

Instances of LatLon are immutable.


Field Summary
static LatLon ZERO
           
 
Constructor Summary
LatLon(Angle latitude, Angle longitude)
          Contructs a new LatLon from two angles.
 
Method Summary
 LatLon add(LatLon that)
           
 LatLon add(Position that)
           
static Angle azimuth(LatLon p1, LatLon p2)
           
static double ellipsoidalDistance(LatLon p1, LatLon p2, double equatorialRadius, double polarRadius)
          Computes the distance between two points on an ellipsoid iteratively.
 Angle ellipsoidalForwardAzimuth(LatLon p1, LatLon p2, double equatorialRadius, double polarRadius)
          Compute the forward azimuth between two positions
static LatLon endPosition(LatLon p, double azimuthRadians, double pathLengthRadians)
           
 boolean equals(Object o)
           
static LatLon fromDegrees(double latitude, double longitude)
          Factory method for obtaining a new LatLon from two angles expressed in degrees.
static LatLon fromRadians(double latitude, double longitude)
          Factor method for obtaining a new LatLon from two angles expressed in radians.
 Angle getLatitude()
          Obtains the latitude of this LatLon.
 Angle getLongitude()
          Obtains the longitude of this LatLon.
 int hashCode()
           
static LatLon interpolate(double amount, LatLon value1, LatLon value2)
           
static boolean positionsCrossDateLine(Iterable<LatLon> positions)
           
static boolean positionsCrossLongitudeBoundary(LatLon p1, LatLon p2)
           
static Angle sphericalDistance(LatLon p1, LatLon p2)
          Computes the great circle angular distance between two locations.
 LatLon subtract(LatLon that)
           
 LatLon subtract(Position that)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ZERO

public static final LatLon ZERO
Constructor Detail

LatLon

public LatLon(Angle latitude,
              Angle longitude)
Contructs a new LatLon from two angles. Neither angle may be null.

Parameters:
latitude - latitude
longitude - longitude
Throws:
IllegalArgumentException - if latitude or longitude is null
Method Detail

add

public LatLon add(LatLon that)

add

public LatLon add(Position that)

azimuth

public static Angle azimuth(LatLon p1,
                            LatLon p2)

ellipsoidalDistance

public static double ellipsoidalDistance(LatLon p1,
                                         LatLon p2,
                                         double equatorialRadius,
                                         double polarRadius)
Computes the distance between two points on an ellipsoid iteratively.

NOTE: This method was copied from the UniData NetCDF Java library. http://www.unidata.ucar.edu/software/netcdf-java/

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

Requires close to 1.4 E-5 seconds wall clock time per call on a 550 MHz Pentium with Linux 7.2.

Parameters:
p1 - first position
p2 - second position
equatorialRadius - the equatorial radius of the globe in meters
polarRadius - the polar radius of the globe in meters
Returns:
distance in meters between the two points

ellipsoidalForwardAzimuth

public Angle ellipsoidalForwardAzimuth(LatLon p1,
                                       LatLon p2,
                                       double equatorialRadius,
                                       double polarRadius)
Compute the forward azimuth between two positions

Parameters:
p1 - first position
p2 - second position
equatorialRadius - the equatorial radius of the globe in meters
polarRadius - the polar radius of the globe in meters
Returns:
the azimuth

endPosition

public static LatLon endPosition(LatLon p,
                                 double azimuthRadians,
                                 double pathLengthRadians)

equals

public boolean equals(Object o)
Overrides:
equals in class Object

fromDegrees

public static LatLon fromDegrees(double latitude,
                                 double longitude)
Factory method for obtaining a new LatLon from two angles expressed in degrees.

Parameters:
latitude - in degrees
longitude - in degrees
Returns:
a new LatLon from the given angles, which are expressed as degrees

fromRadians

public static LatLon fromRadians(double latitude,
                                 double longitude)
Factor method for obtaining a new LatLon from two angles expressed in radians.

Parameters:
latitude - in radians
longitude - in radians
Returns:
a new LatLon from the given angles, which are expressed as radians

getLatitude

public final Angle getLatitude()
Obtains the latitude of this LatLon.

Returns:
this LatLon's latitude

getLongitude

public final Angle getLongitude()
Obtains the longitude of this LatLon.

Returns:
this LatLon's longitude

hashCode

public int hashCode()
Overrides:
hashCode in class Object

interpolate

public static LatLon interpolate(double amount,
                                 LatLon value1,
                                 LatLon value2)

positionsCrossDateLine

public static boolean positionsCrossDateLine(Iterable<LatLon> positions)

positionsCrossLongitudeBoundary

public static boolean positionsCrossLongitudeBoundary(LatLon p1,
                                                      LatLon p2)

sphericalDistance

public static Angle sphericalDistance(LatLon p1,
                                      LatLon p2)
Computes the great circle angular distance between two locations. The return value gives the distance as the angle between the two positions on the pi radius circle. In radians, this angle is also the arc length of the segment between the two positions on that circle. To compute a distance in meters from this value, multiply it by the radius of the globe.

Parameters:
p1 - LatLon of the first location
p2 - LatLon of the second location
Returns:
the angular distance between the two locations. In radians, this value is the arc length of the radius pi circle.

subtract

public LatLon subtract(LatLon that)

subtract

public LatLon subtract(Position that)

toString

public String toString()
Overrides:
toString in class Object

NASA World Wind