ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/px/falsecolor.pl
(Generate patch)

Comparing ray/src/px/falsecolor.pl (file contents):
Revision 2.8 by greg, Thu Apr 26 21:03:58 2012 UTC vs.
Revision 2.11 by greg, Tue Sep 5 22:42:52 2017 UTC

# Line 6 | Line 6 | use strict;
6   use File::Temp qw/ tempdir /;
7   use POSIX qw/ floor /;
8  
9 < my @palettes = ('def', 'spec', 'pm3d', 'hot');
9 > my @palettes = ('def', 'spec', 'pm3d', 'hot', 'eco');
10  
11   my $mult = 179.0;              # Multiplier. Default W/sr/m2 -> cd/m2
12   my $label = 'cd/m2';           # Units shown in legend
13   my $scale = 1000;              # Top of the scale
14 + my $matchscale = 1;            # Adjust top of scale to match given label
15   my $decades = 0;               # Default is linear mapping
16   my $pal = 'def';               # Palette
17   my $redv = "${pal}_red(v)";    # Mapping functions for R,G,B
# Line 37 | Line 38 | while ($#ARGV >= 0) {
38          $legheight = shift;
39      } elsif (m/-m/) {          # Multiplier
40          $mult = shift;
41 +    } elsif (m/-spec/) {
42 +        die("depricated option '-spec'. Please use '-pal spec' instead.");
43      } elsif (m/-s/) {          # Scale
44          $scale = shift;
45          if ($scale =~ m/[aA].*/) {
46 +            $matchscale = 0;
47              $needfile = 1;
48 <        }
48 >       } else {
49 >            $matchscale = 1;
50 >        }
51      } elsif (m/-l$/) {         # Label
52          $label = shift;
53      } elsif (m/-log/) {        # Logarithmic mapping
# Line 92 | Line 98 | while ($#ARGV >= 0) {
98      }
99   }
100  
101 + if (($legwidth <= 20) || ($legheight <= 40)) {
102 +    # Legend is too small to be legible. Don't bother doing one.
103 +    $legwidth = 0;
104 +    $legheight = 0;
105 +    $loff = 0;
106 +    $matchscale = 0;
107 + }
108 +
109   # Temporary directory. Will be removed upon successful program exit.
110   my $td = tempdir( CLEANUP => 1 );
111  
# Line 119 | Line 133 | if ($scale =~ m/[aA].*/) {
133      # 3.94282   6
134      my $LogLmax = $histo[0];
135      $scale = $mult / 179 * 10**$LogLmax;
136 + } elsif ($matchscale) {
137 +    # Adjust scale so legend reflects -s setting
138 +    if ($decades > 0) {
139 +        $scale *= 10**($decades/(2.*$ndivs));
140 +    } else {
141 +        $scale *= $ndivs/($ndivs - .5);
142 +    }
143   }
144  
145   my $pc0 = "$td/pc0.cal";
# Line 150 | Line 171 | hot_red(x) = clip(3*x) ^ gamma;
171   hot_grn(x) = clip(3*x - 1) ^ gamma;
172   hot_blu(x) = clip(3*x - 2) ^ gamma;
173  
174 + eco_red(x) = clip(2*x) ^ gamma;
175 + eco_grn(x) = clip(2*(x-0.5)) ^ gamma;
176 + eco_blu(x) = clip(2*(0.5-x)) ^ gamma;
177 +
178   interp_arr2(i,x,f):(i+1-x)*f(i)+(x-i)*f(i+1);
179   interp_arr(x,f):if(x-1,if(f(0)-x,interp_arr2(floor(x),x,f),f(f(0))),f(1));
180  
# Line 258 | Line 283 | my $scolpic = "$td/scol.hdr";
283   my $slabpic = "$td/slab.hdr";
284   my $cmd;
285  
286 < if (($legwidth > 20) && ($legheight > 40)) {
286 > if ($legwidth > 0) {
287      # Legend: Create the text labels
288      my $sheight = floor($legheight / $ndivs + 0.5);
289      $legheight = $sheight * $ndivs;
# Line 288 | Line 313 | if (($legwidth > 20) && ($legheight > 40)) {
313      $cmd .= qq[ -x $legwidth -y $legheight > $scolpic];
314      system $cmd;
315   } else {
291    # Legend is too small to be legible. Don't bother doing one.
292    $legwidth = 0;
293    $legheight = 0;
294    $loff = 0;
295
316      # Create dummy colour scale and legend labels so we don't
317      # need to change the final command line.
318      open(FHscolpic, ">$scolpic");
# Line 311 | Line 331 | system $cmd;
331   my $loff1 = $loff - 1;
332  
333   # Command line without extrema
334 < $cmd = qq[pcomb $pc0args $pc1args $picture $cpict];
334 > $cmd = qq[pcomb $pc0args $pc1args "$picture"];
335 > $cmd .= qq[ "$cpict"] if ($cpict);
336   $cmd .= qq[ | pcompos $scolpic 0 0 +t .1 $slabinvpic 2 $loff1];
337   $cmd .= qq[ -t .5 $slabpic 0 $loff - $legwidth 0];
338  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines