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