USML
|
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:
- The spherical earth coordinate system measures absolute values of rho, theta, phi relative to a fixed geocentric reference system. - The ray direction coordinate system measures values relative the local basis vectors for rho, theta, phi. These basis vectors change based on the current location of the ray.
wvector | ( | unsigned | rows = 1 , |
unsigned | cols = 1 |
||
) |
Constructs a new coordinate from matrix dimensions.
rows | Number of rows |
cols | Number of columns |
|
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. |
|
inline |
Retrieves the longitude component of the spherical earth coordinate system.
Measured as the angle east from the prime meridian.
|
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. |
|
inline |
Indexed version for single longitude component retrieval.
row | Row index of the element to access. |
col | Column index of the element to access. |
|
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. |
|
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.
|
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. |
|
inline |
Indexed version for single radial component retrieval.
row | Row index of the element to access. |
col | Column index of the element to access. |
|
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. |
|
inline |
Number of rows in each coordinate.
|
inline |
Number of columns in each coordinate.
|
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.
|
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. |
|
inline |
Indexed version for single colatitude component retrieval.
row | Row index of the element to access. |
col | Column index of the element to access. |
|
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. |
|
private |
Storage for the longitude component of the coordinate system.
|
private |
Storage for the radial component of the coordinate system.
|
private |
Storage for the colatitude component of the coordinate system.