| 694 |
|
} |
| 695 |
|
/* optional depth-of-field */ |
| 696 |
|
if (dblur > FTINY && vdist > FTINY) { |
| 697 |
< |
double vc, df[2]; |
| 698 |
< |
df[0] = PI/4.*dblur*(.5 - frandom())/sqrt(ourview.hn2); |
| 699 |
< |
df[1] = PI/4.*dblur*(.5 - frandom())/sqrt(ourview.vn2); |
| 700 |
< |
for (i = 3; i--; ) { |
| 701 |
< |
vc = thisray.rorg[i] + vdist*thisray.rdir[i]; |
| 702 |
< |
thisray.rorg[i] += df[0]*ourview.hvec[i] + |
| 703 |
< |
df[1]*ourview.vvec[i] ; |
| 704 |
< |
thisray.rdir[i] = vc - thisray.rorg[i]; |
| 697 |
> |
double vc, dfh, dfv; |
| 698 |
> |
/* PI/4. square/circle conv. */ |
| 699 |
> |
dfh = PI/4.*dblur*(.5 - frandom()); |
| 700 |
> |
dfv = PI/4.*dblur*(.5 - frandom()); |
| 701 |
> |
if (ourview.type == VT_PER || ourview.type == VT_PAR) { |
| 702 |
> |
dfh /= sqrt(ourview.hn2); |
| 703 |
> |
dfv /= sqrt(ourview.vn2); |
| 704 |
> |
for (i = 3; i--; ) { |
| 705 |
> |
vc = thisray.rorg[i] + vdist*thisray.rdir[i]; |
| 706 |
> |
thisray.rorg[i] += dfh*ourview.hvec[i] + |
| 707 |
> |
dfv*ourview.vvec[i] ; |
| 708 |
> |
thisray.rdir[i] = vc - thisray.rorg[i]; |
| 709 |
> |
} |
| 710 |
> |
} else { /* non-standard view case */ |
| 711 |
> |
double dfd = PI/4.*dblur*(.5 - frandom()); |
| 712 |
> |
if (ourview.type != VT_ANG) { |
| 713 |
> |
if (ourview.type != VT_CYL) |
| 714 |
> |
dfh /= sqrt(ourview.hn2); |
| 715 |
> |
dfv /= sqrt(ourview.vn2); |
| 716 |
> |
} |
| 717 |
> |
for (i = 3; i--; ) { |
| 718 |
> |
vc = thisray.rorg[i] + vdist*thisray.rdir[i]; |
| 719 |
> |
thisray.rorg[i] += dfh*ourview.hvec[i] + |
| 720 |
> |
dfv*ourview.vvec[i] + |
| 721 |
> |
dfd*ourview.vdir[i] ; |
| 722 |
> |
thisray.rdir[i] = vc - thisray.rorg[i]; |
| 723 |
> |
} |
| 724 |
|
} |
| 725 |
|
if (normalize(thisray.rdir) == 0.0) |
| 726 |
|
return(0.0); |