Go to the documentation of this file.
84 if (absza < ANGTOL || absza > 180 -
ANGTOL) {
127 if (absza < ANGTOL || absza > 180 -
ANGTOL) {
136 const Numeric coslat = cos(latrad);
137 const Numeric sinlat = sin(latrad);
138 const Numeric dr = coslat *
dx + sinlat * dz;
150 if (std::isnan(za)) {
156 if (std::isnan(za)) {
187 assert(
abs(lat2 - lat1) <= 180);
288 const Numeric b = 2 * (
dx * (xl - xc) + dz * (zl - zc));
290 xc * xc + zc * zc + xl * xl + zl * zl - 2 * (xc * xl + zc * zl) - r * r;
363 assert(za >= -180 && za <= 180);
368 const Numeric coslat = cos(latrad);
369 const Numeric sinlat = sin(latrad);
370 const Numeric cosza = cos(zarad);
371 const Numeric sinza = sin(zarad);
380 dx = coslat * dr - sinlat * dlat;
381 dz = sinlat * dr + coslat * dlat;
444 if (za0 < ANGTOL || za0 > 180 -
ANGTOL) {
455 bool ns_case =
false;
456 bool lon_flip =
false;
478 const Numeric coslat = cos(latrad);
479 const Numeric sinlat = sin(latrad);
480 const Numeric coslon = cos(lonrad);
481 const Numeric sinlon = sin(lonrad);
489 if (std::isnan(za)) {
524 const Numeric dlat = -sinlat * coslon / r *
dx -
525 sinlat * sinlon / r * dy + coslat / r * dz;
526 const Numeric dlon = -sinlon / coslat / r *
dx + coslon / coslat / r * dy;
530 if (std::isnan(aa)) {
536 }
else if (dlon < 0) {
576 if (za0 < ANGTOL || za0 > 180 -
ANGTOL) {
590 if (
abs(
lon - lon0) < 1) {
632 l =
sqrt(
dx *
dx + dy * dy + dz * dz);
670 poslos2cart(
x,
y, z,
dx, dy, dz, r,
lat,
lon, za, aa);
672 l_tan =
sqrt(r * r - ppc * ppc);
837 const Numeric b = 2 * (
dx * (xl - xc) + dy * (yl - yc) + dz * (zl - zc));
838 const Numeric c = xc * xc + yc * yc + zc * zc + xl * xl + yl * yl + zl * zl -
839 2 * (xc * xl + yc * yl + zc * zl) - r * r;
894 const Numeric cosdang = cos(dang);
895 const Numeric sindang = sin(dang);
897 const Numeric coslat = cos(latrad);
898 const Numeric sinlat = sin(latrad);
901 lat2 = sinlat * cosdang + coslat * sindang * cos(aarad);
902 lon2 = lon1 +
RAD2DEG * (atan2(sin(aarad) * sindang * coslat,
903 cosdang - sinlat * lat2));
949 const Numeric coslat = cos(latrad);
950 const Numeric sinlat = sin(latrad);
951 const Numeric coslon = cos(lonrad);
952 const Numeric sinlon = sin(lonrad);
954 const Numeric dr = coslat * coslon *
dx + coslat * sinlon * dy + sinlat * dz;
956 -sinlat * coslon / r1 *
dx - sinlat * sinlon / r1 * dy + coslat / r1 * dz;
957 const Numeric dlon = -sinlon / coslat / r1 *
dx + coslon / coslat / r1 * dy;
961 if (std::isnan(aa)) {
967 }
else if (dlon < 0) {
1011 assert(za >= 0 && za <= 180);
1035 const Numeric coslat = cos(latrad);
1036 const Numeric sinlat = sin(latrad);
1037 const Numeric coslon = cos(lonrad);
1038 const Numeric sinlon = sin(lonrad);
1039 const Numeric cosza = cos(zarad);
1040 const Numeric sinza = sin(zarad);
1041 const Numeric cosaa = cos(aarad);
1042 const Numeric sinaa = sin(aarad);
1051 const Numeric dlat = sinza * cosaa;
1052 const Numeric dlon = sinza * sinaa / coslat;
1054 dx = coslat * coslon * dr - sinlat * coslon * dlat - coslat * sinlon * dlon;
1055 dz = sinlat * dr + coslat * dlat;
1056 dy = coslat * sinlon * dr - sinlat * sinlon * dlat + coslat * coslon * dlon;
1153 return b /
sqrt(c * ct * ct + st * st);
1179 else if (gp.
fd[0] == 1)
1213 slat * slat + cos(
DEG2RAD * lat1) * cos(
DEG2RAD * lat2) * slon * slon;
1249 x = r * cos(latrad);
1250 y =
x * sin(lonrad);
1251 x =
x * cos(lonrad);
1252 z = r * sin(latrad);
1279 longrid_out = longrid_in;
1280 if (longrid_in[longrid_in.
nelem() - 1] >=
lon + 360.)
1281 longrid_out += -360.;
1282 else if (longrid_in[0] <=
lon - 360.)
1283 longrid_out += 360.;
1302 throw std::runtime_error(
"Latitude values < -180.0 are not supported.");
1305 throw std::runtime_error(
"Latitude values > 180.0 are not supported.");
1320 while (
lon > 360.0) {
Index atmosphere_dim(Workspace &ws) noexcept
void sph2cart(Numeric &x, Numeric &y, Numeric &z, const Numeric &r, const Numeric &lat, const Numeric &lon)
sph2cart
const Numeric ANGTOL
Width of zenith and nadir directions.
void cycle_lat_lon(Numeric &lat, Numeric &lon)
Cyclic latitude longitude coordinates.
Numeric lat(Workspace &ws) noexcept
void gridpos(ArrayOfGridPos &gp, ConstVectorView old_grid, ConstVectorView new_grid, const Numeric &extpolfac)
Set up a grid position Array.
Numeric sign(const Numeric &x)
sign
Vector lat_grid(Workspace &ws) noexcept
Numeric refell2d(ConstVectorView refellipsoid, ConstVectorView lat_grid, const GridPos gp)
refell2d
Numeric last(ConstVectorView x)
last
Numeric sphdist(const Numeric &lat1, const Numeric &lon1, const Numeric &lat2, const Numeric &lon2)
sphdist
const Numeric POLELAT
Size of north and south poles.
Vector y(Workspace &ws) noexcept
void geompath_tanpos_3d(Numeric &r_tan, Numeric &lat_tan, Numeric &lon_tan, Numeric &l_tan, const Numeric &r, const Numeric &lat, const Numeric &lon, const Numeric &za, const Numeric &aa, const Numeric &ppc)
geompath_tanpos_3d
void line_sphere_intersect(Numeric &x, Numeric &y, Numeric &z, const Numeric &xl, const Numeric &yl, const Numeric &zl, const Numeric &dx, const Numeric &dy, const Numeric &dz, const Numeric &xc, const Numeric &yc, const Numeric &zc, const Numeric &r)
geomtanpoint
void cart2sph(Numeric &r, Numeric &lat, Numeric &lon, const Numeric &x, const Numeric &y, const Numeric &z, const Numeric &lat0, const Numeric &lon0, const Numeric &za0, const Numeric &aa0)
cart2sph
Numeric lon(Workspace &ws) noexcept
Numeric sqrt(const Rational r)
Square root.
void cart2poslos(Numeric &r, Numeric &lat, Numeric &za, const Numeric &x, const Numeric &z, const Numeric &dx, const Numeric &dz, const Numeric &ppc, const Numeric &lat0, const Numeric &za0)
cart2poslos
Numeric pow(const Rational base, Numeric exp)
Power of.
void cart2pol(Numeric &r, Numeric &lat, const Numeric &x, const Numeric &z, const Numeric &lat0, const Numeric &za0)
cart2pol
Vector rte_pos(Workspace &ws) noexcept
Numeric pos2refell_r(const Index &atmosphere_dim, ConstVectorView refellipsoid, ConstVectorView lat_grid, ConstVectorView lon_grid, ConstVectorView rte_pos)
pos2refell_r
void line_circle_intersect(Numeric &x, Numeric &z, const Numeric &xl, const Numeric &zl, const Numeric &dx, const Numeric &dz, const Numeric &xc, const Numeric &zc, const Numeric &r)
geomtanpoint2d
Index nelem() const
Returns the number of elements.
Numeric geompath_l_at_r(const Numeric &ppc, const Numeric &r)
Calculates the length from the tangent point for the given radius.
void los2xyz(Numeric &za, Numeric &aa, const Numeric &r1, const Numeric &lat1, const Numeric &lon1, const Numeric &x1, const Numeric &y1, const Numeric &z1, const Numeric &x2, const Numeric &y2, const Numeric &z2)
los2xyz
NUMERIC Numeric
The type to use for all floating point numbers.
void lon_shiftgrid(Vector &longrid_out, ConstVectorView longrid_in, const Numeric lon)
lon_shiftgrid
Vector refellipsoid(Workspace &ws) noexcept
Vector lon_grid(Workspace &ws) noexcept
Structure to store a grid position.
Propagation path structure and functions.
void pol2cart(Numeric &x, Numeric &z, const Numeric &r, const Numeric &lat)
pol2cart
void poslos2cart(Numeric &x, Numeric &z, Numeric &dx, Numeric &dz, const Numeric &r, const Numeric &lat, const Numeric &za)
poslos2cart
Vector x(Workspace &ws) noexcept
INDEX Index
The type to use for all integer numbers and indices.
void latlon_at_aa(Numeric &lat2, Numeric &lon2, const Numeric &lat1, const Numeric &lon1, const Numeric &aa, const Numeric &ddeg)
latlon_at_aa
void distance3D(Numeric &l, const Numeric &r1, const Numeric &lat1, const Numeric &lon1, const Numeric &r2, const Numeric &lat2, const Numeric &lon2)
distance3D
A constant view of a Vector.
Numeric refell2r(ConstVectorView refellipsoid, const Numeric &lat)
refell2r
void distance2D(Numeric &l, const Numeric &r1, const Numeric &lat1, const Numeric &r2, const Numeric &lat2)
distance2D