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.10 by greg, Tue Apr 15 21:34:31 2014 UTC vs.
Revision 2.11 by greg, Tue Sep 5 22:42:52 2017 UTC

# Line 11 | Line 11 | my @palettes = ('def', 'spec', 'pm3d', 'hot', 'eco');
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 42 | Line 43 | while ($#ARGV >= 0) {
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 94 | 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 121 | 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 264 | 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 294 | Line 313 | if (($legwidth > 20) && ($legheight > 40)) {
313      $cmd .= qq[ -x $legwidth -y $legheight > $scolpic];
314      system $cmd;
315   } else {
297    # Legend is too small to be legible. Don't bother doing one.
298    $legwidth = 0;
299    $legheight = 0;
300    $loff = 0;
301
316      # Create dummy colour scale and legend labels so we don't
317      # need to change the final command line.
318      open(FHscolpic, ">$scolpic");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines