Class CoordinateConversions

java.lang.Object
edu.nps.moves.dis7.utilities.CoordinateConversions

public class CoordinateConversions extends Object
Converts DIS (x,y,z) rectilinear coordinates (earth-centered RH coordinate system) to latitude and longitude, in radians.
Author:
loyaj
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final double
    conversion factor
    static final double
    conversion factor
  • Method Summary

    Modifier and Type
    Method
    Description
    static 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).

    Methods inherited from class java.lang.Object

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

    • RADIANS_TO_DEGREES

      public static final double RADIANS_TO_DEGREES
      conversion factor
      See Also:
    • DEGREES_TO_RADIANS

      public static final double DEGREES_TO_RADIANS
      conversion 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 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