RSTT
3.2.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>
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.
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.
Definition at line 59 of file Location.h.
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. |
Definition at line 779 of file Location.h.
|
inline |
Find the azimuth from this Location to some other Location. Result will be between 0 and 2*PI radians.
Find the azimuth from this Location to some other Location. Result will be between 0 and 2*PI radians.
other | the other location to which the azimuth is requested. |
Definition at line 593 of file Location.h.
|
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.
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. |
Definition at line 598 of file Location.h.
|
inline |
Find the azimuth from this Location to some other Location. Result will be between 0 and 360 degrees.
Find the azimuth from this Location to some other Location. Result will be between 0 and 360 degrees.
other | the other location to which the azimuth is requested. |
Definition at line 624 of file Location.h.
|
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.
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. |
Definition at line 629 of file Location.h.
|
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). |
Definition at line 809 of file Location.h.
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. |
Definition at line 798 of file Location.h.
|
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). |
Definition at line 820 of file Location.h.
|
inline |
|
inline |
double slbm::Location::distanceKm | ( | Location & | other | ) | const |
|
inline |
Dot product of two 3-component unit vectors.
u | vector one. |
v | vector two. |
Definition at line 790 of file Location.h.
|
inline |
Dot product of the unit vector that backs this Location and the unit vector that backs Location other.
other | the other Location |
Definition at line 784 of file Location.h.
|
static |
|
inline |
Retrieve the depth of this Location.
Definition at line 573 of file Location.h.
double slbm::Location::getEarthRadius | ( | ) | const |
Retrieve the radius of the Earth at the latitude of this Location.
|
inline |
Retrieve the geocentric latitude of this Location, radians.
Retrieve the latitude of this Location.
Definition at line 250 of file Location.h.
|
inline |
Retrieve the geocentric latitude of this Location, degrees.
Retrieve the latitude of this Location.
Definition at line 257 of file Location.h.
|
inline |
Retrieve the geographic latitude of this Location, radians.
Retrieve the latitude of this Location.
Definition at line 542 of file Location.h.
|
inline |
Retrieve the geographic latitude of this Location, degrees.
Retrieve the latitude of this Location.
Definition at line 553 of file Location.h.
|
inline |
Retrieve the longitude of this Location. Value will be between -PI and PI radians.
Retrieve the longitude of this Location. Value will be between -PI and PI radians.
Definition at line 548 of file Location.h.
|
inline |
Retrieve the longitude of this Location. Value will be between -180 and 180 degrees.
Retrieve the longitude of this Location. Value will be between -180 and 180 degrees.
Definition at line 558 of file Location.h.
|
inline |
Retrieve the radius of this Location object.
Definition at line 563 of file Location.h.
|
inline |
Definition at line 282 of file Location.h.
|
inline |
Definition at line 284 of file Location.h.
|
inline |
Find the length of a 3-element vector.
Definition at line 859 of file Location.h.
|
inline |
Retrieve a Location that is a specified distance away from this Location, in a specified direction.
Retrieve a Location that is a specified distance away from this Location, in a specified direction. The returned Location will have the same radius as this location.
azimuth | the azimuth from this Location to the desired Location, in radians, measured clockwise from north. |
distance | the distance from this Location to the desired Location, in radians. |
loc | the Location that has been moved relative to this Location. |
Definition at line 638 of file Location.h.
|
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.
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.
Definition at line 679 of file Location.h.
|
inline |
Move this Location object a specified angular distance (radians) in the direction specified by vtp.
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().
vtp | a 3 component unit vector normal to this Location. |
a | the angular distance from this Location to the desired Location, in radians. |
loc | the Location object which has been relocated as requested. |
Definition at line 670 of file Location.h.
|
inline |
Return a location on the earth that is distance radians due north of this Location. If this is already at the north or south pole, then it is returned unmodified.
distance | the distance, in radians, that x is to be moved toward the north. |
loc | the Location after having moved distance north. |
Definition at line 660 of file Location.h.
|
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. |
Definition at line 651 of file Location.h.
|
inline |
Normalizes the input vector to unit length. Returns the length of the vector prior to normalization.
v | vector<double> |
Definition at line 842 of file Location.h.
|
inline |
Equality operator. Returns false if other Location object has the exact same horizontal position and radius as this Location object.
Definition at line 113 of file Location.h.
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. |
Definition at line 754 of file Location.h.
Rotate this Location around Location pole by angle a. When looking in direction of pole's unit vector, clockwise rotation is positive.
pole | the pole around which this Location is to be rotated. |
angle | the angular distance by which this Location is to be rotated around pole, in radians. |
loc | the Location that results from rotating this Location around pole. |
Definition at line 747 of file Location.h.
|
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.
Definition at line 732 of file Location.h.
|
inline |
Return the scalar triple product of u, w, and this Location objects unit vector. In other words (u cross w) dot v. If u and w are unit vectors, then the result is cos(phi) where phi is the angle between this Location and u cross w.
Definition at line 739 of file Location.h.
|
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.
Definition at line 727 of file Location.h.
|
inline |
Set the depth of this Location.
depth | the desired depth in km. |
Definition at line 578 of file Location.h.
|
inline |
Set the location of this Location.
lat | the geographic latitude in radians. |
lon | the geographic longitude in radians. |
depth | the depth in km. |
Definition at line 527 of file Location.h.
|
inline |
Set the location of this Location.
u | unit vector of new position. |
r | radius of new position in km. |
Definition at line 133 of file Location.h.
|
inline |
Set the radius of this Location.
r | the radius in km. |
Definition at line 568 of file Location.h.
|
inline |
Definition at line 286 of file Location.h.
|
inline |
Returns a convenient string representation of this Location.
Definition at line 866 of file Location.h.
|
inline |
Compute the normalized vector triple product (u x v) x u and and store result in vtp.
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.
Definition at line 698 of file Location.h.
|
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.
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.
Definition at line 691 of file Location.h.
|
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.
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.
Definition at line 718 of file Location.h.
|
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.
Definition at line 502 of file Location.h.
|
staticprotected |
Definition at line 508 of file Location.h.
|
protected |
The distance from the center of the earth to this location in km.
Definition at line 521 of file Location.h.
|
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.
Definition at line 516 of file Location.h.