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