12 |
|
|
13 |
|
#include "glare.h" |
14 |
|
|
15 |
< |
#define FEQ(a,b) ((a)-(b)<=FTINY&&(a)-(b)<=FTINY) |
15 |
> |
#define FEQ(a,b) ((a)-(b)<=FTINY&&(b)-(a)<=FTINY) |
16 |
|
#define VEQ(v1,v2) (FEQ((v1)[0],(v2)[0])&&FEQ((v1)[1],(v2)[1]) \ |
17 |
|
&&FEQ((v1)[2],(v2)[2])) |
18 |
|
|
19 |
< |
char *rtargv[32] = {"rtrace", "-h", "-ov", "-fff"}; |
19 |
> |
char *rtargv[32] = {"rtrace", "-h-", "-ov", "-fff"}; |
20 |
|
int rtargc = 4; |
21 |
|
|
22 |
|
VIEW ourview = STDVIEW; /* our view */ |
106 |
|
break; |
107 |
|
case 'd': |
108 |
|
case 'l': |
109 |
+ |
case 's': |
110 |
|
rtargv[rtargc++] = argv[i]; |
111 |
|
rtargv[rtargc++] = argv[++i]; |
112 |
|
break; |
204 |
|
} |
205 |
|
|
206 |
|
|
207 |
+ |
int |
208 |
+ |
angcmp(ap1, ap2) /* compare two angles */ |
209 |
+ |
ANGLE *ap1, *ap2; |
210 |
+ |
{ |
211 |
+ |
register int a1, a2; |
212 |
+ |
|
213 |
+ |
a1 = *ap1; |
214 |
+ |
a2 = *ap2; |
215 |
+ |
if (a1 == a2) { |
216 |
+ |
fprintf(stderr, "%s: duplicate glare angle (%d)\n", |
217 |
+ |
progname, a1); |
218 |
+ |
exit(1); |
219 |
+ |
} |
220 |
+ |
return(a1-a2); |
221 |
+ |
} |
222 |
+ |
|
223 |
+ |
|
224 |
|
init() /* initialize global variables */ |
225 |
|
{ |
226 |
|
double d; |
232 |
|
/* set direction vectors */ |
233 |
|
for (i = 0; glarang[i] != AEND; i++) |
234 |
|
; |
235 |
< |
if (i > 0 && (glarang[0] <= 0 || glarang[i-1] >= 180)) { |
236 |
< |
fprintf(stderr, "%s: glare angles must be between 1 and 179\n", |
235 |
> |
qsort(glarang, i, sizeof(ANGLE), angcmp); |
236 |
> |
if (i > 0 && (glarang[0] <= 0 || glarang[i-1] > 180)) { |
237 |
> |
fprintf(stderr, "%s: glare angles must be between 1 and 180\n", |
238 |
|
progname); |
239 |
|
exit(1); |
240 |
|
} |