| 46 |
|
char vbrtout[] = "lo"; |
| 47 |
|
char vcolexp[3][4] = {"re", "ge", "be"}; |
| 48 |
|
char vbrtexp[] = "le"; |
| 49 |
+ |
char vpixaspect[] = "pa"; |
| 50 |
|
|
| 51 |
< |
char vray[6][4] = {"Ox", "Oy", "Oz", "Dx", "Dy", "Dz"}; |
| 51 |
> |
char vray[7][4] = {"Ox", "Oy", "Oz", "Dx", "Dy", "Dz", "T"}; |
| 52 |
|
|
| 53 |
|
char vpsize[] = "S"; |
| 54 |
|
|
| 55 |
|
char vnfiles[] = "nfiles"; |
| 56 |
+ |
char vwhteff[] = "WE"; |
| 57 |
|
char vxmax[] = "xmax"; |
| 58 |
|
char vymax[] = "ymax"; |
| 59 |
|
char vxres[] = "xres"; |
| 250 |
|
} else if (iscolcor(s)) { /* color correction */ |
| 251 |
|
colcorval(ctmp, s); |
| 252 |
|
multcolor(input[nfiles].expos, ctmp); |
| 253 |
< |
} else if (isaspect(s)) { |
| 253 |
> |
} else if (isaspect(s)) |
| 254 |
|
input[nfiles].pa *= aspectval(s); |
| 255 |
< |
} else if (isview(s) && sscanview(&input[nfiles].vw, s) > 0) |
| 255 |
> |
else if (isview(s) && sscanview(&input[nfiles].vw, s) > 0) |
| 256 |
|
gotview++; |
| 257 |
|
/* echo line */ |
| 258 |
|
putchar('\t'); |
| 316 |
|
|
| 317 |
|
init() /* perform final setup */ |
| 318 |
|
{ |
| 319 |
< |
double l_colin(), l_expos(), l_ray(), l_psize(); |
| 319 |
> |
double l_colin(), l_expos(), l_pixaspect(), l_ray(), l_psize(); |
| 320 |
|
register int i; |
| 321 |
|
/* define constants */ |
| 322 |
+ |
varset("PI", ':', PI); |
| 323 |
|
varset(vnfiles, ':', (double)nfiles); |
| 324 |
|
varset(vxmax, ':', (double)xmax); |
| 325 |
|
varset(vymax, ':', (double)ymax); |
| 330 |
|
} |
| 331 |
|
funset(vbrtexp, 1, ':', l_expos); |
| 332 |
|
funset(vbrtin, 1, '=', l_colin); |
| 333 |
< |
for (i = 0; i < 6; i++) |
| 333 |
> |
funset(vpixaspect, 1, ':', l_pixaspect); |
| 334 |
> |
for (i = 0; i < 7; i++) |
| 335 |
|
funset(vray[i], 1, '=', l_ray); |
| 336 |
|
funset(vpsize, 1, '=', l_psize); |
| 337 |
|
/* set brightness function */ |
| 338 |
< |
if (!strcmp(ourfmt, CIEFMT)) |
| 338 |
> |
if (!strcmp(ourfmt, CIEFMT)) { |
| 339 |
> |
varset(vwhteff, ':', 1.0); |
| 340 |
|
ourbright = xyz_bright; |
| 341 |
+ |
} else |
| 342 |
+ |
varset(vwhteff, ':', WHTEFFICACY); |
| 343 |
|
} |
| 344 |
|
|
| 345 |
|
|
| 450 |
|
|
| 451 |
|
|
| 452 |
|
double |
| 453 |
+ |
l_pixaspect() /* return pixel aspect ratio */ |
| 454 |
+ |
{ |
| 455 |
+ |
register int fn; |
| 456 |
+ |
|
| 457 |
+ |
fn = argument(1) - .5; |
| 458 |
+ |
if (fn < 0 || fn >= nfiles) |
| 459 |
+ |
return(1.0); |
| 460 |
+ |
return(input[fn].pa); |
| 461 |
+ |
} |
| 462 |
+ |
|
| 463 |
+ |
|
| 464 |
+ |
double |
| 465 |
|
l_colin(nam) /* return color value for picture */ |
| 466 |
|
register char *nam; |
| 467 |
|
{ |
| 469 |
|
register int n, xoff, yoff; |
| 470 |
|
double d; |
| 471 |
|
|
| 472 |
< |
d = argument(1); |
| 454 |
< |
if (d > -.5 && d < .5) |
| 455 |
< |
return((double)nfiles); |
| 456 |
< |
fn = d - .5; |
| 472 |
> |
fn = argument(1) - .5; |
| 473 |
|
if (fn < 0 || fn >= nfiles) { |
| 474 |
|
errno = EDOM; |
| 475 |
|
return(0.0); |
| 521 |
|
{ |
| 522 |
|
static unsigned long ltick[MAXINP]; |
| 523 |
|
static FVECT lorg[MAXINP], ldir[MAXINP]; |
| 524 |
+ |
static double ldist[MAXINP]; |
| 525 |
|
FLOAT loc[2]; |
| 509 |
– |
double d; |
| 526 |
|
int fn; |
| 527 |
|
register int i; |
| 528 |
|
|
| 529 |
< |
d = argument(1); |
| 514 |
< |
if (d > -.5 && d < .5) |
| 515 |
< |
return((double)nfiles); |
| 516 |
< |
fn = d - .5; |
| 529 |
> |
fn = argument(1) - .5; |
| 530 |
|
if (fn < 0 || fn >= nfiles) { |
| 531 |
|
errno = EDOM; |
| 532 |
|
return(0.0); |
| 538 |
|
errno = EDOM; |
| 539 |
|
else { |
| 540 |
|
pix2loc(loc, &input[fn].rs, xscan, ymax-1-yscan); |
| 541 |
< |
if (viewray(lorg[fn], ldir[fn], |
| 542 |
< |
&input[fn].vw, loc[0], loc[1]) < 0) |
| 530 |
< |
errno = ERANGE; |
| 531 |
< |
ltick[fn] = eclock; |
| 541 |
> |
ldist[fn] = viewray(lorg[fn], ldir[fn], |
| 542 |
> |
&input[fn].vw, loc[0], loc[1]); |
| 543 |
|
} |
| 544 |
+ |
ltick[fn] = eclock; |
| 545 |
|
} |
| 546 |
< |
i = 6; |
| 546 |
> |
if (nam == vray[i=6]) |
| 547 |
> |
return(ldist[fn]); |
| 548 |
|
while (i--) |
| 549 |
|
if (nam == vray[i]) |
| 550 |
|
return(i < 3 ? lorg[fn][i] : ldir[fn][i-3]); |
| 558 |
|
{ |
| 559 |
|
static unsigned long ltick[MAXINP]; |
| 560 |
|
static double psize[MAXINP]; |
| 561 |
< |
FVECT dir0, org1, dir1; |
| 562 |
< |
FLOAT loc[2]; |
| 561 |
> |
FVECT dir0, org, dirx, diry; |
| 562 |
> |
FLOAT locx[2], locy[2]; |
| 563 |
|
double d; |
| 564 |
|
int fn; |
| 565 |
+ |
register int i; |
| 566 |
|
|
| 567 |
|
d = argument(1); |
| 568 |
< |
if (d > -.5 && d < .5) |
| 555 |
< |
return((double)nfiles); |
| 556 |
< |
fn = d - .5; |
| 557 |
< |
if (fn < 0 || fn >= nfiles) { |
| 568 |
> |
if (d < .5 || d >= nfiles+.5) { |
| 569 |
|
errno = EDOM; |
| 570 |
|
return(0.0); |
| 571 |
|
} |
| 572 |
< |
if (ltick[fn] < eclock) /* need to compute? */ |
| 573 |
< |
if (input[fn].vw.type == 0 || input[fn].vw.type == VT_PAR) |
| 572 |
> |
fn = d - .5; |
| 573 |
> |
if (ltick[fn] < eclock) { /* need to compute? */ |
| 574 |
> |
psize[fn] = 0.0; |
| 575 |
> |
if (input[fn].vw.type == 0) |
| 576 |
|
errno = EDOM; |
| 577 |
< |
else { |
| 578 |
< |
errno = 0; |
| 579 |
< |
dir0[0] = funvalue(vray[3], 1, &d); |
| 580 |
< |
if (errno) |
| 581 |
< |
return(0.0); |
| 582 |
< |
dir0[1] = funvalue(vray[4], 1, &d); |
| 583 |
< |
if (errno) |
| 584 |
< |
return(0.0); |
| 585 |
< |
dir0[2] = funvalue(vray[5], 1, &d); |
| 586 |
< |
if (errno) |
| 574 |
< |
return(0.0); |
| 575 |
< |
pix2loc(loc, &input[fn].rs, xscan+1, ymax-yscan); |
| 576 |
< |
psize[fn] = 0.0; |
| 577 |
< |
if (viewray(org1, dir1, |
| 578 |
< |
&input[fn].vw, loc[0], loc[1]) < 0) |
| 579 |
< |
errno = ERANGE; |
| 580 |
< |
else { |
| 577 |
> |
else if (input[fn].vw.type != VT_PAR && |
| 578 |
> |
funvalue(vray[6], 1, &d) >= 0) { |
| 579 |
> |
for (i = 0; i < 3; i++) |
| 580 |
> |
dir0[i] = funvalue(vray[3+i], 1, &d); |
| 581 |
> |
pix2loc(locx, &input[fn].rs, xscan+1, ymax-1-yscan); |
| 582 |
> |
pix2loc(locy, &input[fn].rs, xscan, ymax-yscan); |
| 583 |
> |
if (viewray(org, dirx, &input[fn].vw, |
| 584 |
> |
locx[0], locx[1]) >= 0 && |
| 585 |
> |
viewray(org, diry, &input[fn].vw, |
| 586 |
> |
locy[0], locy[1]) >= 0) { |
| 587 |
|
/* approximate solid angle */ |
| 588 |
< |
psize[fn] = dist2(dir0, dir1) * input[fn].pa / |
| 589 |
< |
(1.0 + input[fn].pa*input[fn].pa); |
| 590 |
< |
ltick[fn] = eclock; |
| 588 |
> |
for (i = 0; i < 3; i++) { |
| 589 |
> |
dirx[i] -= dir0[i]; |
| 590 |
> |
diry[i] -= dir0[i]; |
| 591 |
> |
} |
| 592 |
> |
fcross(dir0, dirx, diry); |
| 593 |
> |
psize[fn] = 0.5 * sqrt(DOT(dir0,dir0)); |
| 594 |
|
} |
| 595 |
|
} |
| 596 |
+ |
ltick[fn] = eclock; |
| 597 |
+ |
} |
| 598 |
|
return(psize[fn]); |
| 599 |
|
} |
| 600 |
|
|