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.1 by greg, Tue Nov 12 17:02:10 1991 UTC

# Line 10 | Line 10 | static char SCCSid[] = "$SunId$ LBL";
10  
11   #include <stdio.h>
12  
13 + #include "color.h"
14 +
15   #define PI      3.14159265358979323846
16  
17   extern char     *gets(), *strcpy();
# Line 27 | Line 29 | int    typecheck(), unitcheck(), geomcheck(), outpcheck()
29  
30   float   *lampcolor;             /* the lamp color (RGB) */
31   double  unit2meter;             /* conversion from units to meters */
32 < double  projarea;               /* projected area for this geometry */
32 > double  area;                   /* radiating area for this geometry */
33   double  lumens;                 /* total lamp lumens */
34  
35   struct {
# Line 173 | Line 175 | compute()                      /* compute lamp radiance */
175   {
176          double  whiteval;
177  
178 <        whiteval = lumens/470./projarea;
178 >        whiteval = lumens/area/(WHTEFFICACY*PI);
179  
180          printf("Lamp color (RGB) = %f %f %f\n",
181                          lampcolor[0]*whiteval,
# Line 205 | Line 207 | again:
207  
208   getpolygon()                    /* get projected area for a polygon */
209   {
210 <        static double   area = 1.0;
210 >        static double   parea = 1.0;
211  
212 <        getd("Polygon area", &area,
212 >        getd("Polygon area", &parea,
213                  "Enter the total radiating area of the polygon.");
214 <        projarea = PI*unit2meter*unit2meter * area;
214 >        area = unit2meter*unit2meter * parea;
215          return(1);
216   }
217  
# Line 220 | Line 222 | getsphere()                    /* get projected area for a sphere */
222  
223          getd("Sphere radius", &radius,
224                  "Enter the distance from the sphere's center to its surface.");
225 <        projarea = 4.*PI*PI*unit2meter*unit2meter * radius*radius;
225 >        area = 4.*PI*unit2meter*unit2meter * radius*radius;
226          return(1);
227   }
228  
# Line 233 | Line 235 | getcylinder()                  /* get projected area for a cylinder *
235                  "Enter the length of the cylinder.");
236          getd("Cylinder radius", &radius,
237                  "Enter the distance from the cylinder's axis to its surface.");
238 <        projarea = PI*PI*2.*PI*unit2meter*unit2meter * radius*length;
238 >        area = 2.*PI*unit2meter*unit2meter * radius*length;
239          return(1);
240   }
241  
# Line 245 | Line 247 | getring()                      /* get projected area for a ring */
247          getd("Disk radius", &radius,
248   "Enter the distance from the ring's center to its outer edge.\n\
249   The inner radius must be zero.");
250 <        projarea = PI*PI*unit2meter*unit2meter * radius*radius;
250 >        area = PI*unit2meter*unit2meter * radius*radius;
251          return(1);
252   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines