SLBM
3.0
Regional Seismic Travel Time
|
The Location Class manages a single point in/on the Earth, which is described by the GRS80 ellipsoid. More...
#include <Location.h>
Inherited by slbm::GridProfile.
Public Member Functions | |
Location () | |
virtual | ~Location () |
Location (const Location &location) | |
Location (const double &lat, const double &lon, const double &depth=0) | |
Location (const double v[], const double &radius) | |
Location (const Location &loc1, const Location &loc2) | |
Location & | operator= (const Location &other) |
bool | operator== (const Location &other) const |
bool | operator!= (const Location &other) |
string | toString () const |
void | setLocation (const double &lat, const double &lon, const double &depth) |
void | setLocation (const double *u, const double &r) |
void | setRadius (const double &r) |
double | getRadius () const |
double | getEarthRadius () const |
double | getDepth () const |
void | setDepth (const double &depth) |
double | distance (const Location &other) const |
double | distanceKm (Location &other) const |
double | distanceDegrees (const Location &other) const |
double | azimuth (const Location &other) const |
Find the azimuth from this Location to some other Location. Result will be between 0 and 2*PI radians. More... | |
double | azimuthDegrees (const Location &other) const |
Find the azimuth from this Location to some other Location. Result will be between 0 and 360 degrees. More... | |
double | azimuth (const Location &other, const double &errorValue) const |
Find the azimuth from this Location to some other Location. Result will be between 0 and 2*PI radians. If current position is the north or south pole, or if current position and other position are conincident, returns specified errorValue. More... | |
double | azimuthDegrees (const Location &other, const double &errorValue) const |
Find the azimuth from this Location to some other Location. Result will be between 0 and 360 degrees. If current position is the north or south pole, or if current position and other position are conincident, returns specified errorValue. More... | |
double | getLat () const |
Retrieve the geographic latitude of this Location, radians. More... | |
double | getGeocentricLat () const |
Retrieve the geocentric latitude of this Location, radians. More... | |
double | getGeocentricLatDegrees () const |
Retrieve the geocentric latitude of this Location, degrees. More... | |
double | getLon () const |
Retrieve the longitude of this Location. Value will be between -PI and PI radians. More... | |
double | getLatDegrees () const |
Retrieve the geographic latitude of this Location, degrees. More... | |
double | getLonDegrees () const |
Retrieve the longitude of this Location. Value will be between -180 and 180 degrees. More... | |
const double * | getUnitVector () |
void | getUnitVector (double x[3]) |
void | setUnitVector (double x[3]) |
void | move (const double &azimuth, const double &distance, Location &loc) const |
Retrieve a Location that is a specified distance away from this Location, in a specified direction. More... | |
bool | cross (const Location &x, Location &loc) const |
void | rotate (Location &pole, double angle, Location &loc) const |
bool | vectorTripleProduct (const Location &other, double vtp[]) const |
Compute the vector triple product (this x other) x this, normalized to unit length. Returns true if valid, false if triple product has zero length, which will happen when this and other are coincident or PI radians apart. More... | |
void | move (const double vtp[], const double &a, Location &loc) const |
Move this Location object a specified angular distance (radians) in the direction specified by vtp. More... | |
void | move_north (const double x[], const double &distance, double z[]) const |
void | move_north (const double &distance, Location &loc) const |
void | rotate (const double x[], const double p[], const double &a, double z[]) const |
double | scalarTripleProduct (const Location &loc1, const Location &loc2) const |
double | scalarTripleProduct (const double u[], const double w[]) const |
double | scalarTripleProduct (const double u[], const double v[], const double w[]) const |
bool | vectorTripleProduct (const double u[], const double v[], double vtp[]) const |
Compute the normalized vector triple product (u x v) x u and and store result in vtp. More... | |
bool | vectorTripleProductNorthPole (const double u[], double w[]) const |
Compute the normalized vector triple product (u x northPole) x u and store result in w. Returns true if w has finite length, false if length(w) is zero. More... | |
void | move (const double v[], const double vtp[], const double &a, double u[]) const |
Move unit vector v in direction of vtp by distance a and store result in u. vtp is assumed to be a unit vector normal to v. More... | |
double | angle (const double u[], const double v[]) const |
double | dot (const Location &other) const |
double | dot (const double u[], const double v[]) const |
double | cross (const double u[], const double v[], double w[]) const |
double | crossNorth (const double u[], double w[]) const |
double | normalize (double v[]) const |
double | length (const double v[]) const |
Static Public Member Functions | |
static int | getClassCount () |
Static Public Attributes | |
static double | EARTH_RADIUS |
Protected Attributes | |
double | v [3] |
double | radius |
Static Protected Attributes | |
static int | locationClassCount |
The Location Class manages a single point in/on the Earth, which is described by the GRS80 ellipsoid. See geovectors.pdf for a thorough mathematical description of Location.
There is a parameterized constructor that takes a geographic latitude, longitude and depth as parameters and converts them to internal representation. There are also many methods for computing the distance between 2 Location objects, the azimuth from one Location to another, the radius of the Earth at a given location, retreiving points along a great circle path between two Location objects, etc.
slbm::Location::Location | ( | ) |
|
virtual |
slbm::Location::Location | ( | const Location & | location | ) |
slbm::Location::Location | ( | const double & | lat, |
const double & | lon, | ||
const double & | depth = 0 |
||
) |
slbm::Location::Location | ( | const double | v[], |
const double & | radius | ||
) |
Parameterized constructor. Returns a new Location which is the mean of the two specified Locations.
|
inline |
Angular distance between two 3-component unit vectors, in radians. Vectors are assumed to be unit length on input.
u | unit vector one. |
v | unit vector two. |
|
inline |
|
inline |
Find the azimuth from this Location to some other Location. Result will be between 0 and 2*PI radians. If current position is the north or south pole, or if current position and other position are conincident, returns specified errorValue.
other | the other location to which the azimuth is requested. |
errorValue | the value to return when things go badly. |
|
inline |
|
inline |
Find the azimuth from this Location to some other Location. Result will be between 0 and 360 degrees. If current position is the north or south pole, or if current position and other position are conincident, returns specified errorValue.
other | the other location to which the azimuth is requested. |
errorValue | the value to return when things go badly. |
Retrieve a Location which is normal to the plane containing the great circle path from this Location to another Location. Considering the Locations to be unit vectors, loc will be set to this cross x. The radius of the resulting vector will be set to radius of this Location. If this Location and Location x are parallel, then the resulting Location will be invalid (vector will have zero length) and the radius will be -1 km.
x | the other Location which, together with this Location, define the great circle path. |
loc | the Location normal to the plane containing the great circle path. Invalid if this and loc are parallel. |
|
inline |
normalized cross product of two 3-component unit vectors.
u | vector<double> vector one. |
v | vector<double> vector two. |
w | set to u cross v, normalized to unit length. If u cross v has zero length, w will equal (0,0,0). |
|
inline |
normalized cross product of a 3-component unit vector with the north pole.
u | vector<double> vector one. |
w | set to u cross north, normalized to unit length. If u cross north has zero length, w will equal (0,0,0). |
|
inline |
|
inline |
double slbm::Location::distanceKm | ( | Location & | other | ) | const |
|
inline |
|
inline |
Dot product of two 3-component unit vectors.
u | vector one. |
v | vector two. |
|
static |
|
inline |
double slbm::Location::getEarthRadius | ( | ) | const |
Retrieve the radius of the Earth at the latitude of this Location.
|
inline |
Retrieve the latitude of this Location.
|
inline |
Retrieve the latitude of this Location.
|
inline |
Retrieve the latitude of this Location.
|
inline |
Retrieve the latitude of this Location.
|
inline |
Retrieve the longitude of this Location. Value will be between -PI and PI radians.
|
inline |
Retrieve the longitude of this Location. Value will be between -180 and 180 degrees.
|
inline |
Retrieve the radius of this Location object.
|
inline |
|
inline |
|
inline |
Find the length of a 3-element vector.
|
inline |
|
inline |
Move this Location object a specified angular distance (radians) in the direction specified by vtp, which is assumed to be a unit vector normal to this Location object's unit vector. vtp values are typically obtained by calling Location::vectorTripleProduct().
|
inline |
Move unit vector v in direction of vtp by distance a and store result in u. vtp is assumed to be a unit vector normal to v.
|
inline |
Return a location on the earth that is distance radians due north of positon x. If x is already at the north or south pole, then it is returned unmodified.
x | the position to be moved. |
distance | the distance, in radians, that x is to be moved toward the north. |
z | the 3-element unit vector representing the position after having moved distance north. |
|
inline |
|
inline |
Normalizes the input vector to unit length. Returns the length of the vector prior to normalization.
v | vector<double> |
|
inline |
bool slbm::Location::operator== | ( | const Location & | other | ) | const |
|
inline |
rotate 3d vector x clockwise around 3d vector p, by angle a. x and p are assumed to be unit vectors on input.
x | vector to be rotated |
p | pole about which rotation is to occur. |
a | double the amount of rotation, in radians. |
z | the rotated vector, normalized to unit length. |
|
inline |
Return the scalar triple product of loc1, loc2 and this. In other words (loc1 cross loc2) dot this. Since these are all unit vectors, the the result is cos(phi) where phi is the angle between this Location and loc1 cross loc2.
|
inline |
|
inline |
Return the scalar triple product (u cross v) dot w. If all are unit vectors, then the result is cos(phi) where phi is the angle between w and u cross c.
|
inline |
Set the depth of this Location.
depth | the desired depth in km. |
|
inline |
Set the location of this Location.
lat | the geographic latitude in radians. |
lon | the geographic longitude in radians. |
depth | the depth in km. |
|
inline |
Set the location of this Location.
u | unit vector of new position. |
r | radius of new position in km. |
|
inline |
Set the radius of this Location.
r | the radius in km. |
|
inline |
|
inline |
Returns a convenient string representation of this Location.
|
inline |
Compute the vector triple product (this x other) x this, normalized to unit length. Returns true if valid, false if triple product has zero length, which will happen when this and other are coincident or PI radians apart.
|
inline |
Compute the normalized vector triple product (u x v) x u and and store result in vtp. Returns true if vtp has finite length, false if length(vtp) is zero.
|
inline |
Compute the normalized vector triple product (u x northPole) x u and store result in w. Returns true if w has finite length, false if length(w) is zero.
|
static |
This variable is initialized to -1 in Location.cc, outside the class definition. There is a method SlbmInterface::fixEarthRadius(double) that will modify this value. If this value is less than zero, then Location::getEarthRadius() will return the radius of the earth that is a function of geocentric latitude (larger at the equator, smaller at the poles). If this value is > 0, then getEarthRadius() returns this value.
|
staticprotected |
|
protected |
The distance from the center of the earth to this location in km.
|
protected |
v is the geocentric unit vector that describes the position on the earth. The origin of the vector is at the center of the earth. The x-component points to lon,lat = 0,0. y-component points to lon,lat = PI/2,0 and the z-component points to lon,lat = 0,PI/2.