ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/px/falsecolor.csh
Revision: 1.1
Committed: Thu May 23 13:45:18 1991 UTC (32 years, 11 months ago) by greg
Content type: application/x-csh
Branch: MAIN
Log Message:
Initial revision

File Contents

# User Rev Content
1 greg 1.1 #!/bin/csh -f
2     # SCCSid "$SunId$ LBL"
3     #
4     # Create false color image with legend
5     #
6     set tempdir=/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'
14     set ndivs=8
15     set picture='-'
16     set cpict=
17     while ($#argv > 0)
18     switch ($argv[1])
19     case -m:
20     shift argv
21     set mult="$argv[1]"
22     breaksw
23     case -s:
24     shift argv
25     set scale="$argv[1]"
26     breaksw
27     case -l:
28     shift argv
29     set label="$argv[1]"
30     breaksw
31     case -r:
32     shift argv
33     set redv="$argv[1]"
34     breaksw
35     case -g:
36     shift argv
37     set grnv="$argv[1]"
38     breaksw
39     case -b:
40     shift argv
41     set bluv="$argv[1]"
42     breaksw
43     case -i:
44     shift argv
45     set picture="$argv[1]"
46     breaksw
47     case -p:
48     shift argv
49     set cpict="$argv[1]"
50     breaksw
51     case -ip:
52     case -pi:
53     shiftargv
54     set picture="$argv[1]"
55     set cpict="$argv[1]"
56     breaksw
57     case -cl:
58     set docont=a
59     breaksw
60     case -cb:
61     set docont=b
62     breaksw
63     case -n:
64     shiftargv
65     set ndivs="$argv[1]"
66     breadsw
67     default:
68     echo bad option "'$argv[1]'"
69     exit 1
70     endsw
71     shift argv
72     end
73     mkdir $tempdir
74     cat > $tempdir/pc.cal <<_EOF_
75     scale : $scale ;
76     mult : $mult ;
77     ndivs : $ndivs ;
78    
79     or(a,b) : if(a,a,b);
80     EPS : 1e-7;
81     neq(a,b) : if(a-b-EPS,1,b-a-EPS);
82     btwn(a,b) : if(a-x,-1,b-x);
83     frac(x) : x - floor(x);
84     boundary(a,b) : neq(floor(ndivs*a),floor(ndivs*b));
85    
86     red=$redv;
87     grn=$grnv;
88     blu=$bluv;
89    
90     v = li(1)*(mult/scale);
91     vleft = li(1,-1,0)*(mult/scale);
92     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    
98     ro = if(in,red,ra);
99     go = if(in,grn,ga);
100     bo = if(in,blu,ba);
101    
102     ra = ri(nfiles);
103     ga = gi(nfiles);
104     ba = bi(nfiles);
105    
106     in = 1;
107     _EOF_
108     set pcargs=(-o -f $tempdir/pc.cal)
109     if ($?docont) then
110     set pcargs=($pcargs -e "in=iscont$docont")
111     endif
112     if ("$cpict" == "") then
113     set pcargs=($pcargs -e 'ra=0;ga=0;ba=0')
114     else if ("$cpict" == "$picture") then
115     set cpict=
116     endif
117     pcomb $pcargs -e 'v=(y+.5)/200;vleft=v;vright=v' \
118     -e 'vbelow=(y-.5)/200;vabove=(y+1.5)/200' \
119     -e 'ra=0;ga=0;ba=0' -x 100 -y 200 \
120     > $tempdir/scol.pic
121     (echo $label; cnt $ndivs |rcalc -e '$1='"($scale)/$ndivs*($ndivs"'-.5-$1)') \
122     | psign -cf 1 1 1 -cb 0 0 0 -h `ev "floor(200/$ndivs+.5)"` \
123     > $tempdir/slab.pic
124     pcomb $pcargs $picture $cpict \
125     | pcompos $tempdir/scol.pic 0 0 -t .5 $tempdir/slab.pic 25 0 - 100 0
126     quit:
127     rm -rf $tempdir