20 |
|
* Radiance (θ,φ) luminaire coordinates and then apply photometric and |
21 |
|
* tilt data to generate Radiance light. θ is altitude from the |
22 |
|
* negative z-axis and φ is azimuth from the positive x-axis, |
23 |
< |
* increasing towards the positive y-axis. [??? Greg, is there a |
24 |
< |
* source for this convention?] This system matches none of the usual |
25 |
< |
* goniophotometric conventions, but it is closest to IES type C; V in |
26 |
< |
* type C photometry is θ in Radiance and L is -φ. |
23 |
> |
* increasing towards the positive y-axis. This system matches none of |
24 |
> |
* the usual goniophotometric conventions, but it is closest to IES |
25 |
> |
* type C; V in type C photometry is θ in Radiance and L is -φ. |
26 |
|
* |
27 |
|
* The ies2rad scene description for a luminaire LUM, with tilt data, |
28 |
|
* uses the following Radiance scene description primitives: |
69 |
|
* Extensive comments added by Randolph Fritz May2018 |
70 |
|
*/ |
71 |
|
|
73 |
– |
#include <stdio.h> |
74 |
– |
#include <string.h> |
72 |
|
#include <math.h> |
76 |
– |
#include <sys/types.h> |
73 |
|
#include <ctype.h> |
74 |
|
|
75 |
|
#include "rtio.h" |
203 |
|
#define U_METERS 2 |
204 |
|
|
205 |
|
/* string lengths */ |
206 |
< |
/* Maximum input line is 132 characters including CR LF at end. */ |
207 |
< |
#define MAXLINE 133 |
206 |
> |
/* Maximum input line is 256 characters including CR LF at end. */ |
207 |
> |
#define MAXLINE 257 |
208 |
|
#define RMAXWORD 76 |
209 |
|
|
210 |
|
/* End of LM-63-related #defines */ |
724 |
|
char *hdl /* header line */ |
725 |
|
) |
726 |
|
{ |
727 |
+ |
/* Skip leading spaces */ |
728 |
+ |
while (isspace(*hdl)) |
729 |
+ |
hdl++; |
730 |
|
/* The line has to begin with '[' */ |
731 |
|
if (*hdl++ != '[') |
732 |
|
return(0); |
862 |
|
* in the "[LAMP]" and "[LAMPCAT]" keyword lines; |
863 |
|
* otherwise check all lines. */ |
864 |
|
if (lampcolor == NULL && checklamp(buf)) |
865 |
< |
lampcolor = matchlamp( buf[0] == '[' ? |
865 |
> |
lampcolor = matchlamp(*sskip2(buf,0) == '[' ? |
866 |
|
keyargs(buf) : buf ); |
867 |
|
/* Look for a materials and geometry file in the keywords. */ |
868 |
|
if (keymatch(K_LMG, buf)) { |
883 |
|
} else if (lamptype == NULL) |
884 |
|
fprintf(outfp,"# CIE(x,y) = (%f,%f)\n# Depreciation = %.1f%%\n", |
885 |
|
lampcolor[3], lampcolor[4], 100.*lampcolor[5]); |
886 |
+ |
|
887 |
|
/* If the file ended before a "TILT=" line, that's an error. */ |
888 |
|
if (feof(inpfp)) { |
889 |
|
fprintf(stderr, "%s: not in IES format\n", inpname); |