| 7 |
|
echo "Usage: $0 optics.mat .." |
| 8 |
|
exit 1 |
| 9 |
|
endif |
| 10 |
< |
cat > /tmp/opt.fmt << '_EOF_' |
| 10 |
> |
set optf=`mktemp /tmp/optfmt.XXXXXXX` |
| 11 |
> |
cat > $optf << '_EOF_' |
| 12 |
|
void glass $(name)_glass |
| 13 |
|
0 |
| 14 |
|
0 |
| 34 |
|
'_EOF_' |
| 35 |
|
|
| 36 |
|
echo "# Output generated by $0 from $*" |
| 37 |
+ |
sed -e '/^[^#]/d' -e '/^$/d' $* |
| 38 |
|
|
| 39 |
< |
cat > /tmp/out$$.fmt << '_EOF_' |
| 39 |
> |
set outf=`mktemp /tmp/outfmt.XXXXXX` |
| 40 |
> |
cat > $outf << '_EOF_' |
| 41 |
|
|
| 42 |
|
void glass $(name) |
| 43 |
|
0 |
| 45 |
|
3 ${Rtn} ${Gtn} ${Btn} |
| 46 |
|
'_EOF_' |
| 47 |
|
|
| 48 |
< |
rcalc -e 'abs(x):if(x,x,-x);and(a,b):if(a,b,a);not(x):if(x,-1,1)' \ |
| 48 |
> |
rcalc -l -e 'abs(x):if(x,x,-x);and(a,b):if(a,b,a);not(x):if(x,-1,1)' \ |
| 49 |
|
-e 'lum(r,g,b):.265*r+.670*g+.065*b' \ |
| 50 |
|
-e 'trans=lum(Rtau,Gtau,Btau)' \ |
| 51 |
|
-e 'rfront=lum(fRrho,fGrho,fBrho);rback=lum(bRrho,bGrho,bBrho)' \ |
| 52 |
|
-e 'cond=0.005-abs(rfront-rback)' \ |
| 53 |
< |
-i /tmp/opt.fmt -o /tmp/out$$.fmt $* |
| 53 |
> |
-i $optf -o $outf $* |
| 54 |
|
|
| 55 |
< |
cat > /tmp/out$$.fmt << '_EOF_' |
| 55 |
> |
cat > $outf << '_EOF_' |
| 56 |
|
|
| 57 |
|
void BRTDfunc $(name) |
| 58 |
|
10 |
| 66 |
|
${bRrho} ${bGrho} ${bBrho} |
| 67 |
|
'_EOF_' |
| 68 |
|
|
| 69 |
< |
rcalc -e 'abs(x):if(x,x,-x);and(a,b):if(a,b,a);not(x):if(x,-1,1)' \ |
| 69 |
> |
rcalc -l -e 'abs(x):if(x,x,-x);and(a,b):if(a,b,a);not(x):if(x,-1,1)' \ |
| 70 |
|
-e 'lum(r,g,b):.265*r+.670*g+.065*b' \ |
| 71 |
|
-e 'trans=lum(Rtau,Gtau,Btau)' \ |
| 72 |
|
-e 'rfront=lum(fRrho,fGrho,fBrho);rback=lum(bRrho,bGrho,bBrho)' \ |
| 73 |
|
-e 'cond=and(trans-.645, not(0.005-abs(rfront-rback)))' \ |
| 74 |
< |
-i /tmp/opt.fmt -o /tmp/out$$.fmt $* |
| 74 |
> |
-i $optf -o $outf $* |
| 75 |
|
|
| 76 |
< |
cat > /tmp/out$$.fmt << '_EOF_' |
| 76 |
> |
cat > $outf << '_EOF_' |
| 77 |
|
|
| 78 |
|
void BRTDfunc $(name) |
| 79 |
|
10 |
| 87 |
|
${bRrho} ${bGrho} ${bBrho} |
| 88 |
|
'_EOF_' |
| 89 |
|
|
| 90 |
< |
rcalc -e 'abs(x):if(x,x,-x);and(a,b):if(a,b,a);not(x):if(x,-1,1)' \ |
| 90 |
> |
rcalc -l -e 'abs(x):if(x,x,-x);and(a,b):if(a,b,a);not(x):if(x,-1,1)' \ |
| 91 |
|
-e 'lum(r,g,b):.265*r+.670*g+.065*b' \ |
| 92 |
|
-e 'trans=lum(Rtau,Gtau,Btau)' \ |
| 93 |
|
-e 'rfront=lum(fRrho,fGrho,fBrho);rback=lum(bRrho,bGrho,bBrho)' \ |
| 94 |
|
-e 'cond=and(not(trans-.645), not(0.005-abs(rfront-rback)))' \ |
| 95 |
< |
-i /tmp/opt.fmt -o /tmp/out$$.fmt $* |
| 95 |
> |
-i $optf -o $outf $* |
| 96 |
|
|
| 97 |
< |
rm -f /tmp/opt.fmt /tmp/out$$.fmt |
| 97 |
> |
rm -f $optf $outf |