source: trunk/MagicSoft/slalib/zd.c@ 761

Last change on this file since 761 was 732, checked in by tbretz, 23 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 1.8 KB
Line 
1#include "slalib.h"
2#include "slamac.h"
3double slaZd ( double ha, double dec, double phi )
4/*
5** - - - - - -
6** s l a Z d
7** - - - - - -
8**
9** HA, Dec to Zenith Distance.
10**
11** (double precision)
12**
13** Given:
14** ha double Hour Angle in radians
15** dec double declination in radians
16** phi double observatory latitude in radians
17**
18** The result is in the range 0 to pi.
19**
20** Notes:
21**
22** 1) The latitude must be geodetic. In critical applications,
23** corrections for polar motion should be applied.
24**
25** 2) In some applications it will be important to specify the
26** correct type of hour angle and declination in order to
27** produce the required type of zenith distance. In particular,
28** it may be important to distinguish between the zenith distance
29** as affected by refraction, which would require the "observed"
30** HA,Dec, and the zenith distance in vacuo, which would require
31** the "topocentric" HA,Dec. If the effects of diurnal aberration
32** can be neglected, the "apparent" HA,Dec may be used instead of
33** the topocentric HA,Dec.
34**
35** 3) No range checking of arguments is done.
36**
37** 4) In applications which involve many zenith distance calculations,
38** rather than calling the present routine it will be more efficient
39** to use inline code, having previously computed fixed terms such
40** as sine and cosine of latitude, and perhaps sine and cosine of
41** declination.
42**
43** Last revision: 4 April 1994
44**
45** Copyright P.T.Wallace. All rights reserved.
46*/
47{
48 double sh, ch, sd, cd, sp, cp, x, y, z;
49
50 sh = sin ( ha );
51 ch = cos ( ha );
52 sd = sin ( dec );
53 cd = cos ( dec );
54 sp = sin ( phi );
55 cp = cos ( phi );
56
57 x = ch * cd * sp - sd * cp;
58 y = sh * cd;
59 z = ch * cd * cp + sd * sp;
60
61 return atan2 ( sqrt ( x * x + y * y ), z );
62}
Note: See TracBrowser for help on using the repository browser.