1 |
greg |
2.1 |
#!/bin/csh -f |
2 |
|
|
# SCCSid "$SunId$ LBL" |
3 |
|
|
# |
4 |
|
|
# Do depth-of-field blurring on picture |
5 |
|
|
# |
6 |
|
|
if ($#argv < 5) then |
7 |
|
|
echo "Usage: $0 aperture distance nsamp picfile zfile [pinterp opts]" >/dev/tty |
8 |
|
|
exit 1 |
9 |
|
|
endif |
10 |
|
|
set a = "$1" |
11 |
|
|
set d = "$2" |
12 |
|
|
set n = "$3" |
13 |
|
|
set pict = "$4" |
14 |
|
|
set zbf = "$5" |
15 |
|
|
set piopt = ($argv[6-]:q) |
16 |
|
|
cnt $n | rcalc -e `vwright i < $pict` \ |
17 |
|
|
-e "M:19;a:$a/2;d:$d;N:$n;" -e 'tmax:PI*a*(M+1)' \ |
18 |
|
|
-e 't=tmax/N*($1+rand($1))' \ |
19 |
|
|
-e 'theta=2*M*PI/(M-1)*(M-sqrt(M*M-(M-1)/(PI*a)*t))' \ |
20 |
|
|
-e 'r=a*(1-(M-1)/(2*M*M*PI)*theta)' \ |
21 |
|
|
-e 'rcost=r*cos(theta);rsint=r*sin(theta)' \ |
22 |
|
|
-e 'opx=ipx+rcost*ihx+rsint*ivx' \ |
23 |
|
|
-e 'opy=ipy+rcost*ihy+rsint*ivy' \ |
24 |
|
|
-e 'opz=ipz+rcost*ihz+rsint*ivz' \ |
25 |
|
|
-e 'os=is-rcost/(d*ihn);ol=il-rsint/(d*ivn)' \ |
26 |
|
|
-o 'VIEW= -vp ${opx} ${opy} ${opz} -vs ${os} -vl ${ol}' \ |
27 |
|
|
| pinterp -vf $pict $piopt -B $pict $zbf |