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 1.5 by greg, Mon May 27 09:00:38 1991 UTC vs.
Revision 2.10 by greg, Sat Jul 31 17:56:56 2004 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 + # Added user-definable legend 2004/01/20 Rob Guglielmetti
7 +
8   set td=/usr/tmp/fc$$
9   onintr quit
10 < set mult=470
10 > set mult=179
11   set label=Nits
12   set scale=1000
13   set decades=0
# Line 15 | Line 17 | set bluv='1-8/3*v'
17   set ndivs=8
18   set picture='-'
19   set cpict=
20 + set loff=0
21   set legwidth=100
22   set legheight=200
23   while ($#argv > 0)
24          switch ($argv[1])
25 +        case -lw:
26 +                shift argv
27 +                set legwidth="$argv[1]"
28 +                breaksw
29 +        case -lh:
30 +                shift argv
31 +                set legheight="$argv[1]"
32 +                breaksw
33          case -m:
34                  shift argv
35                  set mult="$argv[1]"
# Line 63 | Line 74 | while ($#argv > 0)
74                  breaksw
75          case -cl:
76                  set docont=a
77 +                set loff=12
78                  breaksw
79          case -cb:
80                  set docont=b
81 +                set loff=13
82                  breaksw
83 +        case -e:
84 +                set doextrem
85 +                set needfile
86 +                breaksw
87          case -n:
88                  shift argv
89                  set ndivs="$argv[1]"
# Line 79 | Line 96 | while ($#argv > 0)
96   end
97   mkdir $td
98   cat > $td/pc0.cal <<_EOF_
99 + PI : 3.14159265358979323846 ;
100   scale : $scale ;
101   mult : $mult ;
102   ndivs : $ndivs ;
# Line 86 | Line 104 | ndivs : $ndivs ;
104   or(a,b) : if(a,a,b);
105   EPS : 1e-7;
106   neq(a,b) : if(a-b-EPS,1,b-a-EPS);
107 < btwn(a,b) : if(a-x,-1,b-x);
107 > btwn(a,x,b) : if(a-x,-1,b-x);
108   clip(x) : if(x-1,1,if(x,x,0));
109   frac(x) : x - floor(x);
110 < boundary(a,b) : neq(floor(ndivs*a),floor(ndivs*b));
110 > boundary(a,b) : neq(floor(ndivs*a+.5),floor(ndivs*b+.5));
111  
112 < isconta = or(boundary(vleft,vright),boundary(vabove,vbelow));
112 > isconta = if(btwn(0,v,1),or(boundary(vleft,vright),boundary(vabove,vbelow)),-1);
113   iscontb = if(btwn(0,v,1),btwn(.4,frac(ndivs*v),.6),-1);
114  
115   ro = if(in,clip($redv),ra);
# Line 130 | Line 148 | if ("$cpict" == "") then
148   else if ("$cpict" == "$picture") then
149          set cpict=
150   endif
151 < if ($decades > 0) then
151 > if ($?needfile && "$picture" == '-') then
152 >        cat > $td/picture
153 >        set picture=$td/picture
154 > endif
155 > if ("$decades" != "0") then
156          set pc1args=($pc1args -e "map(x)=if(x-10^-$decades,log10(x)/$decades+1,0)")
157          set imap="imap(y)=10^((y-1)*$decades)"
158   else
159          set imap="imap(y)=y"
160   endif
161 + if ( $legwidth > 20 && $legheight > 40 ) then
162   pcomb $pc0args -e 'v=(y+.5)/yres;vleft=v;vright=v' \
163                  -e 'vbelow=(y-.5)/yres;vabove=(y+1.5)/yres' \
164                  -x $legwidth -y $legheight > $td/scol.pic
165 < ( echo $label; cnt $ndivs \
165 > ( echo "$label"; cnt $ndivs \
166                  | rcalc -e '$1='"($scale)*imap(($ndivs-.5-"'$1'")/$ndivs)" \
167 <                -e "$imap" ) \
168 <        | psign -cf 1 1 1 -cb 0 0 0 -h `ev "floor(2*$legheight/$ndivs+.5)"` \
169 <        | pfilt -1 -x /2 -y /2 > $td/slab.pic
170 < pcomb $pc0args $pc1args $picture $cpict \
171 <        | pcompos $td/scol.pic 0 0 -t .2 $td/slab.pic 25 0 - $legwidth 0
167 >                -e "$imap" | sed -e 's/\(\.[0-9][0-9][0-9]\)[0-9]*/\1/' ) \
168 >        | psign -s -.15 -cf 1 1 1 -cb 0 0 0 \
169 >                -h `ev "floor($legheight/$ndivs+.5)"` > $td/slab.pic
170 > else
171 >        set legwidth=0
172 >        set legheight=0
173 >        (echo "" ; echo "-Y 1 +X 1" ; echo "aaa" ) > $td/scol.pic
174 >        cp $td/scol.pic $td/slab.pic
175 > endif
176 > if ( $?doextrem ) then
177 >        pextrem -o $picture > $td/extrema
178 >        set minpos=`sed 2d $td/extrema | rcalc -e '$2=$2;$1=$1+'"$legwidth"`
179 >        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/'`
180 >        set maxpos=`sed 1d $td/extrema | rcalc -e '$2=$2;$1=$1+'"$legwidth"`
181 >        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/'`
182 >        psign -s -.15 -a 2 -h 16 $minval > $td/minv.pic
183 >        psign -s -.15 -a 2 -h 16 $maxval > $td/maxv.pic
184 >        pcomb $pc0args $pc1args $picture $cpict \
185 >                | pcompos $td/scol.pic 0 0 -t .2 $td/slab.pic 0 $loff \
186 >                  - $legwidth 0 $td/minv.pic $minpos $td/maxv.pic $maxpos
187 > else
188 >        pcomb $pc0args $pc1args $picture $cpict \
189 >                | pcompos $td/scol.pic 0 0 -t .2 $td/slab.pic 0 $loff - $legwidth 0
190 > endif
191   quit:
192   rm -rf $td

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines