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

Comparing ray/src/gen/gensky.c (file contents):
Revision 2.2 by greg, Thu Dec 19 15:09:28 1991 UTC vs.
Revision 2.3 by greg, Tue Mar 10 11:12:06 1992 UTC

# Line 35 | Line 35 | extern double  s_latitude;
35   extern double  s_longitude;
36   extern double  s_meridian;
37                                          /* required values */
38 < int  month, day;
39 < double  hour;
38 > int  month, day;                                /* date */
39 > double  hour;                                   /* standard time */
40 > double  altitude, azimuth;                      /* or solar angles */
41                                          /* default values */
42   int  cloudy = 0;
43   int  dosun = 1;
# Line 67 | Line 68 | char  *argv[];
68          }
69          if (argc < 4)
70                  userror("arg count");
71 <        month = atoi(argv[1]);
72 <        day = atoi(argv[2]);
73 <        hour = atof(argv[3]);
71 >        if (!strcmp(argv[1], "-ang")) {
72 >                altitude = atof(argv[2]) * (PI/180);
73 >                azimuth = atof(argv[3]) * (PI/180);
74 >                month = 0;
75 >        } else {
76 >                month = atoi(argv[1]);
77 >                day = atoi(argv[2]);
78 >                hour = atof(argv[3]);
79 >        }
80          for (i = 4; i < argc; i++)
81                  if (argv[i][0] == '-' || argv[i][0] == '+')
82                          switch (argv[i][1]) {
# Line 120 | Line 127 | char  *argv[];
127  
128   computesky()                    /* compute sky parameters */
129   {
123        int  jd;
124        double  sd, st;
125        double  altitude, azimuth;
130                                          /* compute solar direction */
131 <        jd = jdate(month, day);                 /* Julian date */
132 <        sd = sdec(jd);                          /* solar declination */
133 <        st = hour + stadj(jd);                  /* solar time */
134 <        altitude = salt(sd, st);
135 <        azimuth = sazi(sd, st);
131 >        if (month) {                    /* from date and time */
132 >                int  jd;
133 >                double  sd, st;
134 >
135 >                jd = jdate(month, day);         /* Julian date */
136 >                sd = sdec(jd);                  /* solar declination */
137 >                st = hour + stadj(jd);          /* solar time */
138 >                altitude = salt(sd, st);
139 >                azimuth = sazi(sd, st);
140 >        }
141          sundir[0] = -sin(azimuth)*cos(altitude);
142          sundir[1] = -cos(azimuth)*cos(altitude);
143          sundir[2] = sin(altitude);
# Line 214 | Line 223 | char  *msg;
223          if (msg != NULL)
224                  fprintf(stderr, "%s: Use error - %s\n", progname, msg);
225          fprintf(stderr, "Usage: %s month day hour [options]\n", progname);
226 +        fprintf(stderr, "   Or: %s -ang altitude azimuth [options]\n", progname);
227          fprintf(stderr, "   Or: %s -defaults\n", progname);
228          exit(1);
229   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines