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) doubleaModel parameters: major and minor radius.(package private) doublebModel parameters: major and minor radius.(package private) doubleeDerived model parameters: e and e squared.(package private) doubleesqDerived model parameters: e and e squared.(package private) doublefModel parameters: flattening, inverse flattening.(package private) doubleinvfModel parameters: flattening, inverse flattening.private static intMAX_ITERMaximum number of iterations.private static doublePRECISIONMaximum 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 doubledistanceDeg(double lat1, double lng1, double lat2, double lng2)Compute the geodetic distance between two surface coordinates.doubledistanceRad(double lat1, double lng1, double lat2, double lng2)Compute the geodetic distance between two surface coordinates.doubleecefToLatDeg(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.doubleecefToLatRad(double x, double y, double z)Convert a 3D coordinate pair to the corresponding latitude.doubleecefToLngDeg(double x, double y)Convert a 3D coordinate pair to the corresponding longitude.doubleecefToLngRad(double x, double y)Convert a 3D coordinate pair to the corresponding longitude.doublegetEquatorialRadius()Equatorial radiusdoublegetPolarDistance()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.doubleminDistDeg(double plat, double plng, double rminlat, double rminlng, double rmaxlat, double rmaxlng)Compute a lower bound for the geodetic distance point to rectangle.doubleminDistRad(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.StringtoString()
-
-
-
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:EarthModelEquatorial radius- Specified by:
getEquatorialRadiusin interfaceEarthModel- Returns:
- Radius
-
getPolarDistance
public double getPolarDistance()
Description copied from interface:EarthModelPolar distance.- Specified by:
getPolarDistancein interfaceEarthModel- Returns:
- Distance to poles (= minor radius)
-
latLngDegToECEF
public double[] latLngDegToECEF(double lat, double lng)Description copied from interface:EarthModelMap 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:
latLngDegToECEFin 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:EarthModelMap 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:
latLngDegToECEFin 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:EarthModelMap 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:
latLngRadToECEFin 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:EarthModelMap 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:
latLngRadToECEFin 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:EarthModelConvert a 3D coordinate pair to the corresponding latitude.- Specified by:
ecefToLatDegin 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:EarthModelConvert a 3D coordinate pair to the corresponding latitude.- Specified by:
ecefToLatRadin 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:EarthModelConvert a 3D coordinate pair to the corresponding longitude.- Specified by:
ecefToLngDegin interfaceEarthModel- Parameters:
x- X valuey- Y value- Returns:
- Longitude in degrees
-
ecefToLngRad
public double ecefToLngRad(double x, double y)Description copied from interface:EarthModelConvert a 3D coordinate pair to the corresponding longitude.- Specified by:
ecefToLngRadin 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:EarthModelConvert 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:
ecefToLatLngDegHeightin 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:EarthModelConvert 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:
ecefToLatLngRadHeightin 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:EarthModelCompute the geodetic distance between two surface coordinates.- Specified by:
distanceDegin 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:EarthModelCompute the geodetic distance between two surface coordinates.- Specified by:
distanceRadin 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:EarthModelCompute a lower bound for the geodetic distance point to rectangle.- Specified by:
minDistDegin 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:EarthModelCompute a lower bound for the geodetic distance point to rectangle.- Specified by:
minDistRadin 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:
toStringin classjava.lang.Object
-
-