com.moximedia.aims
Class AimsGrs80

java.lang.Object
  extended bycom.moximedia.aims.AimsGrs80
All Implemented Interfaces:
java.io.Serializable

public class AimsGrs80
extends java.lang.Object
implements java.io.Serializable

Distance and bearing routines based on GRS80 (NAD 83) ellipsoid.

See Also:
Serialized Form

Constructor Summary
AimsGrs80()
          Do not use.
 
Method Summary
static double atan2(double y, double x)
           
static double[] crsdist_ell(double glat1, double glon1, double glat2, double glon2)
           
static double[] direct_ell(double glat1, double glon1, double faz, double s)
           
static double getCourse(AimsPoint fromPt, AimsPoint toPt)
          Returns the course bearing between two geographic points.
static double getCourse(double lat1, double lon1, double lat2, double lon2)
          Returns the course bearing between two geographic points.
static double getDistance(AimsPoint fromPt, AimsPoint toPt)
          Returns the distance between two geographic points.
static double getDistance(double lat1, double lon1, double lat2, double lon2)
          Returns the distance between two geographic points.
static double[] getDistanceAndCourse(double lat1, double lon1, double lat2, double lon2)
          Returns an array containin distance, course, and return course between two geographic points.
static AimsPoint getPosition(AimsPoint fromPt, double distance, double bearing)
          Returns an array containing the latitude and longitude of the position calculated at the specified distance and bearing from the specified geographic point.
static double[] getPosition(double lat, double lon, double distance, double bearing)
          Returns an array containing the latitude and longitude of the position calculated at the specified distance and bearing from the specified geographic point.
static double mod(double x, double y)
           
static double modcrs(double x)
           
static double modlat(double x)
           
static double modlon(double x)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AimsGrs80

public AimsGrs80()
Do not use. For serialization only.

Method Detail

getCourse

public static double getCourse(AimsPoint fromPt,
                               AimsPoint toPt)
Returns the course bearing between two geographic points.

Parameters:
fromPt - An AimsPoint object containing geographic coordinates.
toPt - An AimsPoint object containing geographic coordinates.
Returns:
The bearing or course from the first point to the second, in degrees.

getCourse

public static double getCourse(double lat1,
                               double lon1,
                               double lat2,
                               double lon2)
Returns the course bearing between two geographic points.

Parameters:
lat1 - The latitude of the first point.
lon1 - The longitude of the first point. Degrees west should be negative.
lat2 - The latitude of the second point.
lon2 - The longitude of the second point. Degrees west should be negative.
Returns:
The bearing or course from the first point to the second, in degrees.

getDistance

public static double getDistance(AimsPoint fromPt,
                                 AimsPoint toPt)
Returns the distance between two geographic points.

Parameters:
fromPt - An AimsPoint object containing geographic coordinates.
toPt - An AimsPoint object containing geographic coordinates.
Returns:
The distance from the first point to the second, in metres.

getDistance

public static double getDistance(double lat1,
                                 double lon1,
                                 double lat2,
                                 double lon2)
Returns the distance between two geographic points.

Parameters:
lat1 - The latitude of the first point.
lon1 - The longitude of the first point. Degrees west should be negative.
lat2 - The latitude of the second point.
lon2 - The longitude of the second point. Degrees west should be negative.
Returns:
The distance from the first point to the second, in kilometres.

getDistanceAndCourse

public static double[] getDistanceAndCourse(double lat1,
                                            double lon1,
                                            double lat2,
                                            double lon2)
Returns an array containin distance, course, and return course between two geographic points.

Parameters:
lat1 - The latitude of the first point.
lon1 - The longitude of the first point. Degrees west should be negative.
lat2 - The latitude of the second point.
lon2 - The longitude of the second point. Degrees west should be negative.
Returns:
An array containing:
element[0]: The distance from the first point to the second, in metres.
element[1]: The bearing or course from the first point to the second, in degrees.
element[2]: The return bearing or course, in degrees.

getPosition

public static AimsPoint getPosition(AimsPoint fromPt,
                                    double distance,
                                    double bearing)
Returns an array containing the latitude and longitude of the position calculated at the specified distance and bearing from the specified geographic point.

Parameters:
fromPt - An AimsPoint object containing geographic coordinates. Note that degrees west should be negative.
distance - The offset distance, in kilometres.
bearing - The course bearing, in degrees.
Returns:
The calculated position, as an AimsPoint object.

getPosition

public static double[] getPosition(double lat,
                                   double lon,
                                   double distance,
                                   double bearing)
Returns an array containing the latitude and longitude of the position calculated at the specified distance and bearing from the specified geographic point.

Parameters:
lat - The latitude of the origin point.
lon - The longitude of the origin point. Degrees west should be negative.
distance - The offset distance, in metres.
bearing - The course bearing, in degrees.
Returns:
An array containing:
element[0]: The latitude of the calculated position.
element[1]: The longitude of the calculated position.

atan2

public static double atan2(double y,
                           double x)

crsdist_ell

public static double[] crsdist_ell(double glat1,
                                   double glon1,
                                   double glat2,
                                   double glon2)

direct_ell

public static double[] direct_ell(double glat1,
                                  double glon1,
                                  double faz,
                                  double s)

mod

public static double mod(double x,
                         double y)

modcrs

public static double modcrs(double x)

modlat

public static double modlat(double x)

modlon

public static double modlon(double x)