| 1 |
< |
/* Copyright (c) 1993 Regents of the University of California */ |
| 1 |
> |
/* Copyright (c) 1994 Regents of the University of California */ |
| 2 |
|
|
| 3 |
|
#ifndef lint |
| 4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
| 186 |
|
if (fillsamp == 1) |
| 187 |
|
fillo &= ~F_BACK; |
| 188 |
|
/* set view */ |
| 189 |
< |
if (err = setview(&ourview)) { |
| 189 |
> |
if ((err = setview(&ourview)) != NULL) { |
| 190 |
|
fprintf(stderr, "%s: %s\n", progname, err); |
| 191 |
|
exit(1); |
| 192 |
|
} |
| 197 |
|
if (ourpict == NULL || ourzbuf == NULL) |
| 198 |
|
syserror(progname); |
| 199 |
|
bzero((char *)ourzbuf, hresolu*vresolu*sizeof(float)); |
| 200 |
+ |
/* new header */ |
| 201 |
+ |
newheader("RADIANCE", stdout); |
| 202 |
|
/* get input */ |
| 203 |
|
for ( ; i < argc; i += 2) |
| 204 |
|
addpicture(argv[i], argv[i+1]); |
| 209 |
|
fillpicture(fillfunc); |
| 210 |
|
/* close calculation */ |
| 211 |
|
caldone(); |
| 212 |
+ |
/* aft clipping */ |
| 213 |
+ |
clipaft(); |
| 214 |
|
/* add to header */ |
| 215 |
|
printargs(argc, argv, stdout); |
| 216 |
|
if (gotvfile) { |
| 245 |
|
{ |
| 246 |
|
char fmt[32]; |
| 247 |
|
|
| 248 |
< |
if (isformat(s)) { |
| 249 |
< |
formatval(fmt, s); |
| 248 |
> |
if (isheadid(s)) |
| 249 |
> |
return; |
| 250 |
> |
if (formatval(fmt, s)) { |
| 251 |
|
wrongformat = strcmp(fmt, COLRFMT); |
| 252 |
|
return; |
| 253 |
|
} |
| 470 |
|
movepixel(pos) /* reposition image point */ |
| 471 |
|
FVECT pos; |
| 472 |
|
{ |
| 473 |
+ |
double d0, d1; |
| 474 |
|
FVECT pt, direc; |
| 475 |
|
|
| 476 |
|
if (pos[2] <= 0) /* empty pixel */ |
| 477 |
|
return(-1); |
| 478 |
+ |
if (normdist && theirview.type == VT_PER) { /* adjust distance */ |
| 479 |
+ |
d0 = pos[0] + theirview.hoff - .5; |
| 480 |
+ |
d1 = pos[1] + theirview.voff - .5; |
| 481 |
+ |
pos[2] /= sqrt(1. + d0*d0*theirview.hn2 + d1*d1*theirview.vn2); |
| 482 |
+ |
} |
| 483 |
|
if (hasmatrix) { |
| 484 |
|
pos[0] += theirview.hoff - .5; |
| 485 |
|
pos[1] += theirview.voff - .5; |
| 486 |
|
if (theirview.type == VT_PER) { |
| 476 |
– |
if (normdist) /* adjust for eye-ray distance */ |
| 477 |
– |
pos[2] /= sqrt( 1. |
| 478 |
– |
+ pos[0]*pos[0]*theirview.hn2 |
| 479 |
– |
+ pos[1]*pos[1]*theirview.vn2 ); |
| 487 |
|
pos[0] *= pos[2]; |
| 488 |
|
pos[1] *= pos[2]; |
| 489 |
|
} |
| 498 |
|
pos[1] += .5 - ourview.voff; |
| 499 |
|
return(0); |
| 500 |
|
} |
| 501 |
< |
if (viewray(pt, direc, &theirview, pos[0], pos[1]) < 0) |
| 501 |
> |
if (viewray(pt, direc, &theirview, pos[0], pos[1]) < -FTINY) |
| 502 |
|
return(-1); |
| 503 |
|
pt[0] += direc[0]*pos[2]; |
| 504 |
|
pt[1] += direc[1]*pos[2]; |
| 614 |
|
for (x = 0; x < hresolu; x++) |
| 615 |
|
if (zscan(y)[x] <= 0) |
| 616 |
|
(*fill)(x,y); |
| 617 |
+ |
} |
| 618 |
+ |
|
| 619 |
+ |
|
| 620 |
+ |
clipaft() /* perform aft clipping as indicated */ |
| 621 |
+ |
{ |
| 622 |
+ |
register int x, y; |
| 623 |
+ |
double tstdist; |
| 624 |
+ |
double yzn2, vx; |
| 625 |
+ |
|
| 626 |
+ |
if (ourview.vaft <= FTINY) |
| 627 |
+ |
return; |
| 628 |
+ |
tstdist = ourview.vaft; |
| 629 |
+ |
for (y = 0; y < vresolu; y++) { |
| 630 |
+ |
if (ourview.type == VT_PER) { /* adjust distance */ |
| 631 |
+ |
yzn2 = (y+.5)/vresolu + ourview.voff - .5; |
| 632 |
+ |
yzn2 = 1. + yzn2*yzn2*ourview.vn2; |
| 633 |
+ |
tstdist = ourview.vaft * sqrt(yzn2); |
| 634 |
+ |
} |
| 635 |
+ |
for (x = 0; x < hresolu; x++) |
| 636 |
+ |
if (zscan(y)[x] > tstdist) { |
| 637 |
+ |
if (ourview.type == VT_PER) { |
| 638 |
+ |
vx = (x+.5)/hresolu + ourview.hoff - .5; |
| 639 |
+ |
if (zscan(y)[x] <= ourview.vaft * |
| 640 |
+ |
sqrt(vx*vx*ourview.hn2 + yzn2)) |
| 641 |
+ |
continue; |
| 642 |
+ |
} |
| 643 |
+ |
bzero(pscan(y)[x], sizeof(COLR)); |
| 644 |
+ |
zscan(y)[x] = 0.0; |
| 645 |
+ |
} |
| 646 |
+ |
} |
| 647 |
|
} |
| 648 |
|
|
| 649 |
|
|