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

Comparing ray/src/cv/lampcolor.c (file contents):
Revision 1.6 by greg, Thu Sep 12 13:36:43 1991 UTC vs.
Revision 2.4 by greg, Fri Jun 4 14:32:44 1993 UTC

# Line 10 | Line 10 | static char SCCSid[] = "$SunId$ LBL";
10  
11   #include <stdio.h>
12  
13 + #include <math.h>
14 +
15 + #include "color.h"
16 +
17   #define PI      3.14159265358979323846
18  
19   extern char     *gets(), *strcpy();
16 extern double   atof();
20   extern float    *matchlamp();
21  
22                                  /* lamp parameters */
# Line 27 | Line 30 | int    typecheck(), unitcheck(), geomcheck(), outpcheck()
30  
31   float   *lampcolor;             /* the lamp color (RGB) */
32   double  unit2meter;             /* conversion from units to meters */
33 < double  projarea;               /* projected area for this geometry */
33 > double  area;                   /* radiating area for this geometry */
34   double  lumens;                 /* total lamp lumens */
35  
36   struct {
# Line 36 | Line 39 | struct {
39          int     (*check)();
40          char    *help;
41   } param[NPARAMS] = {
42 <        { "lamp type", "white", typecheck,
42 >        { "lamp type", "D65WHITE", typecheck,
43   "The lamp type is a string which corresponds to one of the types registered\n\
44 < in the lamp table file.  A value of \"white\" means an uncolored source,\n\
44 > in the lamp table file.  A value of \"D65WHITE\" means an uncolored source,\n\
45   which may be preferable because it results in a color balanced image." },
46          { "length unit", "meter", unitcheck,
47   "Unit must be one of:  \"meter\", \"centimeter\", \"foot\", or \"inch\".\n\
# Line 173 | Line 176 | compute()                      /* compute lamp radiance */
176   {
177          double  whiteval;
178  
179 <        whiteval = lumens/470./projarea;
179 >        whiteval = lumens/area/(WHTEFFICACY*PI);
180  
181          printf("Lamp color (RGB) = %f %f %f\n",
182                          lampcolor[0]*whiteval,
# Line 205 | Line 208 | again:
208  
209   getpolygon()                    /* get projected area for a polygon */
210   {
211 <        static double   area = 1.0;
211 >        static double   parea = 1.0;
212  
213 <        getd("Polygon area", &area,
213 >        getd("Polygon area", &parea,
214                  "Enter the total radiating area of the polygon.");
215 <        projarea = PI*unit2meter*unit2meter * area;
215 >        area = unit2meter*unit2meter * parea;
216          return(1);
217   }
218  
# Line 220 | Line 223 | getsphere()                    /* get projected area for a sphere */
223  
224          getd("Sphere radius", &radius,
225                  "Enter the distance from the sphere's center to its surface.");
226 <        projarea = 4.*PI*PI*unit2meter*unit2meter * radius*radius;
226 >        area = 4.*PI*unit2meter*unit2meter * radius*radius;
227          return(1);
228   }
229  
# Line 233 | Line 236 | getcylinder()                  /* get projected area for a cylinder *
236                  "Enter the length of the cylinder.");
237          getd("Cylinder radius", &radius,
238                  "Enter the distance from the cylinder's axis to its surface.");
239 <        projarea = PI*PI*2.*PI*unit2meter*unit2meter * radius*length;
239 >        area = 2.*PI*unit2meter*unit2meter * radius*length;
240          return(1);
241   }
242  
# Line 245 | Line 248 | getring()                      /* get projected area for a ring */
248          getd("Disk radius", &radius,
249   "Enter the distance from the ring's center to its outer edge.\n\
250   The inner radius must be zero.");
251 <        projarea = PI*PI*unit2meter*unit2meter * radius*radius;
251 >        area = PI*unit2meter*unit2meter * radius*radius;
252          return(1);
253   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines