10 |
|
|
11 |
|
#include <stdio.h> |
12 |
|
|
13 |
+ |
#include "color.h" |
14 |
+ |
|
15 |
|
#define PI 3.14159265358979323846 |
16 |
|
|
17 |
|
extern char *gets(), *strcpy(); |
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 { |
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, |
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 |
|
|
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 |
|
|
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 |
|
|
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 |
|
} |