Package llnl.gnem.core.util.Geometry
Class EModel
java.lang.Object
llnl.gnem.core.util.Geometry.EModel
A class that provides static methods for calculating distances and azimuths
on a spherical Earth or a WGS84 ellipsoidal Earth.
- Author:
- Doug Dodge
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doublestatic final doublestatic final intstatic final double -
Method Summary
Modifier and TypeMethodDescriptionstatic ENUCoordinateecef2enu(GeodeticCoordinate gref, ECEFCoordinate pos) static GeodeticCoordinateecef2geodetic(double X, double Y, double Z) static GeodeticCoordinateecef2geodetic(ECEFCoordinate coord) static ECEFCoordinateenu2ecef(ENUCoordinate data, GeodeticCoordinate ref) static GeodeticCoordinateenu2Geodetic(GeodeticCoordinate refg, ENUCoordinate pos) static NEZCoordinateenu2nez(ENUCoordinate enu) static ECEFCoordinategeodetic2ecef(GeodeticCoordinate coord) static ENUCoordinategeodetic2enu(GeodeticCoordinate ref, GeodeticCoordinate pos) static doublegeodeticLatToGeocentricLat(double lat, double heightMeters) static doublegetAngleBetweenAzimuths(double azimuth1, double azimuth2) Gets the angle in degrees between two vectors represented as azimuths in degrees clockwise from North.static doublegetAngleInRadians(double v1x, double v1y, double v2x, double v2y) static doubleGets the azimuthal gap of an origin solution given the epicenter location and the locations of the stations used in the origin solution.static doubleGets the azimuthal gap of an origin solution given a Vector of event-station azimuths.static doublegetAzimuth(double stla, double stlo, double evla, double evlo) Gets the azimuth of an event relative to a station on a spherical Earth.static doublegetAzimuthWGS84(double stla, double stlo, double evla, double evlo) Gets the azimuth of an event relative to a station using the WGS84 Earth model.static doublegetBAZ(double stla, double stlo, double evla, double evlo) Gets the back azimuth in degrees (azimuth from event to station) on a spherical Earth.static doublegetBAZWGS84(double stla, double stlo, double evla, double evlo) Gets the back azimuth in degrees (azimuth from event to station) using the WGS84 Earth modelstatic doublegetDegreesFromDeparture(double lat, double departureKm) Gets the change in longitude in degrees given a latitude and departure in kmstatic doublestatic doublegetDelay(GeodeticCoordinate sourcePosition, GeodeticCoordinate referenceElementPosition, GeodeticCoordinate observationElementPosition, double apparentVelocity) Computes the delay in passage of a plane wave from the reference element of an array to an observation element of the array.static doublegetDelta(double stla, double stlo, double evla, double evlo) Gets the distance in degrees of an event from a station on a spherical Earth.static doubleGets the distance in degrees of an event from a station on a spherical Earth.static doublegetDeltaWGS84(double stla, double stlo, double evla, double evlo) Gets the distance in degrees of an event from a station using the WGS84 Earth modelstatic doublegetDeltaWGS84(Vertex point1, Vertex point2) Gets the distance in degrees of two points on the surface of the Earth using the WGS84 Earth model.static doublegetDepartureKm(double lat, double delta) Gets the distance in km along a line of constant latitudestatic doublegetDistance(double stla, double stlo, double evla, double evlo) Gets the distance in km between two points on a spherical Earth.static doublegetDistance(Vertex pt1, Vertex pt2) Gets the distance in km between two points on a spherical Earth model.static doublegetDistance(GeodeticCoordinate pt1, GeodeticCoordinate pt2) static doublegetDistanceWGS84(double stla, double stlo, double evla, double evlo) Gets the distance in km between two points using the WGS84 Earth modelstatic doublegetEarthRadius(double latitude) Gets the Earth Radius in km as a function of latitude in degreesstatic doublegetEsaz(double evla, double evlo, double stla, double stlo) static doubleGets the Event to Station azimuth on a spherical Earth model.static doublegetEsazWGS84(Vertex event, Vertex sta) Gets the Event to Station azimuth using the WGS84 Earth model.static GeodeticCoordinategetGeodeticCoords(GeodeticCoordinate coordOrigin, NEZCoordinate localCoords) static voidgetGreatCircleArc(GeographicCoordinate coord1, GeographicCoordinate coord2, double az, double dist, double[] lats, double[] lons, int npts) static doublegetGreatCircleAzimuth(double lat1, double lon1, double lat2, double lon2) Returns a great-circle azimuth in degrees between two points specified by their latitude and longitude in degrees.static doublegetGreatCircleDelta(double lat1, double lon1, double lat2, double lon2) Returns a great-circle distance in degrees between two points specified by their latitude and longitude in degrees.static doublestatic ArrayList<NEZCoordinate>getLocalCoords(GeodeticCoordinate coordOrigin, ArrayList<GeodeticCoordinate> vertices) static ArrayList<NEZCoordinate>getLocalCoords(GeodeticCoordinate coordOrigin, Vertex[] vertices) static NEZCoordinategetLocalCoords(GeodeticCoordinate coordOrigin, GeodeticCoordinate position) static doublegetLocalRadiusFromLatitude(double latitude, double depth) A convience method to calculate the Local Radius based on the latitude in degreesstatic doublegetSeaz(double evla, double evlo, double stla, double stlo) static doubleGets the station to event azimuth.static doublestatic doublestatic Vertexreckon(double latIn, double lonIn, double deltaIn, double azimuthIn) Calculate point at azimuth and distance from another point.static VertexreckonWGS84(double latIn, double lonIn, double deltaIn, double azimuthIn) static Vertex[]smallCircle(Vertex center, double radius, int npts) Returns an array of Vertex objects defining points on a small circle of radius radius centered at the point center.track(double startLat, double startLon, double endLat, double endLon, int npts) Computes a vector of waypoints (including the start and end) for a great-circle track defined by its start and end points.
-
Field Details
-
DEGREES_TO_RADIANS
public static final double DEGREES_TO_RADIANS- See Also:
-
KM_PER_NAUTICAL_MILE
public static final double KM_PER_NAUTICAL_MILE- See Also:
-
MINUTES_PER_DEGREE
public static final int MINUTES_PER_DEGREE- See Also:
-
RADIANS_TO_DEGREES
public static final double RADIANS_TO_DEGREES- See Also:
-
-
Method Details
-
enu2Geodetic
-
getSeparationMeters
-
getDistance
-
getAngleBetweenAzimuths
public static double getAngleBetweenAzimuths(double azimuth1, double azimuth2) Gets the angle in degrees between two vectors represented as azimuths in degrees clockwise from North.- Parameters:
azimuth1- Azimuth of the first vector in degrees clockwise from North.azimuth2- Azimuth of the second vector in degrees clockwise from North.- Returns:
- The angle between the two azimuths in degrees.
-
getAngleInRadians
public static double getAngleInRadians(double v1x, double v1y, double v2x, double v2y) -
getAzGapFromAzVector
Gets the azimuthal gap of an origin solution given a Vector of event-station azimuths.- Parameters:
az- The Vector of event-station azimuths- Returns:
- The azgap value
-
getAzgap
Gets the azimuthal gap of an origin solution given the epicenter location and the locations of the stations used in the origin solution.- Parameters:
evla- Event latitudeevlo- Event longitudestla- A Vector of station latitudesstlo- A Vector of station longitudes- Returns:
- The azgap value
-
getAzimuth
public static double getAzimuth(double stla, double stlo, double evla, double evlo) Gets the azimuth of an event relative to a station on a spherical Earth.- Parameters:
stla- Station latitudestlo- Station longitudeevla- Event latitudeevlo- Event longitude- Returns:
- The azimuth of the event relative to the station
-
getAzimuthWGS84
public static double getAzimuthWGS84(double stla, double stlo, double evla, double evlo) Gets the azimuth of an event relative to a station using the WGS84 Earth model.- Parameters:
stla- Station latitudestlo- Station longitudeevla- Event latitudeevlo- Event longitude- Returns:
- The azimuth of the event relative to the station
-
getBAZ
public static double getBAZ(double stla, double stlo, double evla, double evlo) Gets the back azimuth in degrees (azimuth from event to station) on a spherical Earth.- Parameters:
stla- Station latitudestlo- Station longitudeevla- Event latitudeevlo- Event longitude- Returns:
- The back azimuth value
-
getBAZWGS84
public static double getBAZWGS84(double stla, double stlo, double evla, double evlo) Gets the back azimuth in degrees (azimuth from event to station) using the WGS84 Earth model- Parameters:
stla- Station latitudestlo- Station longitudeevla- Event latitudeevlo- Event longitude- Returns:
- The back azimuth value
-
getDegreesFromDeparture
public static double getDegreesFromDeparture(double lat, double departureKm) Gets the change in longitude in degrees given a latitude and departure in km- Parameters:
lat- The latitude at which to compute.departureKm- The departure in km.- Returns:
- the change in longitude.
-
getDegreesPerKilometer
public static double getDegreesPerKilometer() -
getDelay
public static double getDelay(GeodeticCoordinate sourcePosition, GeodeticCoordinate referenceElementPosition, GeodeticCoordinate observationElementPosition, double apparentVelocity) Computes the delay in passage of a plane wave from the reference element of an array to an observation element of the array. The array is assumed to be small enough in aperature that the plane-wave approximation is valid and that errors introduced by assigning a local Cartesian coordinate system are small.- Parameters:
sourcePosition- The position of the source of the plane wave (used to determine the back azimuth.)referenceElementPosition- The position of the reference element of the array.observationElementPosition- The position of the element for which the delay is to be computed.apparentVelocity- The apparent velocity of the plane wave in km/sec.- Returns:
- The delay in seconds between when the wavefront crosses the reference element and when it crosses the observation element.
-
getDelta
public static double getDelta(double stla, double stlo, double evla, double evlo) Gets the distance in degrees of an event from a station on a spherical Earth.- Parameters:
stla- Station latitude.stlo- Station longitude.evla- Event latitude.evlo- Event longitude.- Returns:
- The distance in degrees.
-
getDelta
Gets the distance in degrees of an event from a station on a spherical Earth.- Parameters:
sta- Vertex object containing station coordinates.event- Vertex object containing the event epicentral coordinates.- Returns:
- The distance in degrees.
-
getDeltaWGS84
public static double getDeltaWGS84(double stla, double stlo, double evla, double evlo) Gets the distance in degrees of an event from a station using the WGS84 Earth model- Parameters:
stla- Station latitudestlo- Station longitudeevla- Event latitudeevlo- Event longitude- Returns:
- The distance in degrees
-
getDeltaWGS84
Gets the distance in degrees of two points on the surface of the Earth using the WGS84 Earth model.- Parameters:
point1- The first point.point2- The second point.- Returns:
- The distance in degrees.
-
getDepartureKm
public static double getDepartureKm(double lat, double delta) Gets the distance in km along a line of constant latitude- Parameters:
lat- The latitude at which to compute.delta- The distance in degrees- Returns:
- the departure in km
-
getDistance
public static double getDistance(double stla, double stlo, double evla, double evlo) Gets the distance in km between two points on a spherical Earth.- Parameters:
stla- Station latitudestlo- Station longitudeevla- Event latitudeevlo- Event longitude- Returns:
- The distance in kilometers
-
getDistance
Gets the distance in km between two points on a spherical Earth model.- Parameters:
pt1- Vertex object representing first point.pt2- Vertex object representing second point.- Returns:
- The distance in km.
-
getDistanceWGS84
public static double getDistanceWGS84(double stla, double stlo, double evla, double evlo) Gets the distance in km between two points using the WGS84 Earth model- Parameters:
stla- Station latitudestlo- Station longitudeevla- Event latitudeevlo- Event longitude- Returns:
- The distance in kilometers
-
getEarthRadius
public static double getEarthRadius(double latitude) Gets the Earth Radius in km as a function of latitude in degrees- Parameters:
latitude- The latitude in degrees of the place where the radius is desired- Returns:
- The Earth Radius value in km
-
getEsaz
Gets the Event to Station azimuth on a spherical Earth model.- Parameters:
event- The epicentral Vertex.sta- The station Vertex.- Returns:
- The azimuth of the station relative to the event epicenter in degrees.
-
getEsaz
public static double getEsaz(double evla, double evlo, double stla, double stlo) -
getEsazWGS84
Gets the Event to Station azimuth using the WGS84 Earth model.- Parameters:
event- The epicentral Vertex.sta- The station Vertex.- Returns:
- The azimuth of the station relative to the event epicenter in degrees.
-
getGeodeticCoords
public static GeodeticCoordinate getGeodeticCoords(GeodeticCoordinate coordOrigin, NEZCoordinate localCoords) -
getGreatCircleAzimuth
public static double getGreatCircleAzimuth(double lat1, double lon1, double lat2, double lon2) Returns a great-circle azimuth in degrees between two points specified by their latitude and longitude in degrees.- Parameters:
lat1- Latitude of the first point in degrees.lon1- Longitude of the second point in degrees.lat2- Latitude of the second point in degrees.lon2- Longitude of the second point in degrees.- Returns:
- great-circle distance in degrees
-
getGreatCircleDelta
public static double getGreatCircleDelta(double lat1, double lon1, double lat2, double lon2) Returns a great-circle distance in degrees between two points specified by their latitude and longitude in degrees.- Parameters:
lat1- Latitude of the first point in degrees.lon1- Longitude of the second point in degrees.lat2- Latitude of the second point in degrees.lon2- Longitude of the second point in degrees.- Returns:
- great-circle distance in degrees
-
getKilometersPerDegree
public static double getKilometersPerDegree() -
getLocalCoords
public static ArrayList<NEZCoordinate> getLocalCoords(GeodeticCoordinate coordOrigin, Vertex[] vertices) -
getLocalCoords
public static ArrayList<NEZCoordinate> getLocalCoords(GeodeticCoordinate coordOrigin, ArrayList<GeodeticCoordinate> vertices) -
getLocalCoords
public static NEZCoordinate getLocalCoords(GeodeticCoordinate coordOrigin, GeodeticCoordinate position) -
enu2nez
-
getLocalRadiusFromLatitude
public static double getLocalRadiusFromLatitude(double latitude, double depth) A convience method to calculate the Local Radius based on the latitude in degrees- Parameters:
latitude- - in DEGREESdepth- - in km- Returns:
- the local radius at the given latitude
-
getSeaz
public static double getSeaz(double evla, double evlo, double stla, double stlo) -
getSeaz
Gets the station to event azimuth.- Parameters:
event- position of the event epicenter.sta- position of the station.- Returns:
- the station-to-event azimuth in degrees.
-
getWGS84RadiusKm
public static double getWGS84RadiusKm() -
reckonWGS84
-
reckon
Calculate point at azimuth and distance from another point. Returns a Vertex at great-circle distance delta and azimuth Azimuth.- Parameters:
latIn- latitude in degrees of start pointdeltaIn- great-circle distance between points in degreesazimuthIn- east of north (-180 LTEQ Azimuth LTEQ 180 )lonIn- Longitude of the start point- Returns:
- Vertex of point reckoned to
-
smallCircle
Returns an array of Vertex objects defining points on a small circle of radius radius centered at the point center. The number of Vertex objects returned is equal to npts. TODO note as written this returns (npts + 1) Vertices- Parameters:
center- A Vertex object defining the center latitude-longitude of the small circle.radius- The radius of the small circle in degrees.npts- The number of points to create.- Returns:
- An array of Vertex objects defining the requested small circle.
-
track
public static List<Vertex> track(double startLat, double startLon, double endLat, double endLon, int npts) Computes a vector of waypoints (including the start and end) for a great-circle track defined by its start and end points.- Parameters:
startLat- The starting point latitude in degrees.startLon- The starting point longitude in degrees.endLat- The ending point latitude in degrees.endLon- The ending point longitude in degrees.npts- The number of desired points in the track.- Returns:
- The Vector of Vertex objects that define the track.
-
getGreatCircleArc
public static void getGreatCircleArc(GeographicCoordinate coord1, GeographicCoordinate coord2, double az, double dist, double[] lats, double[] lons, int npts) -
geodeticLatToGeocentricLat
public static double geodeticLatToGeocentricLat(double lat, double heightMeters) -
geodetic2ecef
-
ecef2geodetic
-
ecef2geodetic
-
ecef2enu
-
geodetic2enu
-
enu2ecef
-