| 223 |
|
#define DISK 2 |
| 224 |
|
#define SPHERE 3 |
| 225 |
|
|
| 226 |
< |
/* The diameter of a point source luminaire model. Also the minimum |
| 226 |
> |
/* 1mm. The diameter of a point source luminaire model. Also the minimum |
| 227 |
|
* size (in meters) that the luminous opening of a luminaire must have |
| 228 |
|
* to be treated as other than a point source. */ |
| 229 |
|
#define MINDIM .001 |
| 968 |
|
datin = in; |
| 969 |
|
strcpy(tltname, dfltname); |
| 970 |
|
} else { |
| 971 |
< |
/* If the line is "TILE=<filename>", use that file |
| 971 |
> |
/* If the line is "TILT=<filename>", use that file |
| 972 |
|
* name as the source of tilt data. */ |
| 973 |
|
if (ISDIRSEP(tltspec[0])) |
| 974 |
|
strcpy(buf, tltspec); |
| 1125 |
|
/* Output distribution "brightdata" primitive. Start handling |
| 1126 |
|
the various cases of symmetry of the distribution. */ |
| 1127 |
|
strcat(strcpy(id, filename(name)), "_dist"); |
| 1128 |
< |
fprintf(out, "\n%s brightdata %s\n", mod, id); |
| 1128 |
> |
fprintf(out, "\n'%s' brightdata '%s'\n", mod, id); |
| 1129 |
|
if (nangles[1] < 2) |
| 1130 |
|
fprintf(out, "4 "); |
| 1131 |
|
else if (pmtype == PM_B) |
| 1143 |
|
dosides = (doupper & dolower && sinf->h > MINDIM); /* Sides */ |
| 1144 |
|
|
| 1145 |
|
/* Select the appropriate function and parameters from source.cal */ |
| 1146 |
< |
fprintf(out, "%s %s source.cal ", |
| 1146 |
> |
fprintf(out, "%s '%s' source.cal ", |
| 1147 |
|
sinf->type==SPHERE ? "corr" : |
| 1148 |
|
!dosides ? "flatcorr" : |
| 1149 |
|
sinf->type==DISK ? "cylcorr" : "boxcorr", |
| 1213 |
|
/* First, describe the light. If a materials and geometry |
| 1214 |
|
* file is given, generate an illum instead. */ |
| 1215 |
|
strcat(strcpy(lname, name), "_light"); |
| 1216 |
< |
fprintf(fp, "\n%s %s %s\n", mod, |
| 1216 |
> |
fprintf(fp, "\n'%s' %s '%s'\n", mod, |
| 1217 |
|
shp->isillum ? "illum" : "light", lname); |
| 1218 |
|
fprintf(fp, "0\n0\n3 %g %g %g\n", |
| 1219 |
|
lampcolor[0], lampcolor[1], lampcolor[2]); |
| 1249 |
|
|
| 1250 |
|
/* makeshape -- decide what shape will be used |
| 1251 |
|
* |
| 1252 |
< |
* makeshape decides what Radiance geometry will be used to represent |
| 1252 |
> |
* Makeshape decides what Radiance geometry will be used to represent |
| 1253 |
|
* the light source and stores information about it in shp. |
| 1254 |
+ |
* |
| 1255 |
+ |
* The various versions of the IES LM-63 standard give a "luminous |
| 1256 |
+ |
* opening" (really a crude shape) a width, a length (or depth), and a |
| 1257 |
+ |
* height. If all three values are positive, they describe a box. If |
| 1258 |
+ |
* they are all zero, they describe a point. Various combinations of |
| 1259 |
+ |
* negative values are used to denote disks, circular or elliptical |
| 1260 |
+ |
* cylinders, spheres, and ellipsoids. This encoding differs from |
| 1261 |
+ |
* version to version of LM-63. |
| 1262 |
+ |
* |
| 1263 |
+ |
* Ies2rad simplifies this, reducing the geometry of LM-63 files to |
| 1264 |
+ |
* three forms which can be easily represented by Radiance primitives: |
| 1265 |
+ |
* boxes (RECT), cylinders or disks (DISK), and spheres (SPHERE.) A |
| 1266 |
+ |
* point is necessarily represented by a small sphere, since a point |
| 1267 |
+ |
* is not a Radiance object. |
| 1268 |
|
*/ |
| 1269 |
|
int |
| 1270 |
|
makeshape( |
| 1276 |
|
{ |
| 1277 |
|
/* Categorize the shape */ |
| 1278 |
|
if (illumrad/meters2out >= MINDIM/2.) { |
| 1279 |
< |
/* If the -i command line option is used, and the |
| 1280 |
< |
* object is not a point source, output an "illum" |
| 1281 |
< |
* sphere */ |
| 1279 |
> |
/* If the -i command line option is used, output an |
| 1280 |
> |
* "illum" sphere whose radius is given by the |
| 1281 |
> |
* argument to -i. */ |
| 1282 |
|
shp->isillum = 1; |
| 1283 |
|
shp->type = SPHERE; |
| 1284 |
|
shp->w = shp->l = shp->h = 2.*illumrad / meters2out; |
| 1285 |
+ |
/* Otherwise, use the dimensions in the IES file */ |
| 1286 |
|
} else if (width < MINDIM) { |
| 1272 |
– |
/* The width is either zero or negative. */ |
| 1287 |
|
width = -width; |
| 1288 |
|
if (width < MINDIM) { |
| 1289 |
< |
/* The width is zero. Use a tiny sphere to |
| 1290 |
< |
* represent a point source. */ |
| 1289 |
> |
/* If the LM-63 width is zero, assume a point |
| 1290 |
> |
* source is described. Output a small |
| 1291 |
> |
* sphere. */ |
| 1292 |
|
shp->type = SPHERE; |
| 1293 |
|
shp->w = shp->l = shp->h = MINDIM; |
| 1294 |
|
} else if (height < .5*width) { |
| 1295 |
|
/* The width is negative and the height is |
| 1296 |
< |
* modest; output either a disk or a thin |
| 1297 |
< |
* vertical cylinder. */ |
| 1296 |
> |
* less than half the width. Treat the |
| 1297 |
> |
* luminous opening as a disk or short |
| 1298 |
> |
* vertical cylinder. Disks will be |
| 1299 |
> |
* represented as nearly flat cylinders of |
| 1300 |
> |
* MINDIM/2 height. */ |
| 1301 |
|
shp->type = DISK; |
| 1302 |
|
shp->w = shp->l = width; |
| 1303 |
|
if (height >= MINDIM) |
| 1305 |
|
else |
| 1306 |
|
shp->h = .5*MINDIM; |
| 1307 |
|
} else { |
| 1308 |
< |
/* The width is negative and the object is |
| 1291 |
< |
* tall; output a sphere. */ |
| 1308 |
> |
/* Treat a tall cylinder as a sphere. */ |
| 1309 |
|
shp->type = SPHERE; |
| 1310 |
|
shp->w = shp->l = shp->h = width; |
| 1311 |
|
} |
| 1312 |
|
} else { |
| 1313 |
< |
/* The width is positive. Output a box, possibly very |
| 1314 |
< |
* thin. */ |
| 1313 |
> |
/* The width is positive. The luminous opening is a |
| 1314 |
> |
box or simple rectangle. */ |
| 1315 |
|
shp->type = RECT; |
| 1316 |
|
shp->w = width; |
| 1317 |
|
if (length >= MINDIM) |
| 1425 |
|
int d |
| 1426 |
|
) |
| 1427 |
|
{ |
| 1428 |
< |
fprintf(fp, "\n%s polygon %s%s\n0\n0\n12\n", mod, name, suffix); |
| 1428 |
> |
fprintf(fp, "\n'%s' polygon '%s%s'\n0\n0\n12\n", mod, name, suffix); |
| 1429 |
|
putpoint(shp, fp, a); |
| 1430 |
|
putpoint(shp, fp, b); |
| 1431 |
|
putpoint(shp, fp, c); |
| 1470 |
|
) |
| 1471 |
|
{ |
| 1472 |
|
if (up) { |
| 1473 |
< |
fprintf(fp, "\n%s ring %s.u\n", mod, name); |
| 1473 |
> |
fprintf(fp, "\n'%s' ring '%s.u'\n", mod, name); |
| 1474 |
|
fprintf(fp, "0\n0\n8\n"); |
| 1475 |
|
fprintf(fp, "\t0 0 %g\n", .5*shp->h*meters2out); |
| 1476 |
|
fprintf(fp, "\t0 0 1\n"); |
| 1477 |
|
fprintf(fp, "\t0 %g\n", .5*shp->w*meters2out); |
| 1478 |
|
} else { |
| 1479 |
< |
fprintf(fp, "\n%s ring %s.d\n", mod, name); |
| 1479 |
> |
fprintf(fp, "\n'%s' ring '%s.d'\n", mod, name); |
| 1480 |
|
fprintf(fp, "0\n0\n8\n"); |
| 1481 |
|
fprintf(fp, "\t0 0 %g\n", -.5*shp->h*meters2out); |
| 1482 |
|
fprintf(fp, "\t0 0 -1\n"); |
| 1493 |
|
char *name |
| 1494 |
|
) |
| 1495 |
|
{ |
| 1496 |
< |
fprintf(fp, "\n%s cylinder %s.c\n", mod, name); |
| 1496 |
> |
fprintf(fp, "\n'%s' cylinder '%s.c'\n", mod, name); |
| 1497 |
|
fprintf(fp, "0\n0\n7\n"); |
| 1498 |
|
fprintf(fp, "\t0 0 %g\n", .5*shp->h*meters2out); |
| 1499 |
|
fprintf(fp, "\t0 0 %g\n", -.5*shp->h*meters2out); |
| 1510 |
|
char *name |
| 1511 |
|
) |
| 1512 |
|
{ |
| 1513 |
< |
fprintf(fp, "\n%s sphere %s.s\n", mod, name); |
| 1513 |
> |
fprintf(fp, "\n'%s' sphere '%s.s'\n", mod, name); |
| 1514 |
|
fprintf(fp, "0\n0\n4 0 0 0 %g\n", .5*shp->w*meters2out); |
| 1515 |
|
} |
| 1516 |
|
|