Skip to content

Commit 0017dd8

Browse files
committed
use PDL::Constants DEGRAD
1 parent c2c7fea commit 0017dd8

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

lib/PDL/Graphics/TriD/Graph.pm

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ package PDL::Graphics::TriD::CylindricalEquidistantAxes;
203203
use base qw/PDL::Graphics::TriD::Object/;
204204
use fields qw/Name Scale/;
205205
use PDL::Core '';
206+
use PDL::Constants qw(DEGRAD);
207+
use constant DEG2RAD => 1/DEGRAD;
206208

207209
sub new {
208210
my ($type) = @_;
@@ -305,11 +307,10 @@ sub transform {
305307
PDL::barf "no \$inds given" if !defined $inds;
306308
barf "Wrong number of arguments to transform $this\n" if @$inds != 3;
307309
my $i = 0;
308-
my $pio180 = 0.017453292;
309310
$point->slice("(0)") +=
310311
0.5+($data->slice("($inds->[0])")-$this->{Center}[0]) /
311312
($this->{Scale}[0][1] - $this->{Scale}[0][0])
312-
*cos($data->slice("($inds->[1])")*$pio180);
313+
*cos($data->slice("($inds->[1])")*DEG2RAD);
313314
$point->slice("(1)") +=
314315
0.5+($data->slice("($inds->[1])")-$this->{Center}[1]) /
315316
($this->{Scale}[1][1] - $this->{Scale}[1][0]);
@@ -320,6 +321,8 @@ sub transform {
320321

321322
package PDL::Graphics::TriD::PolarStereoAxes;
322323
use PDL::Core '';
324+
use PDL::Constants qw(DEGRAD);
325+
use constant DEG2RAD => 1/DEGRAD;
323326

324327
sub new {
325328
my ($type) = @_;
@@ -398,15 +401,14 @@ sub transform {
398401
PDL::barf "no \$inds given" if !defined $inds;
399402
my $i = 0;
400403
barf "Wrong number of arguments to transform $this\n" if @$inds != 3;
401-
my $pio180 = 0.017453292;
402404
$point->slice("(0)") +=
403405
0.5+($data->slice("($inds->[0])")-$this->{Center}[0]) /
404406
($this->{Scale}[0][1] - $this->{Scale}[0][0])
405-
*cos($data->slice("($inds->[1])")*$pio180);
407+
*cos($data->slice("($inds->[1])")*DEG2RAD);
406408
$point->slice("(1)") +=
407409
0.5+($data->slice("($inds->[1])")-$this->{Center}[1]) /
408410
($this->{Scale}[1][1] - $this->{Scale}[1][0])
409-
*cos($data->slice("($inds->[1])")*$pio180);
411+
*cos($data->slice("($inds->[1])")*DEG2RAD);
410412
# Longitude transformation
411413
# $point->slice("(0)") =
412414
# ($this->{Center}[0]-$point->slice("(0)"))*cos($data->slice("(1)"));

0 commit comments

Comments
 (0)