ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/gen/sun.c
(Generate patch)

Comparing ray/src/gen/sun.c (file contents):
Revision 2.1 by greg, Tue Nov 12 17:04:42 1991 UTC vs.
Revision 2.2 by greg, Fri Oct 2 16:12:29 1992 UTC

# Line 11 | Line 11 | static char SCCSid[] = "$SunId$ LBL";
11   *
12   */
13  
14 + #include  <math.h>
15 +
16   #define  PI  3.141592654
17  
18   double  s_latitude = 0.66;      /* site latitude (radians) */
# Line 32 | Line 34 | double
34   stadj(jd)               /* solar time adjustment from Julian date */
35   int  jd;
36   {
35        double  sin();
36
37          return( 0.170 * sin( (4*PI/373) * (jd - 80) ) -
38                  0.129 * sin( (2*PI/355) * (jd - 8) ) +
39                  12 * (s_meridian - s_longitude) / PI );
# Line 44 | Line 44 | double
44   sdec(jd)                /* solar declination angle from Julian date */
45   int  jd;
46   {
47        double  sin();
48
47          return( 0.4093 * sin( (2*PI/368) * (jd - 81) ) );
48   }
49  
# Line 54 | Line 52 | double
52   salt(sd, st)    /* solar altitude from solar declination and solar time */
53   double  sd, st;
54   {
57        double  sin(), cos(), asin();
58
55          return( asin( sin(s_latitude) * sin(sd) -
56                          cos(s_latitude) * cos(sd) * cos(st*(PI/12)) ) );
57   }
# Line 65 | Line 61 | double
61   sazi(sd, st)    /* solar azimuth from solar declination and solar time */
62   double  sd, st;
63   {
68        double  sin(), cos(), atan2();
69
64          return( -atan2( cos(sd)*sin(st*(PI/12)),
65                          -cos(s_latitude)*sin(sd) -
66                          sin(s_latitude)*cos(sd)*cos(st*(PI/12)) ) );

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines