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