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.2 by greg, Sun Sep 10 16:45:19 1989 UTC vs.
Revision 2.3 by greg, Sat Feb 22 02:07:24 2003 UTC

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