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.12 by greg, Wed Feb 16 05:40:11 2005 UTC vs.
Revision 2.20 by greg, Wed May 27 15:38:29 2009 UTC

# Line 5 | Line 5
5   #
6   # Added user-definable legend 2004/01/20 Rob Guglielmetti
7  
8 set td=/tmp/fc$$
8   onintr quit
9 + set td=`mktemp -d /tmp/fc.XXXXXX`
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='def_red(v)'
15 > set grnv='def_grn(v)'
16 > set bluv='def_blu(v)'
17   set ndivs=8
18   set picture='-'
19   set cpict=
# Line 37 | Line 37 | while ($#argv > 0)
37          case -s:
38                  shift argv
39                  set scale="$argv[1]"
40 +                if ("$scale" =~ [aA]*) set needfile
41                  breaksw
42          case -l:
43                  shift argv
# Line 58 | Line 59 | while ($#argv > 0)
59                  shift argv
60                  set bluv="$argv[1]"
61                  breaksw
62 +        case -spec:
63 +                set redv='old_red(v)'
64 +                set grnv='old_grn(v)'
65 +                set bluv='old_blu(v)'
66 +                breaksw
67          case -i:
68                  shift argv
69                  set picture="$argv[1]"
# Line 94 | Line 100 | while ($#argv > 0)
100          endsw
101          shift argv
102   end
103 < mkdir $td
103 > if ($?needfile && "$picture" == '-') then
104 >        cat > $td/picture
105 >        set picture=$td/picture
106 > endif
107 > if ("$scale" =~ [aA]*) then
108 >        set LogLmax=`phisto $picture | tail -2 | sed -n '1s/    [0-9]*$//p'`
109 >        set scale=`ev "$mult/179*10^$LogLmax"`
110 > endif
111   cat > $td/pc0.cal <<_EOF_
112   PI : 3.14159265358979323846 ;
113   scale : $scale ;
# Line 109 | Line 122 | clip(x) : if(x-1,1,if(x,x,0));
122   frac(x) : x - floor(x);
123   boundary(a,b) : neq(floor(ndivs*a+.5),floor(ndivs*b+.5));
124  
125 + old_red(x) = 1.6*x - .6;
126 + old_grn(x) = if(x-.375, 1.6-1.6*x, 8/3*x);
127 + old_blu(x) = 1 - 8/3*x;
128 +
129 + interp_arr2(i,x,f):(i+1-x)*f(i)+(x-i)*f(i+1);
130 + interp_arr(x,f):if(x-1,if(f(0)-x,interp_arr2(floor(x),x,f),f(f(0))),f(1));
131 + def_redp(i):select(i,0.18848,0.05468174,
132 + 0.00103547,8.311144e-08,7.449763e-06,0.0004390987,0.001367254,
133 + 0.003076,0.01376382,0.06170773,0.1739422,0.2881156,0.3299725,
134 + 0.3552663,0.372552,0.3921184,0.4363976,0.6102754,0.7757267,
135 + 0.9087369,1,1,0.9863);
136 + def_red(x):interp_arr(x/0.0454545+1,def_redp);
137 + def_grnp(i):select(i,0.0009766,2.35501e-05,
138 + 0.0008966244,0.0264977,0.1256843,0.2865799,0.4247083,0.4739468,
139 + 0.4402732,0.3671876,0.2629843,0.1725325,0.1206819,0.07316644,
140 + 0.03761026,0.01612362,0.004773749,6.830967e-06,0.00803605,
141 + 0.1008085,0.3106831,0.6447838,0.9707);
142 + def_grn(x):interp_arr(x/0.0454545+1,def_grnp);
143 + def_blup(i):select(i,0.2666,0.3638662,0.4770437,
144 + 0.5131397,0.5363797,0.5193677,0.4085123,0.1702815,0.05314236,
145 + 0.05194055,0.08564082,0.09881395,0.08324373,0.06072902,
146 + 0.0391076,0.02315354,0.01284458,0.005184709,0.001691774,
147 + 2.432735e-05,1.212949e-05,0.006659406,0.02539);
148 + def_blu(x):interp_arr(x/0.0454545+1,def_blup);
149 +
150   isconta = if(btwn(0,v,1),or(boundary(vleft,vright),boundary(vabove,vbelow)),-1);
151   iscontb = if(btwn(0,v,1),btwn(.4,frac(ndivs*v),.6),-1);
152  
115 ro = if(in,clip($redv),ra);
116 go = if(in,clip($grnv),ga);
117 bo = if(in,clip($bluv),ba);
118
153   ra = 0;
154   ga = 0;
155   ba = 0;
156  
157   in = 1;
158 +
159 + ro = if(in,clip($redv),ra);
160 + go = if(in,clip($grnv),ga);
161 + bo = if(in,clip($bluv),ba);
162   _EOF_
163   cat > $td/pc1.cal <<_EOF_
164   norm : mult/scale/le(1);
# Line 148 | Line 186 | if ("$cpict" == "") then
186   else if ("$cpict" == "$picture") then
187          set cpict=
188   endif
151 if ($?needfile && "$picture" == '-') then
152        cat > $td/picture
153        set picture=$td/picture
154 endif
189   if ("$decades" != "0") then
190          set pc1args=($pc1args -e "map(x)=if(x-10^-$decades,log10(x)/$decades+1,0)")
191          set imap="imap(y)=10^((y-1)*$decades)"
# Line 161 | Line 195 | endif
195   if ( $legwidth > 20 && $legheight > 40 ) then
196   pcomb $pc0args -e 'v=(y+.5)/yres;vleft=v;vright=v' \
197                  -e 'vbelow=(y-.5)/yres;vabove=(y+1.5)/yres' \
198 <                -x $legwidth -y $legheight > $td/scol.pic
198 >                -x $legwidth -y $legheight > $td/scol.hdr
199   ( echo "$label"; cnt $ndivs \
200                  | rcalc -e '$1='"($scale)*imap(($ndivs-.5-"'$1'")/$ndivs)" \
201                  -e "$imap" | sed -e 's/\(\.[0-9][0-9][0-9]\)[0-9]*/\1/' ) \
202          | psign -s -.15 -cf 1 1 1 -cb 0 0 0 \
203 <                -h `ev "floor($legheight/$ndivs+.5)"` > $td/slab.pic
203 >                -h `ev "floor($legheight/$ndivs+.5)"` > $td/slab.hdr
204   else
205          set legwidth=0
206          set legheight=0
207 <        (echo "" ; echo "-Y 1 +X 1" ; echo "aaa" ) > $td/scol.pic
208 <        cp $td/scol.pic $td/slab.pic
207 >        (echo "" ; echo "-Y 1 +X 1" ; echo "aaa" ) > $td/scol.hdr
208 >        cp $td/scol.hdr $td/slab.hdr
209   endif
210   if ( $?doextrem ) then
211          pextrem -o $picture > $td/extrema
# Line 179 | Line 213 | if ( $?doextrem ) then
213          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/'`
214          set maxpos=`sed 1d $td/extrema | rcalc -e '$2=$2;$1=$1+'"$legwidth"`
215          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/'`
216 <        psign -s -.15 -a 2 -h 16 $minval > $td/minv.pic
217 <        psign -s -.15 -a 2 -h 16 $maxval > $td/maxv.pic
216 >        psign -s -.15 -a 2 -h 16 $minval > $td/minv.hdr
217 >        psign -s -.15 -a 2 -h 16 $maxval > $td/maxv.hdr
218          pcomb $pc0args $pc1args $picture $cpict \
219 <                | pcompos $td/scol.pic 0 0 -t .2 $td/slab.pic 0 $loff \
220 <                  - $legwidth 0 $td/minv.pic $minpos $td/maxv.pic $maxpos
219 >                | pcompos $td/scol.hdr 0 0 \
220 >                        +t .1 "\!pcomb -e 'lo=1-gi(1)' $td/slab.hdr" \
221 >                        `ev 2 $loff-1` -t .5 $td/slab.hdr 0 $loff \
222 >                  - $legwidth 0 $td/minv.hdr $minpos $td/maxv.hdr $maxpos
223   else
224          pcomb $pc0args $pc1args $picture $cpict \
225 <                | pcompos $td/scol.pic 0 0 -t .2 $td/slab.pic 0 $loff - $legwidth 0
225 >                | pcompos $td/scol.hdr 0 0 \
226 >                        +t .1 "\!pcomb -e 'lo=1-gi(1)' $td/slab.hdr" \
227 >                        `ev 2 $loff-1` -t .5 $td/slab.hdr 0 $loff \
228 >                        - $legwidth 0
229   endif
230   quit:
231   rm -rf $td

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines