edu.nps.moves.disutil
Class CoordinateConversions

java.lang.Object
  extended by edu.nps.moves.disutil.CoordinateConversions

public class CoordinateConversions
extends java.lang.Object

Converts DIS (x,y,z) rectilinear coordinates (earth-centered RH coordinate system) to latitude and longitude, in radians.

Author:
loyaj

Field Summary
static double DEGREES_TO_RADIANS
           
static double RADIANS_TO_DEGREES
           
 
Method Summary
static double[] getXYZfromLatLonDegrees(double latitude, double longitude, double height)
          Converts lat long IN DEGREES and geodetic height (elevation) into DIS XYZ This algorithm also uses the WGS84 ellipsoid, though you can change the values of a and b for a different ellipsoid.
static double[] getXYZfromLatLonRadians(double latitude, double longitude, double height)
          Converts lat long and geodetic height (elevation) into DIS XYZ This algorithm also uses the WGS84 ellipsoid, though you can change the values of a and b for a different ellipsoid.
static double[] xyzToLatLonDegrees(double[] xyz)
          Converts DIS xyz world coordinates to latitude and longitude (IN DEGREES).
static double[] xyzToLatLonRadians(double[] xyz)
          Converts DIS xyz world coordinates to latitude and longitude (IN RADIANS).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RADIANS_TO_DEGREES

public static final double RADIANS_TO_DEGREES
See Also:
Constant Field Values

DEGREES_TO_RADIANS

public static final double DEGREES_TO_RADIANS
See Also:
Constant Field Values
Method Detail

xyzToLatLonRadians

public static double[] xyzToLatLonRadians(double[] xyz)
Converts DIS xyz world coordinates to latitude and longitude (IN RADIANS). This algorithm may not be 100% accurate near the poles. Uses WGS84 , though you can change the ellipsoid constants a and b if you want to use something else. These formulas were obtained from Military Handbook 600008

Parameters:
xyz - A double array with the x, y, and z coordinates, in that order.
Returns:
An array with the lat, long, and elevation corresponding to those coordinates. Elevation is in meters, lat and long are in radians

xyzToLatLonDegrees

public static double[] xyzToLatLonDegrees(double[] xyz)
Converts DIS xyz world coordinates to latitude and longitude (IN DEGREES). This algorithm may not be 100% accurate near the poles. Uses WGS84 , though you can change the ellipsoid constants a and b if you want to use something else. These formulas were obtained from Military Handbook 600008

Parameters:
xyz - A double array with the x, y, and z coordinates, in that order.
Returns:
An array with the lat, lon, and elevation corresponding to those coordinates. Elevation is in meters, lat and long are in degrees

getXYZfromLatLonRadians

public static double[] getXYZfromLatLonRadians(double latitude,
                                               double longitude,
                                               double height)
Converts lat long and geodetic height (elevation) into DIS XYZ This algorithm also uses the WGS84 ellipsoid, though you can change the values of a and b for a different ellipsoid. Adapted from Military Handbook 600008

Parameters:
latitude - The latitude, IN RADIANS
longitude - The longitude, in RADIANS
height - The elevation, in meters
Returns:
a double array with the calculated X, Y, and Z values, in that order

getXYZfromLatLonDegrees

public static double[] getXYZfromLatLonDegrees(double latitude,
                                               double longitude,
                                               double height)
Converts lat long IN DEGREES and geodetic height (elevation) into DIS XYZ This algorithm also uses the WGS84 ellipsoid, though you can change the values of a and b for a different ellipsoid. Adapted from Military Handbook 600008

Parameters:
latitude - The latitude, IN DEGREES
longitude - The longitude, in DEGREES
height - The elevation, in meters
Returns:
a double array with the calculated X, Y, and Z values, in that order