Skip to content

Commit 5fe04cc

Browse files
committed
extract Scale vars in Cyl::transform
1 parent 45e6481 commit 5fe04cc

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

lib/PDL/Graphics/TriD/Graph.pm

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,15 +315,17 @@ sub transform {
315315
my ($this,$point,$data,$inds) = @_;
316316
PDL::barf "no \$inds given" if !defined $inds;
317317
barf "Wrong number of arguments to transform $this\n" if @$inds != 3;
318+
my ($longrange, $latrange) = map $this->{Scale}[$_][1] - $this->{Scale}[$_][0], 0,1;
319+
my $pressure_max = $this->{Scale}[2][1];
318320
$point->slice("(0)") +=
319321
0.5+($data->slice("($inds->[0])")-$this->{Center}[0]) /
320-
($this->{Scale}[0][1] - $this->{Scale}[0][0])
322+
$longrange
321323
*cos($data->slice("($inds->[1])")*DEG2RAD);
322324
$point->slice("(1)") +=
323325
0.5+($data->slice("($inds->[1])")-$this->{Center}[1]) /
324-
($this->{Scale}[1][1] - $this->{Scale}[1][0]);
326+
$latrange;
325327
$point->slice("(2)") .=
326-
log($data->slice("($inds->[2])")/1012.5)/log($this->{Scale}[2][1]/1012.5);
328+
log($data->slice("($inds->[2])")/1012.5)/log($pressure_max/1012.5);
327329
$point;
328330
}
329331

0 commit comments

Comments
 (0)