FACT++  1.0
void eraAtoiq ( const char *  type,
double  ob1,
double  ob2,
eraASTROM astrom,
double *  ri,
double *  di 
)

Definition at line 3 of file atoiq.c.

References eraASTROM::cphi, eraASTROM::diurab, eraAnp(), eraC2s(), eraASTROM::eral, eraS2c(), eraASTROM::refa, eraASTROM::refb, eraASTROM::sphi, eraASTROM::xpl, and eraASTROM::ypl.

Referenced by eraAtoc13(), eraAtoi13(), and t_atoiq().

94 {
95  int c;
96  double c1, c2, sphi, cphi, ce, xaeo, yaeo, zaeo, v[3],
97  xmhdo, ymhdo, zmhdo, az, sz, zdo, refa, refb, tz, dref,
98  zdt, xaet, yaet, zaet, xmhda, ymhda, zmhda,
99  f, xhd, yhd, zhd, xpl, ypl, w, hma;
100 
101 /* Coordinate type. */
102  c = (int) type[0];
103 
104 /* Coordinates. */
105  c1 = ob1;
106  c2 = ob2;
107 
108 /* Sin, cos of latitude. */
109  sphi = astrom->sphi;
110  cphi = astrom->cphi;
111 
112 /* Standardize coordinate type. */
113  if ( c == 'r' || c == 'R' ) {
114  c = 'R';
115  } else if ( c == 'h' || c == 'H' ) {
116  c = 'H';
117  } else {
118  c = 'A';
119  }
120 
121 /* If Az,ZD, convert to Cartesian (S=0,E=90). */
122  if ( c == 'A' ) {
123  ce = sin(c2);
124  xaeo = - cos(c1) * ce;
125  yaeo = sin(c1) * ce;
126  zaeo = cos(c2);
127 
128  } else {
129 
130  /* If RA,Dec, convert to HA,Dec. */
131  if ( c == 'R' ) c1 = astrom->eral - c1;
132 
133  /* To Cartesian -HA,Dec. */
134  eraS2c ( -c1, c2, v );
135  xmhdo = v[0];
136  ymhdo = v[1];
137  zmhdo = v[2];
138 
139  /* To Cartesian Az,El (S=0,E=90). */
140  xaeo = sphi*xmhdo - cphi*zmhdo;
141  yaeo = ymhdo;
142  zaeo = cphi*xmhdo + sphi*zmhdo;
143  }
144 
145 /* Azimuth (S=0,E=90). */
146  az = ( xaeo != 0.0 || yaeo != 0.0 ) ? atan2(yaeo,xaeo) : 0.0;
147 
148 /* Sine of observed ZD, and observed ZD. */
149  sz = sqrt ( xaeo*xaeo + yaeo*yaeo );
150  zdo = atan2 ( sz, zaeo );
151 
152 /*
153 ** Refraction
154 ** ----------
155 */
156 
157 /* Fast algorithm using two constant model. */
158  refa = astrom->refa;
159  refb = astrom->refb;
160  tz = sz / zaeo;
161  dref = ( refa + refb*tz*tz ) * tz;
162  zdt = zdo + dref;
163 
164 /* To Cartesian Az,ZD. */
165  ce = sin(zdt);
166  xaet = cos(az) * ce;
167  yaet = sin(az) * ce;
168  zaet = cos(zdt);
169 
170 /* Cartesian Az,ZD to Cartesian -HA,Dec. */
171  xmhda = sphi*xaet + cphi*zaet;
172  ymhda = yaet;
173  zmhda = - cphi*xaet + sphi*zaet;
174 
175 /* Diurnal aberration. */
176  f = ( 1.0 + astrom->diurab*ymhda );
177  xhd = f * xmhda;
178  yhd = f * ( ymhda - astrom->diurab );
179  zhd = f * zmhda;
180 
181 /* Polar motion. */
182  xpl = astrom->xpl;
183  ypl = astrom->ypl;
184  w = xpl*xhd - ypl*yhd + zhd;
185  v[0] = xhd - xpl*w;
186  v[1] = yhd + ypl*w;
187  v[2] = w - ( xpl*xpl + ypl*ypl ) * zhd;
188 
189 /* To spherical -HA,Dec. */
190  eraC2s(v, &hma, di);
191 
192 /* Right ascension. */
193  *ri = eraAnp(astrom->eral + hma);
194 
195 /* Finished. */
196 
197 }
double refa
Definition: erfam.h:32
double eral
Definition: erfam.h:31
double ypl
Definition: erfam.h:27
void eraS2c(double theta, double phi, double c[3])
Definition: s2c.c:3
double sphi
Definition: erfam.h:28
double refb
Definition: erfam.h:33
double cphi
Definition: erfam.h:29
void eraC2s(double p[3], double *theta, double *phi)
Definition: c2s.c:3
int type
double eraAnp(double a)
Definition: anp.c:3
double xpl
Definition: erfam.h:26
double diurab
Definition: erfam.h:30

+ Here is the call graph for this function:

+ Here is the caller graph for this function: