Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.apo.nmsu.edu/Telescopes/coordConv/html/app_topo_from_obs_8cc_source.html
Дата изменения: Thu May 7 21:42:46 2015
Дата индексирования: Sun Apr 10 04:54:02 2016
Кодировка:

Поисковые слова: arp 220
lsst.coordConv: src/appTopoFromObs.cc Source File
lsst.coordConv  unknown
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
appTopoFromObs.cc
Go to the documentation of this file.
1 #include <stdexcept>
2 #include "coordConv/mathUtils.h"
4 
5 namespace coordConv {
6 
7  Coord appTopoFromObs(Coord const &obsCoord, Site const &site) {
8 
9  // For zdu > ZDu_Max the correction is computed at ZDu_Max.
10  // This is unphysical, but allows working with arbitrary positions.
11  // The model used (at this writing) is not much good beyond 83 degrees
12  // and going beyond ~87 requires more iterations to give reversibility
13  const double ZDu_Max = 85.0;
14 
15  Eigen::Vector3d obsPos = obsCoord.getVecPos();
16 
17  // convert inputs to easy-to-read variables
18  double const xr = obsPos(0);
19  double const yr = obsPos(1);
20  double const zr = obsPos(2);
21 
22  // useful quantities
23  double const rxymag = hypot(xr, yr);
24  double const rxysq = rxymag * rxymag;
25 
26  // test input vector
27  if (rxysq * std::numeric_limits<double>::epsilon() <= std::numeric_limits<double>::min()) {
28  if ((rxysq + (zr * zr)) * std::numeric_limits<double>::epsilon() <= std::numeric_limits<double>::min()) {
29  // |R| is too small to use -- probably a bug in the calling software
30  throw std::runtime_error("obsPos too short");
31  } else {
32  // at zenith; return obsPos
33  return Coord(obsPos);
34  }
35  }
36 
37  double zdr = atan2d(rxymag, zr); // refracted zenith distance
38  double zdu; // unrefracted zenith distance
39 
40  // Compute the refraction correction. Compute it at the refracted zenith distance,
41  // unless that ZD is too large, in which case compute the correction at the
42  // maximum UNrefracted ZD (this provides reversibility with refract).
43  bool tooLow = false;
44  if (zdr > ZDu_Max) {
45  // zdr < zdu, so we're certainly past the limit
46  // don't even bother to try computing the standard correction
47  tooLow = true;
48  } else {
49  double tanZD = tand(zdr);
50  zdu = zdr + (site.refCoA * tanZD) + (site.refCoB * tanZD * tanZD * tanZD);
51  if (zdu > ZDu_Max) {
52  tooLow = true;
53  }
54  }
55 
56  if (tooLow) {
57  // compute correction at zdu = ZDu_Max and use that instead
58  // (iteration is required because we want the correction at a known zdu, not at a known zdr)
59  double ZDr_u = 0.0;
60  double ZDu_iter = ZDu_Max;
61  for (int iter = 0; iter < 2; ++iter) {
62  double ZDr_iter = ZDu_iter + ZDr_u;
63  double cosZD = cosd(ZDr_iter);
64  double tanZD = tand(ZDr_iter);
65  ZDr_u = ZDr_u - ((ZDr_u + (site.refCoA * tanZD) + (site.refCoB * tanZD * tanZD * tanZD)) /
66  (1.0 + (RadPerDeg * (site.refCoA + (3.0 * site.refCoB * tanZD * tanZD)) / (cosZD * cosZD))));
67  }
68  zdu = zdr - ZDr_u;
69  }
70 
71  // compute unrefracted position as a cartesian vector
72  Eigen::Vector3d appTopoPos;
73  appTopoPos <<
74  xr,
75  yr,
76  rxymag * tand(90.0 - zdu);
77  return Coord(appTopoPos);
78  }
79 
80 }
81 
double refCoA
Definition: site.h:24
double tand(double ang)
tangent of angle in degrees
Definition: mathUtils.h:58
double hypot(double x, double y)
Definition: mathUtils.cc:8
double cosd(double ang)
cosine of angle in degrees
Definition: mathUtils.h:55
double atan2d(double x, double y)
arctangent2 in degrees
Definition: mathUtils.h:70
Eigen::Vector3d const getVecPos() const
Definition: coord.h:135
double refCoB
Definition: site.h:24
const double RadPerDeg
Definition: physConst.h:19
Coord appTopoFromObs(Coord const &obsCoord, Site const &site)