Class AbstractEarthModel
- java.lang.Object
-
- elki.math.geodesy.AbstractEarthModel
-
- All Implemented Interfaces:
EarthModel
- Direct Known Subclasses:
Clarke1858SpheroidEarthModel
,Clarke1880SpheroidEarthModel
,GRS67SpheroidEarthModel
,GRS80SpheroidEarthModel
,SphericalCosineEarthModel
,SphericalHaversineEarthModel
,SphericalVincentyEarthModel
,WGS72SpheroidEarthModel
,WGS84SpheroidEarthModel
public abstract class AbstractEarthModel extends java.lang.Object implements EarthModel
Abstract base class for earth models with shared glue code.- Since:
- 0.6.0
- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description (package private) double
a
Model parameters: major and minor radius.(package private) double
b
Model parameters: major and minor radius.(package private) double
e
Derived model parameters: e and e squared.(package private) double
esq
Derived model parameters: e and e squared.(package private) double
f
Model parameters: flattening, inverse flattening.(package private) double
invf
Model parameters: flattening, inverse flattening.private static int
MAX_ITER
Maximum number of iterations.private static double
PRECISION
Maximum desired precision.-
Fields inherited from interface elki.math.geodesy.EarthModel
MODEL_ID
-
-
Constructor Summary
Constructors Constructor Description AbstractEarthModel(double a, double b, double f, double invf)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
distanceDeg(double lat1, double lng1, double lat2, double lng2)
Compute the geodetic distance between two surface coordinates.double
distanceRad(double lat1, double lng1, double lat2, double lng2)
Compute the geodetic distance between two surface coordinates.double
ecefToLatDeg(double x, double y, double z)
Convert a 3D coordinate pair to the corresponding latitude.double[]
ecefToLatLngDegHeight(double x, double y, double z)
Convert a 3D coordinate pair to the corresponding latitude, longitude and height.double[]
ecefToLatLngRadHeight(double x, double y, double z)
Convert a 3D coordinate pair to the corresponding latitude, longitude and height.double
ecefToLatRad(double x, double y, double z)
Convert a 3D coordinate pair to the corresponding latitude.double
ecefToLngDeg(double x, double y)
Convert a 3D coordinate pair to the corresponding longitude.double
ecefToLngRad(double x, double y)
Convert a 3D coordinate pair to the corresponding longitude.double
getEquatorialRadius()
Equatorial radiusdouble
getPolarDistance()
Polar distance.double[]
latLngDegToECEF(double lat, double lng)
Map a degree latitude, longitude pair to 3D X-Y-Z coordinates, using a spherical earth model.double[]
latLngDegToECEF(double lat, double lng, double h)
Map a degree latitude, longitude pair to 3D X-Y-Z coordinates, using a spherical earth model.double[]
latLngRadToECEF(double lat, double lng)
Map a radians latitude, longitude pair to 3D X-Y-Z coordinates, using a spherical earth model.double[]
latLngRadToECEF(double lat, double lng, double h)
Map a radians latitude, longitude pair to 3D X-Y-Z coordinates, using a spherical earth model.double
minDistDeg(double plat, double plng, double rminlat, double rminlng, double rmaxlat, double rmaxlng)
Compute a lower bound for the geodetic distance point to rectangle.double
minDistRad(double plat, double plng, double rminlat, double rminlng, double rmaxlat, double rmaxlng)
Compute a lower bound for the geodetic distance point to rectangle.java.lang.String
toString()
-
-
-
Field Detail
-
MAX_ITER
private static final int MAX_ITER
Maximum number of iterations.- See Also:
- Constant Field Values
-
PRECISION
private static final double PRECISION
Maximum desired precision.- See Also:
- Constant Field Values
-
a
final double a
Model parameters: major and minor radius.
-
b
final double b
Model parameters: major and minor radius.
-
f
final double f
Model parameters: flattening, inverse flattening.
-
invf
final double invf
Model parameters: flattening, inverse flattening.
-
e
final double e
Derived model parameters: e and e squared.
-
esq
final double esq
Derived model parameters: e and e squared.
-
-
Method Detail
-
getEquatorialRadius
public double getEquatorialRadius()
Description copied from interface:EarthModel
Equatorial radius- Specified by:
getEquatorialRadius
in interfaceEarthModel
- Returns:
- Radius
-
getPolarDistance
public double getPolarDistance()
Description copied from interface:EarthModel
Polar distance.- Specified by:
getPolarDistance
in interfaceEarthModel
- Returns:
- Distance to poles (= minor radius)
-
latLngDegToECEF
public double[] latLngDegToECEF(double lat, double lng)
Description copied from interface:EarthModel
Map a degree latitude, longitude pair to 3D X-Y-Z coordinates, using a spherical earth model.The coordinate system is usually chosen such that the earth rotates around the Z axis and X points to the prime meridian and Equator.
- Specified by:
latLngDegToECEF
in interfaceEarthModel
- Parameters:
lat
- Latitude in degreelng
- Longitude in degree- Returns:
- Coordinate triple, in meters.
-
latLngDegToECEF
public double[] latLngDegToECEF(double lat, double lng, double h)
Description copied from interface:EarthModel
Map a degree latitude, longitude pair to 3D X-Y-Z coordinates, using a spherical earth model.The coordinate system is usually chosen such that the earth rotates around the Z axis and X points to the prime meridian and Equator.
- Specified by:
latLngDegToECEF
in interfaceEarthModel
- Parameters:
lat
- Latitude in degreelng
- Longitude in degreeh
- Height- Returns:
- Coordinate triple, in meters.
-
latLngRadToECEF
public double[] latLngRadToECEF(double lat, double lng)
Description copied from interface:EarthModel
Map a radians latitude, longitude pair to 3D X-Y-Z coordinates, using a spherical earth model.The coordinate system is usually chosen such that the earth rotates around the Z axis and X points to the prime meridian and Equator.
- Specified by:
latLngRadToECEF
in interfaceEarthModel
- Parameters:
lat
- Latitude in radianslng
- Longitude in radians- Returns:
- Coordinate triple, in meters.
-
latLngRadToECEF
public double[] latLngRadToECEF(double lat, double lng, double h)
Description copied from interface:EarthModel
Map a radians latitude, longitude pair to 3D X-Y-Z coordinates, using a spherical earth model.The coordinate system is usually chosen such that the earth rotates around the Z axis and X points to the prime meridian and Equator.
- Specified by:
latLngRadToECEF
in interfaceEarthModel
- Parameters:
lat
- Latitude in radianslng
- Longitude in radiansh
- Height- Returns:
- Coordinate triple, in meters.
-
ecefToLatDeg
public double ecefToLatDeg(double x, double y, double z)
Description copied from interface:EarthModel
Convert a 3D coordinate pair to the corresponding latitude.- Specified by:
ecefToLatDeg
in interfaceEarthModel
- Parameters:
x
- X valuey
- Y valuez
- Z value- Returns:
- Latitude in degrees
-
ecefToLatRad
public double ecefToLatRad(double x, double y, double z)
Description copied from interface:EarthModel
Convert a 3D coordinate pair to the corresponding latitude.- Specified by:
ecefToLatRad
in interfaceEarthModel
- Parameters:
x
- X valuey
- Y valuez
- Z value- Returns:
- Latitude in radians
-
ecefToLngDeg
public double ecefToLngDeg(double x, double y)
Description copied from interface:EarthModel
Convert a 3D coordinate pair to the corresponding longitude.- Specified by:
ecefToLngDeg
in interfaceEarthModel
- Parameters:
x
- X valuey
- Y value- Returns:
- Longitude in degrees
-
ecefToLngRad
public double ecefToLngRad(double x, double y)
Description copied from interface:EarthModel
Convert a 3D coordinate pair to the corresponding longitude.- Specified by:
ecefToLngRad
in interfaceEarthModel
- Parameters:
x
- X valuey
- Y value- Returns:
- Longitude in radians
-
ecefToLatLngDegHeight
public double[] ecefToLatLngDegHeight(double x, double y, double z)
Description copied from interface:EarthModel
Convert a 3D coordinate pair to the corresponding latitude, longitude and height.Note: if you are not interested in the height, use
EarthModel.ecefToLatDeg(double, double, double)
andEarthModel.ecefToLngDeg(double, double)
instead, which has a smaller memory footprint.- Specified by:
ecefToLatLngDegHeight
in interfaceEarthModel
- Parameters:
x
- X valuey
- Y valuez
- Z value- Returns:
- Array containing (latitude, longitude, height).
-
ecefToLatLngRadHeight
public double[] ecefToLatLngRadHeight(double x, double y, double z)
Description copied from interface:EarthModel
Convert a 3D coordinate pair to the corresponding latitude, longitude and height.Note: if you are not interested in the height, use
EarthModel.ecefToLatRad(double, double, double)
andEarthModel.ecefToLngRad(double, double)
instead, which has a smaller memory footprint.- Specified by:
ecefToLatLngRadHeight
in interfaceEarthModel
- Parameters:
x
- X valuey
- Y valuez
- Z value- Returns:
- Array containing (latitude, longitude, height).
-
distanceDeg
public double distanceDeg(double lat1, double lng1, double lat2, double lng2)
Description copied from interface:EarthModel
Compute the geodetic distance between two surface coordinates.- Specified by:
distanceDeg
in interfaceEarthModel
- Parameters:
lat1
- Latitude of first in degrees.lng1
- Longitude of first in degrees.lat2
- Latitude of second in degrees.lng2
- Longitude of second in degrees.- Returns:
- Distance in meters.
-
distanceRad
public double distanceRad(double lat1, double lng1, double lat2, double lng2)
Description copied from interface:EarthModel
Compute the geodetic distance between two surface coordinates.- Specified by:
distanceRad
in interfaceEarthModel
- Parameters:
lat1
- Latitude of first in radians.lng1
- Longitude of first in radians.lat2
- Latitude of second in radians.lng2
- Longitude of second in radians.- Returns:
- Distance in meters.
-
minDistDeg
public double minDistDeg(double plat, double plng, double rminlat, double rminlng, double rmaxlat, double rmaxlng)
Description copied from interface:EarthModel
Compute a lower bound for the geodetic distance point to rectangle.- Specified by:
minDistDeg
in interfaceEarthModel
- Parameters:
plat
- Latitude of point in degrees.plng
- Longitude of point in degrees.rminlat
- Min latitude of rectangle in degrees.rminlng
- Min Longitude of rectangle in degrees.rmaxlat
- Max Latitude of rectangle in degrees.rmaxlng
- Max Longitude of rectangle in degrees.- Returns:
- Distance in meters.
-
minDistRad
public double minDistRad(double plat, double plng, double rminlat, double rminlng, double rmaxlat, double rmaxlng)
Description copied from interface:EarthModel
Compute a lower bound for the geodetic distance point to rectangle.- Specified by:
minDistRad
in interfaceEarthModel
- Parameters:
plat
- Latitude of point in radians.plng
- Longitude of point in radians.rminlat
- Min latitude of rectangle in radians.rminlng
- Min Longitude of rectangle in radians.rmaxlat
- Max Latitude of rectangle in radians.rmaxlng
- Max Longitude of rectangle in radians.- Returns:
- Distance in meters.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-