|
Last change
on this file since 3302 was 3111, checked in by cmv, 19 years ago |
|
mise en conformite xephem 3.7.2 cmv 22/11/2006
|
|
File size:
1.2 KB
|
| Rev | Line | |
|---|
| [2551] | 1 | /* compure parallactic angle: angle formed by N pole - Object - Zenith
|
|---|
| 2 | */
|
|---|
| 3 |
|
|---|
| 4 | #include <stdio.h>
|
|---|
| 5 | #include <math.h>
|
|---|
| 6 |
|
|---|
| 7 | #include "astro.h"
|
|---|
| 8 |
|
|---|
| 9 | /* compute parallactic angle given latitude, object dec and alt.
|
|---|
| 10 | * all angles in rads.
|
|---|
| 11 | * N.B. always return >= 0, caller must determine sign and degenerate cases at
|
|---|
| 12 | * pole or zenith.
|
|---|
| 13 | */
|
|---|
| 14 | double
|
|---|
| 15 | parallacticLDA (double lt, double dec, double alt)
|
|---|
| 16 | {
|
|---|
| 17 | double ca = sin(lt);
|
|---|
| 18 | double cb = sin(dec);
|
|---|
| 19 | double sb = cos(dec);
|
|---|
| 20 | double cc = sin(alt);
|
|---|
| 21 | double sc = cos(alt);
|
|---|
| 22 | double cpa;
|
|---|
| 23 |
|
|---|
| 24 | /* given three sides find an angle */
|
|---|
| 25 | if (sb==0 || sc==0)
|
|---|
| 26 | return (0);
|
|---|
| 27 | cpa = (ca - cb*cc)/(sb*sc);
|
|---|
| 28 | if (cpa < -1) cpa = -1;
|
|---|
| 29 | if (cpa > 1) cpa = 1;
|
|---|
| 30 | return (acos (cpa));
|
|---|
| 31 | }
|
|---|
| 32 |
|
|---|
| 33 | /* compute parallactic angle given latitude, object HA and Dec.
|
|---|
| 34 | * all angles in rads.
|
|---|
| 35 | * return value is between -PI and PI, sign is like HA, ie +west
|
|---|
| 36 | */
|
|---|
| 37 | double
|
|---|
| 38 | parallacticLHD (double lt, double ha, double dec)
|
|---|
| 39 | {
|
|---|
| 40 | double A, b, cc, sc, B;
|
|---|
| 41 |
|
|---|
| 42 | A = ha;
|
|---|
| 43 | b = PI/2 - lt;
|
|---|
| 44 | cc = sin(dec);
|
|---|
| 45 | sc = cos(dec);
|
|---|
| 46 | solve_sphere (A, b, cc, sc, NULL, &B);
|
|---|
| 47 |
|
|---|
| 48 | if (B > PI)
|
|---|
| 49 | B -= 2*PI;
|
|---|
| 50 | return (B);
|
|---|
| 51 | }
|
|---|
| 52 |
|
|---|
| 53 | /* For RCS Only -- Do Not Edit */
|
|---|
| [3111] | 54 | static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: parallactic.c,v $ $Date: 2006-11-22 13:53:30 $ $Revision: 1.4 $ $Name: not supported by cvs2svn $"};
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.