Class CoordinateConversions
java.lang.Object
edu.nps.moves.dis7.utilities.CoordinateConversions
Converts DIS (x,y,z) rectilinear coordinates (earth-centered RH coordinate system)
to latitude and longitude, in radians.
- Author:
- loyaj
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final double
conversion factorstatic final double
conversion factor -
Method Summary
Modifier and TypeMethodDescriptionstatic double[]
getXYZfromLatLonDegrees
(double latitude, double longitude, double height) Converts lat long IN DEGREES and geodetic height (elevation) into DIS XYZ.static double[]
getXYZfromLatLonRadians
(double latitude, double longitude, double height) Converts lat long and geodetic height (elevation) into DIS XYZ.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).
-
Field Details
-
RADIANS_TO_DEGREES
public static final double RADIANS_TO_DEGREESconversion factor- See Also:
-
DEGREES_TO_RADIANS
public static final double DEGREES_TO_RADIANSconversion factor- See Also:
-
-
Method Details
-
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 RADIANSlongitude
- The longitude, in RADIANSheight
- 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 DEGREESlongitude
- The longitude, in DEGREESheight
- The elevation, in meters- Returns:
- a double array with the calculated X, Y, and Z values, in that order
-