source: Sophya/trunk/SophyaExt/XephemAstroLib/parallactic.c@ 2653

Last change on this file since 2653 was 2643, checked in by cmv, 21 years ago

update pour version 3.6.3 Xephem cmv 17/01/04

File size: 1.2 KB
Line 
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 */
14double
15parallacticLDA (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 */
37double
38parallacticLHD (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 */
54static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: parallactic.c,v $ $Date: 2005-01-17 10:13:06 $ $Revision: 1.2 $ $Name: not supported by cvs2svn $"};
Note: See TracBrowser for help on using the repository browser.