[1457] | 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 | */
|
---|
| 15 | void
|
---|
| 16 | ta_par (tha, tdec, phi, ht, rho, aha, adec)
|
---|
| 17 | double tha, tdec, phi, ht, *rho;
|
---|
| 18 | double *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 */
|
---|
| 44 | static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: parallax.c,v $ $Date: 2001-04-10 14:40:46 $ $Revision: 1.1.1.1 $ $Name: not supported by cvs2svn $"};
|
---|