ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/px/falsecolor.csh
(Generate patch)

Comparing ray/src/px/falsecolor.csh (file contents):
Revision 2.6 by greg, Wed May 19 09:50:51 1993 UTC vs.
Revision 2.14 by greg, Fri Nov 18 22:17:16 2005 UTC

# Line 1 | Line 1
1 < #!/bin/csh -f
2 < # SCCSid "$SunId$ LBL"
1 > #!/bin/csh -fe
2 > # RCSid: $Id$
3   #
4   # Create false color image with legend
5   #
6 < set td=/usr/tmp/fc$$
6 > # Added user-definable legend 2004/01/20 Rob Guglielmetti
7 >
8 > set td=/tmp/fc$$
9   onintr quit
10   set mult=179
11   set label=Nits
12   set scale=1000
13   set decades=0
14 < set redv='1.6*v-.6'
15 < set grnv='if(v-.375,1.6-1.6*v,8/3*v)'
16 < set bluv='1-8/3*v'
14 > # set redv='1.6*v-.6'
15 > # set grnv='if(v-.375,1.6-1.6*v,8/3*v)'
16 > # set bluv='1-8/3*v'
17 > set redv='def_red(v)'
18 > set grnv='def_grn(v)'
19 > set bluv='def_blu(v)'
20   set ndivs=8
21   set picture='-'
22   set cpict=
# Line 20 | Line 25 | set legwidth=100
25   set legheight=200
26   while ($#argv > 0)
27          switch ($argv[1])
28 +        case -lw:
29 +                shift argv
30 +                set legwidth="$argv[1]"
31 +                breaksw
32 +        case -lh:
33 +                shift argv
34 +                set legheight="$argv[1]"
35 +                breaksw
36          case -m:
37                  shift argv
38                  set mult="$argv[1]"
# Line 79 | Line 92 | while ($#argv > 0)
92                  set ndivs="$argv[1]"
93                  breaksw
94          default:
95 <                echo bad option "'$argv[1]'" >/dev/tty
95 >                echo bad option "'$argv[1]'"
96                  exit 1
97          endsw
98          shift argv
# Line 99 | Line 112 | clip(x) : if(x-1,1,if(x,x,0));
112   frac(x) : x - floor(x);
113   boundary(a,b) : neq(floor(ndivs*a+.5),floor(ndivs*b+.5));
114  
115 + interp_arr2(i,x,f):(i+1-x)*f(i)+(x-i)*f(i+1);
116 + interp_arr(x,f):if(x-1,if(f(0)-x,interp_arr2(floor(x),x,f),f(f(0))),f(1));
117 + def_redp(i):select(i,0.18848,0.05468174,
118 + 0.00103547,8.311144e-08,7.449763e-06,0.0004390987,0.001389302,
119 + 0.003306035,0.01381413,0.0563861,0.1534137,0.2581243,0.3059902,
120 + 0.3449827,0.3791056,0.4138921,0.4678283,0.624231,0.7732902,
121 + 0.9067587,1,1,0.9863);
122 + def_red(x):interp_arr(x/0.0454545+1,def_redp);
123 + def_grnp(i):select(i,0.0009766,2.35501e-05,
124 + 0.0008966244,0.0264977,0.1256843,0.2865799,0.424867,0.4750973,
125 + 0.4403898,0.3568169,0.244569,0.1643434,0.1297663,0.1001566,
126 + 0.07522873,0.05465921,0.03394894,0.001412969,0.00681687,
127 + 0.0974651,0.3106831,0.6447838,0.9707);
128 + def_grn(x):interp_arr(x/0.0454545+1,def_grnp);
129 + def_blup(i):select(i,0.2666,0.3638662,0.4770437,
130 + 0.5131397,0.5363797,0.5193677,0.4091852,0.1732726,0.05331749,
131 + 0.04184916,0.05768565,0.070331,0.0738812,0.07805368,0.08024318,
132 + 0.07775604,0.06449649,0.01028498,0.0003090336,0.0004275006,
133 + 0.002297005,0.01128842,0.02539);
134 + def_blu(x):interp_arr(x/0.0454545+1,def_blup);
135 +
136   isconta = if(btwn(0,v,1),or(boundary(vleft,vright),boundary(vabove,vbelow)),-1);
137   iscontb = if(btwn(0,v,1),btwn(.4,frac(ndivs*v),.6),-1);
138  
105 ro = if(in,clip($redv),ra);
106 go = if(in,clip($grnv),ga);
107 bo = if(in,clip($bluv),ba);
108
139   ra = 0;
140   ga = 0;
141   ba = 0;
142  
143   in = 1;
144 +
145 + ro = if(in,clip($redv),ra);
146 + go = if(in,clip($grnv),ga);
147 + bo = if(in,clip($bluv),ba);
148   _EOF_
149   cat > $td/pc1.cal <<_EOF_
150   norm : mult/scale/le(1);
# Line 148 | Line 182 | if ("$decades" != "0") then
182   else
183          set imap="imap(y)=y"
184   endif
185 + if ( $legwidth > 20 && $legheight > 40 ) then
186   pcomb $pc0args -e 'v=(y+.5)/yres;vleft=v;vright=v' \
187                  -e 'vbelow=(y-.5)/yres;vabove=(y+1.5)/yres' \
188                  -x $legwidth -y $legheight > $td/scol.pic
189 < ( echo $label; cnt $ndivs \
189 > ( echo "$label"; cnt $ndivs \
190                  | rcalc -e '$1='"($scale)*imap(($ndivs-.5-"'$1'")/$ndivs)" \
191 <                -e "$imap" ) \
191 >                -e "$imap" | sed -e 's/\(\.[0-9][0-9][0-9]\)[0-9]*/\1/' ) \
192          | psign -s -.15 -cf 1 1 1 -cb 0 0 0 \
193                  -h `ev "floor($legheight/$ndivs+.5)"` > $td/slab.pic
194 + else
195 +        set legwidth=0
196 +        set legheight=0
197 +        (echo "" ; echo "-Y 1 +X 1" ; echo "aaa" ) > $td/scol.pic
198 +        cp $td/scol.pic $td/slab.pic
199 + endif
200   if ( $?doextrem ) then
201          pextrem -o $picture > $td/extrema
202          set minpos=`sed 2d $td/extrema | rcalc -e '$2=$2;$1=$1+'"$legwidth"`
203 <        set minval=`rcalc -e '$1=($3*.3+$4*.59+$5*.11)*'"$mult" $td/extrema | sed -e 2d -e 's/\(.....\).*$/\1/'`
203 >        set minval=`rcalc -e '$1=($3*.27+$4*.67+$5*.06)*'"$mult" $td/extrema | sed -e 2d -e 's/\(\.[0-9][0-9][0-9]\)[0-9]*/\1/'`
204          set maxpos=`sed 1d $td/extrema | rcalc -e '$2=$2;$1=$1+'"$legwidth"`
205 <        set maxval=`rcalc -e '$1=($3*.3+$4*.59+$5*.11)*'"$mult" $td/extrema | sed -e 1d -e 's/\(.....\).*$/\1/'`
205 >        set maxval=`rcalc -e '$1=($3*.27+$4*.67+$5*.06)*'"$mult" $td/extrema | sed -e 1d -e 's/\(\.[0-9][0-9][0-9]\)[0-9]*/\1/'`
206          psign -s -.15 -a 2 -h 16 $minval > $td/minv.pic
207          psign -s -.15 -a 2 -h 16 $maxval > $td/maxv.pic
208          pcomb $pc0args $pc1args $picture $cpict \
209 <                | pcompos $td/scol.pic 0 0 -t .2 $td/slab.pic 0 $loff \
209 >                | pcompos $td/scol.pic 0 0 \
210 >                        +t .1 "\!pcomb -e 'lo=1-gi(1)' $td/slab.pic" \
211 >                        `ev 2 $loff-1` -t .5 $td/slab.pic 0 $loff \
212                    - $legwidth 0 $td/minv.pic $minpos $td/maxv.pic $maxpos
213   else
214          pcomb $pc0args $pc1args $picture $cpict \
215 <                | pcompos $td/scol.pic 0 0 -t .2 $td/slab.pic 0 $loff - $legwidth 0
215 >                | pcompos $td/scol.pic 0 0 \
216 >                        +t .1 "\!pcomb -e 'lo=1-gi(1)' $td/slab.pic" \
217 >                        `ev 2 $loff-1` -t .5 $td/slab.pic 0 $loff \
218 >                        - $legwidth 0
219   endif
220   quit:
221   rm -rf $td

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines