source: Sophya/trunk/SophyaExt/XephemAstroLib/parallax.c@ 1719

Last change on this file since 1719 was 1719, checked in by cmv, 24 years ago

Adapted to version 3.5 xephem cmv 22/10/2001

File size: 1.4 KB
Line 
1#include <stdio.h>
2#include <math.h>
3
4#include "P_.h"
5#include "astro.h"
6
7
8/* given true ha and dec, tha and tdec, the geographical latitude, phi, the
9 * height above sea-level (as a fraction of the earths radius, 6378.16km),
10 * ht, and the geocentric distance rho in Earth radii(!), find the apparent
11 * ha and dec, aha and adec allowing for parallax.
12 * all angles in radians. ehp is the angle subtended at the body by the
13 * earth's equator.
14 */
15void
16ta_par (tha, tdec, phi, ht, rho, aha, adec)
17double tha, tdec, phi, ht, *rho;
18double *aha, *adec;
19{
20 static double last_phi = 1000.0, last_ht = -1000.0, xobs, zobs;
21 double x, y, z; /* obj cartesian coord, in Earth radii */
22
23 /* avoid calcs involving the same phi and ht */
24 if (phi != last_phi || ht != last_ht) {
25 double cphi, sphi, robs, e2 = (2 - 1/298.257)/298.257;
26 cphi = cos(phi);
27 sphi = sin(phi);
28 robs = 1/sqrt(1 - e2 * sphi * sphi);
29
30 /* observer coordinates: x to meridian, y east, z north */
31 xobs = (robs + ht) * cphi;
32 zobs = (robs*(1-e2) + ht) * sphi;
33 last_phi = phi;
34 last_ht = ht;
35 }
36
37 sphcart(-tha, tdec, *rho, &x, &y, &z);
38 cartsph(x - xobs, y, z - zobs, aha, adec, rho);
39 *aha *= -1;
40 range (aha, 2*PI);
41}
42
43/* For RCS Only -- Do Not Edit */
44static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: parallax.c,v $ $Date: 2001-10-22 12:08:27 $ $Revision: 1.2 $ $Name: not supported by cvs2svn $"};
Note: See TracBrowser for help on using the repository browser.