18 |
|
#include "triangulate.h" |
19 |
|
#include "platform.h" |
20 |
|
|
21 |
< |
#define MAXRCARG 512 |
21 |
> |
#ifndef MAXRCARG |
22 |
> |
#define MAXRCARG 10000 |
23 |
> |
#endif |
24 |
|
|
25 |
|
char *progname; /* global argv[0] */ |
26 |
|
|
144 |
|
strcpy(cp, "-w- "); |
145 |
|
cp += 4; |
146 |
|
} |
147 |
< |
while (ac-- > 0) { |
148 |
< |
strcpy(cp, *av++); |
149 |
< |
while (*cp) cp++; |
148 |
< |
*cp++ = ' '; |
149 |
< |
if (cp >= oconvbuf+(sizeof(oconvbuf)-32)) |
147 |
> |
while (ac-- > 0) { /* copy each argument */ |
148 |
> |
int len = strlen(*av); |
149 |
> |
if (cp+len+4 >= oconvbuf+sizeof(oconvbuf)) |
150 |
|
goto overrun; |
151 |
+ |
if (matchany(*av, SPECIALS)) { |
152 |
+ |
*cp++ = QUOTCHAR; |
153 |
+ |
strcpy(cp, *av++); |
154 |
+ |
cp += len; |
155 |
+ |
*cp++ = QUOTCHAR; |
156 |
+ |
} else { |
157 |
+ |
strcpy(cp, *av++); |
158 |
+ |
cp += len; |
159 |
+ |
} |
160 |
+ |
*cp++ = ' '; |
161 |
|
} |
162 |
|
/* receiver goes last */ |
163 |
|
if (matchany(recv, SPECIALS)) { |
393 |
|
curparams.vup[1] = 1; |
394 |
|
} |
395 |
|
/* determine sample type/bin */ |
396 |
< |
if (tolower(curparams.hemis[0]) == 'u' | curparams.hemis[0] == '1') { |
396 |
> |
if ((tolower(curparams.hemis[0]) == 'u') | (curparams.hemis[0] == '1')) { |
397 |
|
sprintf(sbuf, "if(-Dx*%g-Dy*%g-Dz*%g,0,-1)", |
398 |
|
curparams.nrm[0], curparams.nrm[1], curparams.nrm[2]); |
399 |
|
binv = savqstr(sbuf); |
669 |
|
projsa[i] = -DOT(sp->snrm, rdir) * sp->area; |
670 |
|
tarea += projsa[i] *= (double)(projsa[i] > FTINY); |
671 |
|
} |
672 |
< |
if (tarea <= FTINY) { /* wrong side of sender? */ |
672 |
> |
if (tarea < 0) { /* wrong side of sender? */ |
673 |
|
fputs(progname, stderr); |
674 |
|
fputs(": internal - sample behind all sender elements!\n", |
675 |
|
stderr); |
770 |
|
} |
771 |
|
while (n--) { /* stratified sampling */ |
772 |
|
SDmultiSamp(samp3, 3, (n+frandom())/sampcnt); |
773 |
+ |
if (row >= RowMax-1) /* avoid crowding at zenith */ |
774 |
+ |
samp3[1] *= samp3[1]; |
775 |
|
alt = (row+samp3[1])*RAH; |
776 |
|
azi = (2.*PI)*(col+samp3[2]-.5)/rnaz(row); |
777 |
|
duvw[2] = cos(alt); /* measured from horizon */ |
778 |
|
duvw[0] = tsin(azi)*duvw[2]; |
779 |
< |
duvw[1] = tcos(azi)*duvw[2]; |
779 |
> |
duvw[1] = -tcos(azi)*duvw[2]; |
780 |
|
duvw[2] = sqrt(1. - duvw[2]*duvw[2]); |
781 |
|
for (i = 3; i--; ) |
782 |
|
orig_dir[1][i] = -duvw[0]*p->udir[i] - |
883 |
|
curparams.udir[1] *= -1.; |
884 |
|
curparams.udir[2] *= -1.; |
885 |
|
} |
886 |
< |
if (tolower(curparams.hemis[0]) == 'u' | curparams.hemis[0] == '1') |
886 |
> |
if ((tolower(curparams.hemis[0]) == 'u') | (curparams.hemis[0] == '1')) |
887 |
|
curparams.sample_basis = sample_uniform; |
888 |
|
else if (tolower(curparams.hemis[0]) == 's' && |
889 |
|
tolower(curparams.hemis[1]) == 'c') |