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

Comparing ray/src/cv/ies2rad.c (file contents):
Revision 2.32 by greg, Sat Dec 28 18:05:14 2019 UTC vs.
Revision 2.33 by greg, Mon Sep 20 02:00:05 2021 UTC

# Line 223 | Line 223 | int    filerev = FIRSTREV;
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
# Line 1249 | Line 1249 | putsource(
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(
# Line 1262 | Line 1276 | 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)
# Line 1287 | Line 1305 | makeshape(
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)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines