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.4 by greg, Fri May 24 17:23:01 1991 UTC vs.
Revision 1.9 by greg, Sat Oct 26 15:20:08 1991 UTC

# Line 3 | Line 3
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 decades=0
12 < set redv='2*v-1'
13 < set grnv='if(v-.5,2-2*v,2*v)'
14 < set bluv='1-2*v'
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 legwidth=100
19 + set legheight=200
20   while ($#argv > 0)
21          switch ($argv[1])
22          case -m:
# Line 75 | Line 77 | while ($#argv > 0)
77          endsw
78          shift argv
79   end
80 < mkdir $tempdir
81 < cat > $tempdir/pc.cal <<_EOF_
80 > mkdir $td
81 > cat > $td/pc0.cal <<_EOF_
82 > PI : 3.14159265358979323846 ;
83   scale : $scale ;
84   mult : $mult ;
85   ndivs : $ndivs ;
86  
84 norm : if(nfiles-.5, mult/scale/le(1), 0);
85
87   or(a,b) : if(a,a,b);
88   EPS : 1e-7;
89   neq(a,b) : if(a-b-EPS,1,b-a-EPS);
90 < btwn(a,b) : if(a-x,-1,b-x);
90 > btwn(a,x,b) : if(a-x,-1,b-x);
91 > clip(x) : if(x-1,1,if(x,x,0));
92   frac(x) : x - floor(x);
93   boundary(a,b) : neq(floor(ndivs*a),floor(ndivs*b));
94  
95 < map(x) = x;
96 < red = $redv;
95 < grn = $grnv;
96 < blu = $bluv;
95 > isconta = if(btwn(0,v,1),or(boundary(vleft,vright),boundary(vabove,vbelow)),-1);
96 > iscontb = if(btwn(0,v,1),btwn(.4,frac(ndivs*v),.6),-1);
97  
98 + ro = if(in,clip($redv),ra);
99 + go = if(in,clip($grnv),ga);
100 + bo = if(in,clip($bluv),ba);
101 +
102 + ra = 0;
103 + ga = 0;
104 + ba = 0;
105 +
106 + in = 1;
107 + _EOF_
108 + cat > $td/pc1.cal <<_EOF_
109 + norm : mult/scale/le(1);
110 +
111   v = map(li(1)*norm);
112 +
113   vleft = map(li(1,-1,0)*norm);
114   vright = map(li(1,1,0)*norm);
115   vabove = map(li(1,0,1)*norm);
116   vbelow = map(li(1,0,-1)*norm);
103 isconta = or(boundary(vleft,vright),boundary(vabove,vbelow));
104 iscontb = if(btwn(0,v,1),btwn(.4,frac(ndivs*v),.6),0);
117  
118 < ro = if(in,red,ra);
107 < go = if(in,grn,ga);
108 < bo = if(in,blu,ba);
118 > map(x) = x;
119  
120   ra = ri(nfiles);
121   ga = gi(nfiles);
122   ba = bi(nfiles);
113
114 in = 1;
123   _EOF_
124 < set pcargs=(-f $tempdir/pc.cal)
124 > set pc0args=(-f $td/pc0.cal)
125 > set pc1args=(-f $td/pc1.cal)
126   if ($?docont) then
127 <        set pcargs=($pcargs -e "in=iscont$docont")
127 >        set pc0args=($pc0args -e "in=iscont$docont")
128   endif
129   if ("$cpict" == "") then
130 <        set pcargs=($pcargs -e 'ra=0;ga=0;ba=0')
130 >        set pc1args=($pc1args -e 'ra=0;ga=0;ba=0')
131   else if ("$cpict" == "$picture") then
132          set cpict=
133   endif
134   if ($decades > 0) then
135 <        set pcargs=($pcargs -e "map(x)=log10(x)/$decades+1")
135 >        set pc1args=($pc1args -e "map(x)=if(x-10^-$decades,log10(x)/$decades+1,0)")
136          set imap="imap(y)=10^((y-1)*$decades)"
137   else
138          set imap="imap(y)=y"
139   endif
140 < pcomb $pcargs -e 'v=(y+.5)/200;vleft=v;vright=v' \
141 <                -e 'vbelow=(y-.5)/200;vabove=(y+1.5)/200' \
142 <                -e 'ra=0;ga=0;ba=0' -x 100 -y 200 \
134 <                > $tempdir/scol.pic
140 > pcomb $pc0args -e 'v=(y+.5)/yres;vleft=v;vright=v' \
141 >                -e 'vbelow=(y-.5)/yres;vabove=(y+1.5)/yres' \
142 >                -x $legwidth -y $legheight > $td/scol.pic
143   ( echo $label; cnt $ndivs \
144                  | rcalc -e '$1='"($scale)*imap(($ndivs-.5-"'$1'")/$ndivs)" \
145                  -e "$imap" ) \
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
146 >        | psign -cf 1 1 1 -cb 0 0 0 -h `ev "floor(2*$legheight/$ndivs+.5)"` \
147 >        | pfilt -1 -x /2 -y /2 > $td/slab.pic
148 > pcomb $pc0args $pc1args $picture $cpict \
149 >        | pcompos $td/scol.pic 0 0 -t .2 $td/slab.pic 25 0 - $legwidth 0
150   quit:
151 < rm -rf $tempdir
151 > rm -rf $td

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines