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.3 by greg, Sat Feb 22 02:07:24 2003 UTC

# Line 1 | Line 1
1 /*
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
4 + /*
5   *           SOLAR CALCULATIONS
6   *
7   *               3/31/87
8   *
9   */
10  
11 + #include  <math.h>
12 +
13   #define  PI  3.141592654
14  
15   double  s_latitude = 0.66;      /* site latitude (radians) */
# Line 30 | Line 31 | double
31   stadj(jd)               /* solar time adjustment from Julian date */
32   int  jd;
33   {
33        double  sin();
34
34          return( 0.170 * sin( (4*PI/373) * (jd - 80) ) -
35                  0.129 * sin( (2*PI/355) * (jd - 8) ) +
36                  12 * (s_meridian - s_longitude) / PI );
# Line 42 | Line 41 | double
41   sdec(jd)                /* solar declination angle from Julian date */
42   int  jd;
43   {
45        double  sin();
46
44          return( 0.4093 * sin( (2*PI/368) * (jd - 81) ) );
45   }
46  
# Line 52 | Line 49 | double
49   salt(sd, st)    /* solar altitude from solar declination and solar time */
50   double  sd, st;
51   {
55        double  sin(), cos(), asin();
56
52          return( asin( sin(s_latitude) * sin(sd) -
53                          cos(s_latitude) * cos(sd) * cos(st*(PI/12)) ) );
54   }
# Line 63 | Line 58 | double
58   sazi(sd, st)    /* solar azimuth from solar declination and solar time */
59   double  sd, st;
60   {
66        double  sin(), cos(), atan2();
67
61          return( -atan2( cos(sd)*sin(st*(PI/12)),
62                          -cos(s_latitude)*sin(sd) -
63                          sin(s_latitude)*cos(sd)*cos(st*(PI/12)) ) );

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines