Class Ellipsoid

java.lang.Object
org.opensextant.geodesy.Ellipsoid
All Implemented Interfaces:
Serializable

public class Ellipsoid extends Object implements Serializable
The Ellipsoid class maintains an object pool of Singleton Ellipsoid objects (used as models of a slightly flattened spherical earth), indexed by String names. The user can create additional named Ellipsoids if needed, or retrieve one of the statically defined ones that are common or in historic use by geographic information and mapping systems. There is an accessor method to get the list of available cached Ellipsoid names, and there are accessor methods for the commonly used mathematical parameters of an Ellipsoid model.

TODO: implement equals() and hashCode() methods.

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Ellipsoid(String name, double equatorialRadius, double flattening)
    This is the constructor for a custom ellipsoid to be created and cached in the object pool.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    This accessor method returns the ellipsoid second eccentricity value squared.
    double
    This accessor method returns the ellipsoid eccentricity parameter, 'e' = sqrt(1 - (b^2 / a^2)).
    double
    This accessor method returns the ellipsoid eccentricity value squared.
    static @NotNull Set<String>
    This method returns a Set of String names of defined Ellipsoids available in the object pool.
    double
    This accessor method returns the equatorialRadius, ellipsoid parameter 'a' (semi-major axis).
    double
    This accessor method returns the ellipsoid flattening parameter, 'f' = (a - b) / a.
    static Ellipsoid
    This method will retrieve the named singleton Ellipsoid, if defined.
    This accessor method returns the name of this Ellipsoid.
    double
    This accessor method returns the polarRadius, ellipsoid parameter 'b' (semi-minor axis).
    double
    This method returns the radius of curvature of this Ellipsoid, in meters, at the given Latitude.
    double
    This method calculates the orthodromic distance in meters between two points, which is the shortest distance between two geodetic points on the surface of this ellipsoid.
    This method returns the name of this Ellipsoid.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Ellipsoid

      public Ellipsoid(String name, double equatorialRadius, double flattening) throws IllegalArgumentException
      This is the constructor for a custom ellipsoid to be created and cached in the object pool. If the name has not been used, the new Ellipsoid will be cached as a singleton for future access. If already defined, an IllegalArgumentException is thrown. Commonly used Ellipsoids are defined in a static block of this class at class load time, so the constructor is typically not needed by client programs. Use the getInstance method to retrieve by name instead.
      Parameters:
      name - String name used to get this singleton Ellipsoid instance
      equatorialRadius - radius in meters of circle on equitorial plane, a
      flattening - ratio of axes difference to equatorial radius, f = (a - b) / a
      Throws:
      IllegalArgumentException - error if named ellipoid has been previously defined
  • Method Details

    • getEllipsoidNames

      @NotNull public static @NotNull Set<String> getEllipsoidNames()
      This method returns a Set of String names of defined Ellipsoids available in the object pool.
      Returns:
      the Set of String names for currently defined Ellipsoid singletons
    • getInstance

      public static Ellipsoid getInstance(String name)
      This method will retrieve the named singleton Ellipsoid, if defined.
      Parameters:
      name - String used to identify the Ellipsoid (e.g. "WGS 84")
      Returns:
      Ellipsoid singleton with given name, retrieved from cache
    • getName

      public String getName()
      This accessor method returns the name of this Ellipsoid.
      Returns:
      name String used to identify this ellipsoid
    • getEquatorialRadius

      public double getEquatorialRadius()
      This accessor method returns the equatorialRadius, ellipsoid parameter 'a' (semi-major axis).
      Returns:
      radius in meters of circle on equitorial plane
    • getPolarRadius

      public double getPolarRadius()
      This accessor method returns the polarRadius, ellipsoid parameter 'b' (semi-minor axis).
      Returns:
      distance in meters from center to pole
    • getRadius

      public double getRadius(Latitude lat)
      This method returns the radius of curvature of this Ellipsoid, in meters, at the given Latitude. It is also called the radius of curvature in the prime vertical.
      Parameters:
      lat - the Latitude for which the ellipsoid's radius is desired
      Returns:
      the radius of the ellipsoid at the given Latitude, in meters.
    • getFlattening

      public double getFlattening()
      This accessor method returns the ellipsoid flattening parameter, 'f' = (a - b) / a.
      Returns:
      flattening ratio of axes difference to equatorial radius
    • getEccentricity

      public double getEccentricity()
      This accessor method returns the ellipsoid eccentricity parameter, 'e' = sqrt(1 - (b^2 / a^2)).
      Returns:
      eccentricity of the ellipsoid
    • getEccentricitySquared

      public double getEccentricitySquared()
      This accessor method returns the ellipsoid eccentricity value squared.
      Returns:
      eccentricity of the ellipsoid, squared
    • get2ndEccentricitySquared

      public double get2ndEccentricitySquared()
      This accessor method returns the ellipsoid second eccentricity value squared.
      Returns:
      second eccentricity of the ellipsoid, squared
    • orthodromicDistance

      public double orthodromicDistance(Geodetic2DPoint p1, Geodetic2DPoint p2)
      This method calculates the orthodromic distance in meters between two points, which is the shortest distance between two geodetic points on the surface of this ellipsoid.
      Parameters:
      p1 - geodetic point 1
      p2 - geodetic point 2
      Returns:
      distance in meters
    • toString

      public String toString()
      This method returns the name of this Ellipsoid.
      Overrides:
      toString in class Object
      Returns:
      name String used to identify this Ellipsoid in the object pool.