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 1.1 by greg, Thu Feb 2 11:16:32 1989 UTC vs.
Revision 2.2 by greg, Fri Oct 2 16:12:29 1992 UTC

# Line 1 | Line 1
1 < /*
1 > /* Copyright (c) 1989 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
5   #endif
6 +
7 + /*
8   *           SOLAR CALCULATIONS
9   *
10   *               3/31/87
11   *
12   */
13  
14 + #include  <math.h>
15 +
16   #define  PI  3.141592654
17  
18   double  s_latitude = 0.66;      /* site latitude (radians) */
# Line 30 | Line 34 | double
34   stadj(jd)               /* solar time adjustment from Julian date */
35   int  jd;
36   {
33        double  sin();
34
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 42 | Line 44 | double
44   sdec(jd)                /* solar declination angle from Julian date */
45   int  jd;
46   {
45        double  sin();
46
47          return( 0.4093 * sin( (2*PI/368) * (jd - 81) ) );
48   }
49  
# Line 52 | Line 52 | double
52   salt(sd, st)    /* solar altitude from solar declination and solar time */
53   double  sd, st;
54   {
55        double  sin(), cos(), asin();
56
55          return( asin( sin(s_latitude) * sin(sd) -
56                          cos(s_latitude) * cos(sd) * cos(st*(PI/12)) ) );
57   }
# Line 63 | Line 61 | double
61   sazi(sd, st)    /* solar azimuth from solar declination and solar time */
62   double  sd, st;
63   {
66        double  sin(), cos(), atan2();
67
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