FACT++  1.0
void palOapqk ( const char *  type,
double  ob1,
double  ob2,
const double  aoprms[14],
double *  rap,
double *  dap 
)

Definition at line 150 of file palOapqk.c.

References palDcc2s(), palDcs2c(), palDranrm(), and palRefro().

Referenced by palOap(), and t_aop().

151  {
152 
153  /* breakpoint for fast/slow refraction algorithm:
154  * zd greater than arctan(4), (see palRefco routine)
155  * or vector z less than cosine(arctan(z)) = 1/sqrt(17) */
156  const double zbreak = 0.242535625;
157 
158  char c;
159  double c1,c2,sphi,cphi,st,ce,xaeo,yaeo,zaeo,v[3],
160  xmhdo,ymhdo,zmhdo,az,sz,zdo,tz,dref,zdt,
161  xaet,yaet,zaet,xmhda,ymhda,zmhda,diurab,f,hma;
162 
163  /* coordinate type */
164  c = type[0];
165 
166  /* coordinates */
167  c1 = ob1;
168  c2 = ob2;
169 
170  /* sin, cos of latitude */
171  sphi = aoprms[1];
172  cphi = aoprms[2];
173 
174  /* local apparent sidereal time */
175  st = aoprms[13];
176 
177  /* standardise coordinate type */
178  if (c == 'r' || c == 'R') {
179  c = 'r';
180  } else if (c == 'h' || c == 'H') {
181  c = 'h';
182  } else {
183  c = 'a';
184  }
185 
186  /* if az,zd convert to cartesian (s=0,e=90) */
187  if (c == 'a') {
188  ce = sin(c2);
189  xaeo = -cos(c1)*ce;
190  yaeo = sin(c1)*ce;
191  zaeo = cos(c2);
192  } else {
193 
194  /* if ra,dec convert to ha,dec */
195  if (c == 'r') {
196  c1 = st-c1;
197  }
198 
199  /* to cartesian -ha,dec */
200  palDcs2c( -c1, c2, v );
201  xmhdo = v[0];
202  ymhdo = v[1];
203  zmhdo = v[2];
204 
205  /* to cartesian az,el (s=0,e=90) */
206  xaeo = sphi*xmhdo-cphi*zmhdo;
207  yaeo = ymhdo;
208  zaeo = cphi*xmhdo+sphi*zmhdo;
209  }
210 
211  /* azimuth (s=0,e=90) */
212  if (xaeo != 0.0 || yaeo != 0.0) {
213  az = atan2(yaeo,xaeo);
214  } else {
215  az = 0.0;
216  }
217 
218  /* sine of observed zd, and observed zd */
219  sz = sqrt(xaeo*xaeo+yaeo*yaeo);
220  zdo = atan2(sz,zaeo);
221 
222  /*
223  * refraction
224  * ---------- */
225 
226  /* large zenith distance? */
227  if (zaeo >= zbreak) {
228 
229  /* fast algorithm using two constant model */
230  tz = sz/zaeo;
231  dref = (aoprms[10]+aoprms[11]*tz*tz)*tz;
232 
233  } else {
234 
235  /* rigorous algorithm for large zd */
236  palRefro(zdo,aoprms[4],aoprms[5],aoprms[6],aoprms[7],
237  aoprms[8],aoprms[0],aoprms[9],1e-8,&dref);
238  }
239 
240  zdt = zdo+dref;
241 
242  /* to cartesian az,zd */
243  ce = sin(zdt);
244  xaet = cos(az)*ce;
245  yaet = sin(az)*ce;
246  zaet = cos(zdt);
247 
248  /* cartesian az,zd to cartesian -ha,dec */
249  xmhda = sphi*xaet+cphi*zaet;
250  ymhda = yaet;
251  zmhda = -cphi*xaet+sphi*zaet;
252 
253  /* diurnal aberration */
254  diurab = -aoprms[3];
255  f = (1.0-diurab*ymhda);
256  v[0] = f*xmhda;
257  v[1] = f*(ymhda+diurab);
258  v[2] = f*zmhda;
259 
260  /* to spherical -ha,dec */
261  palDcc2s(v,&hma,dap);
262 
263  /* Right Ascension */
264  *rap = palDranrm(st+hma);
265 
266 }
void palRefro(double zobs, double hm, double tdk, double pmb, double rh, double wl, double phi, double tlr, double eps, double *ref)
Definition: palRefro.c:185
void palDcc2s(double v[3], double *a, double *b)
Definition: palOne2One.c:327
double palDranrm(double angle)
Definition: palOne2One.c:766
int type
void palDcs2c(double a, double b, double v[3])
Definition: palOne2One.c:368

+ Here is the call graph for this function:

+ Here is the caller graph for this function: