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.2 by greg, Thu May 23 14:22:00 1991 UTC vs.
Revision 2.8 by greg, Sat Feb 22 02:07:27 2003 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 tempdir=/usr/tmp/fc$$
6 > set td=/usr/tmp/fc$$
7   onintr quit
8 < set mult=470
8 > set mult=179
9   set label=Nits
10   set scale=1000
11 < set redv='2*v-1'
12 < set grnv='if(v-.5,2-2*v,2*v)'
13 < set bluv='1-2*v'
11 > set decades=0
12 > set redv='1.6*v-.6'
13 > set grnv='if(v-.375,1.6-1.6*v,8/3*v)'
14 > set bluv='1-8/3*v'
15   set ndivs=8
16   set picture='-'
17   set cpict=
18 + set loff=0
19 + set legwidth=100
20 + set legheight=200
21   while ($#argv > 0)
22          switch ($argv[1])
23          case -m:
# Line 28 | Line 32 | while ($#argv > 0)
32                  shift argv
33                  set label="$argv[1]"
34                  breaksw
35 +        case -log:
36 +                shift argv
37 +                set decades=$argv[1]
38 +                breaksw
39          case -r:
40                  shift argv
41                  set redv="$argv[1]"
# Line 56 | Line 64 | while ($#argv > 0)
64                  breaksw
65          case -cl:
66                  set docont=a
67 +                set loff=12
68                  breaksw
69          case -cb:
70                  set docont=b
71 +                set loff=13
72                  breaksw
73 +        case -e:
74 +                set doextrem
75 +                set needfile
76 +                breaksw
77          case -n:
78                  shift argv
79                  set ndivs="$argv[1]"
80                  breaksw
81          default:
82 <                echo bad option "'$argv[1]'"
82 >                echo bad option "'$argv[1]'" >/dev/tty
83                  exit 1
84          endsw
85          shift argv
86   end
87 < mkdir $tempdir
88 < cat > $tempdir/pc.cal <<_EOF_
87 > mkdir $td
88 > cat > $td/pc0.cal <<_EOF_
89 > PI : 3.14159265358979323846 ;
90   scale : $scale ;
91   mult : $mult ;
92   ndivs : $ndivs ;
# Line 79 | Line 94 | ndivs : $ndivs ;
94   or(a,b) : if(a,a,b);
95   EPS : 1e-7;
96   neq(a,b) : if(a-b-EPS,1,b-a-EPS);
97 < btwn(a,b) : if(a-x,-1,b-x);
97 > btwn(a,x,b) : if(a-x,-1,b-x);
98 > clip(x) : if(x-1,1,if(x,x,0));
99   frac(x) : x - floor(x);
100 < boundary(a,b) : neq(floor(ndivs*a),floor(ndivs*b));
100 > boundary(a,b) : neq(floor(ndivs*a+.5),floor(ndivs*b+.5));
101  
102 < red=$redv;
103 < grn=$grnv;
88 < blu=$bluv;
102 > isconta = if(btwn(0,v,1),or(boundary(vleft,vright),boundary(vabove,vbelow)),-1);
103 > iscontb = if(btwn(0,v,1),btwn(.4,frac(ndivs*v),.6),-1);
104  
105 < v = li(1)*(mult/scale);
106 < vleft = li(1,-1,0)*(mult/scale);
107 < vright = li(1,1,0)*(mult/scale);
93 < vabove = li(1,0,1)*(mult/scale);
94 < vbelow = li(1,0,-1)*(mult/scale);
95 < isconta = or(boundary(vleft,vright),boundary(vabove,vbelow));
96 < iscontb = if(btwn(0,v,1),btwn(.4,frac(ndivs*v),.6),0);
105 > ro = if(in,clip($redv),ra);
106 > go = if(in,clip($grnv),ga);
107 > bo = if(in,clip($bluv),ba);
108  
109 < ro = if(in,red,ra);
110 < go = if(in,grn,ga);
111 < bo = if(in,blu,ba);
109 > ra = 0;
110 > ga = 0;
111 > ba = 0;
112  
113 + in = 1;
114 + _EOF_
115 + cat > $td/pc1.cal <<_EOF_
116 + norm : mult/scale/le(1);
117 +
118 + v = map(li(1)*norm);
119 +
120 + vleft = map(li(1,-1,0)*norm);
121 + vright = map(li(1,1,0)*norm);
122 + vabove = map(li(1,0,1)*norm);
123 + vbelow = map(li(1,0,-1)*norm);
124 +
125 + map(x) = x;
126 +
127   ra = ri(nfiles);
128   ga = gi(nfiles);
129   ba = bi(nfiles);
105
106 in = 1;
130   _EOF_
131 < set pcargs=(-o -f $tempdir/pc.cal)
131 > set pc0args=(-f $td/pc0.cal)
132 > set pc1args=(-f $td/pc1.cal)
133   if ($?docont) then
134 <        set pcargs=($pcargs -e "in=iscont$docont")
134 >        set pc0args=($pc0args -e "in=iscont$docont")
135   endif
136   if ("$cpict" == "") then
137 <        set pcargs=($pcargs -e 'ra=0;ga=0;ba=0')
137 >        set pc1args=($pc1args -e 'ra=0;ga=0;ba=0')
138   else if ("$cpict" == "$picture") then
139          set cpict=
140   endif
141 < pcomb $pcargs -e 'v=(y+.5)/200;vleft=v;vright=v' \
142 <                -e 'vbelow=(y-.5)/200;vabove=(y+1.5)/200' \
143 <                -e 'ra=0;ga=0;ba=0' -x 100 -y 200 \
144 <                > $tempdir/scol.pic
145 < (echo $label; cnt $ndivs |rcalc -e '$1='"($scale)/$ndivs*($ndivs"'-.5-$1)') \
146 <        | psign -cf 1 1 1 -cb 0 0 0 -h `ev "floor(2*200/$ndivs+.5)"` \
147 <        | pfilt -1 -x /2 -y /2 > $tempdir/slab.pic
148 < pcomb $pcargs $picture $cpict \
149 <        | pcompos $tempdir/scol.pic 0 0 -t .2 $tempdir/slab.pic 25 0 - 100 0
141 > if ($?needfile && "$picture" == '-') then
142 >        cat > $td/picture
143 >        set picture=$td/picture
144 > endif
145 > if ("$decades" != "0") then
146 >        set pc1args=($pc1args -e "map(x)=if(x-10^-$decades,log10(x)/$decades+1,0)")
147 >        set imap="imap(y)=10^((y-1)*$decades)"
148 > else
149 >        set imap="imap(y)=y"
150 > endif
151 > pcomb $pc0args -e 'v=(y+.5)/yres;vleft=v;vright=v' \
152 >                -e 'vbelow=(y-.5)/yres;vabove=(y+1.5)/yres' \
153 >                -x $legwidth -y $legheight > $td/scol.pic
154 > ( echo $label; cnt $ndivs \
155 >                | rcalc -e '$1='"($scale)*imap(($ndivs-.5-"'$1'")/$ndivs)" \
156 >                -e "$imap" | sed -e 's/\(\.[0-9][0-9][0-9]\)[0-9]*/\1/' ) \
157 >        | psign -s -.15 -cf 1 1 1 -cb 0 0 0 \
158 >                -h `ev "floor($legheight/$ndivs+.5)"` > $td/slab.pic
159 > if ( $?doextrem ) then
160 >        pextrem -o $picture > $td/extrema
161 >        set minpos=`sed 2d $td/extrema | rcalc -e '$2=$2;$1=$1+'"$legwidth"`
162 >        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/'`
163 >        set maxpos=`sed 1d $td/extrema | rcalc -e '$2=$2;$1=$1+'"$legwidth"`
164 >        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/'`
165 >        psign -s -.15 -a 2 -h 16 $minval > $td/minv.pic
166 >        psign -s -.15 -a 2 -h 16 $maxval > $td/maxv.pic
167 >        pcomb $pc0args $pc1args $picture $cpict \
168 >                | pcompos $td/scol.pic 0 0 -t .2 $td/slab.pic 0 $loff \
169 >                  - $legwidth 0 $td/minv.pic $minpos $td/maxv.pic $maxpos
170 > else
171 >        pcomb $pc0args $pc1args $picture $cpict \
172 >                | pcompos $td/scol.pic 0 0 -t .2 $td/slab.pic 0 $loff - $legwidth 0
173 > endif
174   quit:
175 < rm -rf $tempdir
175 > rm -rf $td

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines