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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines