World vector in spherical earth coordinates.
Each of the three coordinate parameters (rho, theta, phi) is a 2-D matrix so that the WaveQ3D model can perform ray tracing operations using fast uBLAS operations across the entire wavefront.
Two different coordinate systems use this class as their underlying type:
wvector | ( | size_t | rows = 1 , |
|
size_t | cols = 1 | |||
) |
Constructs a new coordinate from matrix dimensions.
rows | Number of rows | |
cols | Number of columns |
void clear | ( | ) | [inline] |
Reset all data elements back to zero.
void distance | ( | const wvector1 & | origin, | |
matrix< double > & | result | |||
) | const |
Compute the straight line distance between this point and some other point in space.
Compute the square of the straight line distance between this point and some other point in space.
The distance is related to the dot product by the equation:
distance = sqrt( r1*r1 + r2*r2 - 2 dot(r1,r2) )
This as the general form of Pythagoras' theorem.
origin | Point from which distance is measured. | |
result | Distance from this point to the origin point. |
void distance2 | ( | const wvector1 & | origin, | |
matrix< double > & | result | |||
) | const |
Compute the square of the straight line distance between this point and some other point in space.
The square of the distance is related to the dot product by the equation:
distance^2 = r1*r1 + r2*r2 - 2 dot(r1,r2)
This as the general form of Pythagoras' theorem.
origin | Point from which distance is measured. | |
result | Distance from this point to the origin point. |
void dot | ( | const wvector1 & | other, | |
matrix< double > & | result | |||
) | const |
Compute the dot product between this vector and some other spherical earth vector.
The transformation from cartesian to spherical earth coordinate shows that:
dot product = x1*x2 + y1*y2 + z1*z2 = r1*r2 * ( cos(t1)cos(t2) + sin(t1)sin(t2)cos(p1-p2) )
This implementation uses the haversine formula to avoid errors in the dot product when distances are small.
dot product = r1*r2 * { 1-2*{ sin^2[(t1-t2)/2] + sin(t1)sin(t2)sin^2[(p1-p2)/2] } }
other | Second vector in the dot product. | |
result | Dot product between these two vectors. |
Weisstein, Eric W. "Spherical Trigonometry." From MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/SphericalTrigonometry.html.
E. Williams, "Aviation Formulary V1.46", http://williams.best.vwh.net/avform.htm
void dotnorm | ( | const wvector1 & | other, | |
matrix< double > & | result | |||
) | const |
Dot product divided by the magnitude of the two vectors.
Used to compute the angle between vectors. Uses the haversine formula to avoid errors for short distances.
cos(angle) = dot(v1,v2) / ( |v1| |v2| ) = ( cos(t1)cos(t2) + sin(t1)sin(t2)cos(p1-p2) ) = { 1-2*( sin^2[(t1-t2)/2] + sin(t1)sin(t2)sin^2[(p1-p2)/2] ) }
other | Second vector in the dot product. | |
result | Normalized dot product between these two vectors. |
void phi | ( | size_t | row, | |
size_t | col, | |||
double | p | |||
) | [inline] |
Indexed version for single longitude component definition.
row | Row index of the element to access. | |
col | Column index of the element to access. | |
p | Longitude coordinate in radians. |
double phi | ( | size_t | row, | |
size_t | col | |||
) | const [inline] |
Indexed version for single longitude component retrieval.
row | Row index of the element to access. | |
col | Column index of the element to access. |
void phi | ( | const matrix_expression< E > & | p, | |
bool | no_alias = true | |||
) | [inline] |
Defines the longitude component of the spherical earth coordinate.
p | Longitude coordinate in radians. | |
no_alias | Use uBLAS noalias() assignment speed-up if true. |
const matrix<double>& phi | ( | ) | const [inline] |
Retrieves the longitude component of the spherical earth coordinate system.
Measured as the angle east from the prime meridian.
void rho | ( | size_t | row, | |
size_t | col, | |||
double | r | |||
) | [inline] |
Indexed version for single radial component definition.
row | Row index of the element to access. | |
col | Column index of the element to access. | |
r | Radial coordinate in meters. |
double rho | ( | size_t | row, | |
size_t | col | |||
) | const [inline] |
Indexed version for single radial component retrieval.
row | Row index of the element to access. | |
col | Column index of the element to access. |
void rho | ( | const matrix_expression< E > & | r, | |
bool | no_alias = true | |||
) | [inline] |
Defines the radial component of the spherical earth coordinate.
r | Radial coordinate in meters. | |
no_alias | Use uBLAS noalias() assignment speed-up if true. |
const matrix<double>& rho | ( | ) | const [inline] |
Retrieves the radial component of the spherical earth coordinate system.
Measured as the distance from the center of curvature for the area of operations. Because the shape of the earth is elliptical, this is not the same as the distance from the center of the earth.
size_t size1 | ( | ) | const [inline] |
Number of rows in each coordinate.
size_t size2 | ( | ) | const [inline] |
Number of columns in each coordinate.
void theta | ( | size_t | row, | |
size_t | col, | |||
double | t | |||
) | [inline] |
Indexed version for single colatitude component definition.
Caches the sine of the colatitude as a side effect.
row | Row index of the element to access. | |
col | Column index of the element to access. | |
t | Colatitude coordinate in radians. |
double theta | ( | size_t | row, | |
size_t | col | |||
) | const [inline] |
Indexed version for single colatitude component retrieval.
row | Row index of the element to access. | |
col | Column index of the element to access. |
void theta | ( | const matrix_expression< E > & | t, | |
bool | no_alias = true | |||
) | [inline] |
Defines the colatitude component of the spherical earth coordinate.
t | Colatitude coordinate in radians. | |
no_alias | Use uBLAS noalias() assignment speed-up if true. |
const matrix<double>& theta | ( | ) | const [inline] |
Retrieves the colatitude component of the spherical earth coordinate system.
Measured as the angle down from the north pole. This property is the complement of latitude, which is measured up from the equator.
matrix<double> _phi [private] |
Storage for the longitude component of the coordinate system.
matrix<double> _rho [private] |
Storage for the radial component of the coordinate system.
matrix<double> _theta [private] |
Storage for the colatitude component of the coordinate system.