| 28 |
|
#define averaging (ourweigh != NULL) |
| 29 |
|
#define blurring (ourbpict != NULL) |
| 30 |
|
#define usematrix (hasmatrix & !averaging) |
| 31 |
< |
#define zisnorm ((!usematrix) | (ourview.type != VT_PER)) |
| 31 |
> |
#define zisnorm (!usematrix | (ourview.type != VT_PER)) |
| 32 |
|
|
| 33 |
|
#define MAXWT 1000. /* maximum pixel weight (averaging) */ |
| 34 |
|
|
| 72 |
|
COLOR backcolor = BLKCOLOR; /* background color (float) */ |
| 73 |
|
double backz = 0.0; /* background z value */ |
| 74 |
|
int normdist = 1; /* i/o normalized distance? */ |
| 75 |
< |
char ourfmt[LPICFMT+1] = PICFMT; /* original picture format */ |
| 75 |
> |
char ourfmt[MAXFMTLEN] = PICFMT; /* original picture format */ |
| 76 |
|
double ourexp = -1; /* original picture exposure */ |
| 77 |
|
int expadj = 0; /* exposure adjustment (f-stops) */ |
| 78 |
|
double rexpadj = 1; /* real exposure adjustment */ |
| 361 |
|
void *p |
| 362 |
|
) |
| 363 |
|
{ |
| 364 |
< |
char fmt[32]; |
| 364 |
> |
char fmt[MAXFMTLEN]; |
| 365 |
|
|
| 366 |
|
if (isheadid(s)) |
| 367 |
|
return(0); |
| 497 |
|
zin = (float *)malloc(scanlen(&tresolu)*sizeof(float)); |
| 498 |
|
if (zin == NULL) |
| 499 |
|
syserror(progname); |
| 500 |
< |
if ((zfd = open(zspec, O_RDONLY)) == -1) { |
| 501 |
< |
double zvalue; |
| 500 |
> |
if (isflt(zspec)) { /* depth is a constant? */ |
| 501 |
> |
double zvalue = atof(zspec); |
| 502 |
|
int x; |
| 503 |
< |
if (!isflt(zspec) || (zvalue = atof(zspec)) <= 0.0) |
| 504 |
< |
syserror(zspec); |
| 503 |
> |
if (zvalue <= 0.0) { |
| 504 |
> |
fprintf(stderr, "%s: illegal Z-value %s\n", |
| 505 |
> |
progname, zspec); |
| 506 |
> |
exit(1); |
| 507 |
> |
} |
| 508 |
|
for (x = scanlen(&tresolu); x-- > 0; ) |
| 509 |
|
zin[x] = zvalue; |
| 510 |
< |
} |
| 510 |
> |
zfd = -1; |
| 511 |
> |
} else if ((zfd = open_float_depth(zspec, (long)tresolu.xr*tresolu.yr)) < 0) |
| 512 |
> |
exit(1); |
| 513 |
|
/* compute transferrable perimeter */ |
| 514 |
|
xlim = (struct bound *)malloc(numscans(&tresolu)*sizeof(struct bound)); |
| 515 |
|
if (xlim == NULL) |
| 753 |
|
} |
| 754 |
|
pos[0] += .5 - ourview.hoff; |
| 755 |
|
pos[1] += .5 - ourview.voff; |
| 756 |
+ |
if ((pos[0] < 0) | (pos[0] >= 1-FTINY) | |
| 757 |
+ |
(pos[1] < 0) | (pos[1] >= 1-FTINY)) |
| 758 |
+ |
return(0); |
| 759 |
|
pos[2] -= ourview.vfore; |
| 760 |
|
} else { |
| 761 |
|
if (viewray(pt, tdir, &theirview, pos[0], pos[1]) < -FTINY) |
| 762 |
|
return(0); |
| 763 |
< |
if ((!normdist) & (theirview.type == VT_PER)) /* adjust */ |
| 764 |
< |
pos[2] *= sqrt(1. + pos[0]*pos[0]*theirview.hn2 |
| 757 |
< |
+ pos[1]*pos[1]*theirview.vn2); |
| 763 |
> |
if (!normdist & (theirview.type == VT_PER)) /* adjust */ |
| 764 |
> |
pos[2] /= DOT(theirview.vdir, tdir); |
| 765 |
|
pt[0] += tdir[0]*pos[2]; |
| 766 |
|
pt[1] += tdir[1]*pos[2]; |
| 767 |
|
pt[2] += tdir[2]*pos[2]; |
| 768 |
< |
viewloc(pos, &ourview, pt); |
| 762 |
< |
if (pos[2] <= 0) |
| 768 |
> |
if (viewloc(pos, &ourview, pt) != VL_GOOD) |
| 769 |
|
return(0); |
| 770 |
|
} |
| 765 |
– |
if ((pos[0] < 0) | (pos[0] >= 1-FTINY) | (pos[1] < 0) | (pos[1] >= 1-FTINY)) |
| 766 |
– |
return(0); |
| 771 |
|
if (!averaging) |
| 772 |
|
return(1); |
| 773 |
|
/* compute pixel weight */ |
| 1168 |
|
int rval; |
| 1169 |
|
char **wp, *cp; |
| 1170 |
|
|
| 1171 |
< |
if (PDesc.running) { |
| 1171 |
> |
if (PDesc.flags & PF_RUNNING) { |
| 1172 |
|
fprintf(stderr, "%s: too many calculations\n", progname); |
| 1173 |
|
exit(1); |
| 1174 |
|
} |
| 1203 |
|
static void |
| 1204 |
|
caldone(void) /* done with calculation */ |
| 1205 |
|
{ |
| 1206 |
< |
if (!PDesc.running) |
| 1206 |
> |
if (!(PDesc.flags & PF_RUNNING)) |
| 1207 |
|
return; |
| 1208 |
|
clearqueue(); |
| 1209 |
|
close_process(&PDesc); |