Skip to content

Commit ec9d5e4

Browse files
committed
create all ::GL ndarrays with float, not default type
1 parent f23d251 commit ec9d5e4

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

lib/PDL/Graphics/TriD/Contours.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ sub new{
114114
#
115115
my $cvals;
116116
if (!defined($this->{Options}{ContourVals}) || $this->{Options}{ContourVals}->isempty){
117-
$cvals=zeroes(int(($this->{Options}{ContourMax}-$this->{Options}{ContourMin})/$this->{Options}{ContourInt}+1));
117+
$cvals=zeroes(float(), int(($this->{Options}{ContourMax}-$this->{Options}{ContourMin})/$this->{Options}{ContourInt}+1));
118118
$cvals = $cvals->xlinvals($this->{Options}{ContourMin},$this->{Options}{ContourMax});
119119
}else{
120120
$cvals = $this->{Options}{ContourVals};

lib/PDL/Graphics/TriD/GL.pm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ sub PDL::Graphics::TriD::CylindricalEquidistantAxes::togl {
7676
$ns[$dim] = int($width/$nadd[$dim])+1;
7777
}
7878
# can be changed to topo heights?
79-
my $verts = zeroes(3,$ns[0],$ns[1]);
79+
my $verts = zeroes(PDL::float(),3,$ns[0],$ns[1]);
8080
$verts->slice("2") .= 1012.5;
8181
$verts->slice("0") .= $verts->slice("0")->ylinvals($nc[0],$nc[0]+$nadd[0]*($ns[0]-1));
8282
$verts->slice("1") .= $verts->slice("0")->zlinvals($nc[1],$nc[1]+$nadd[1]*($ns[1]-1));
83-
my $tverts = zeroes(3,$ns[0],$ns[1]);
83+
my $tverts = zeroes(PDL::float(),3,$ns[0],$ns[1]);
8484
$tverts = $this->transform($tverts,$verts,[0,1,2]);
8585
glDisable(GL_LIGHTING);
8686
glColor3d(1,1,1);
@@ -106,7 +106,7 @@ sub PDL::Graphics::TriD::CylindricalEquidistantAxes::togl {
106106
sub PDL::Graphics::TriD::EuclidAxes::gdraw {
107107
my ($this, $points) = @_;
108108
print "gdraw: got object type " . ref($this) . "\n" if $PDL::Graphics::TriD::verbose;
109-
my $axisvals = zeroes(3,$this->{NDiv}+1)->ylinvals($this->{Scale}->dog)->t->flat->t;
109+
my $axisvals = zeroes(PDL::float(),3,$this->{NDiv}+1)->ylinvals($this->{Scale}->dog)->t->flat->t;
110110
my @label = map sprintf("%.3f", $_), @{ $axisvals->flat->unpdl };
111111
push @label, @{$this->{Names}};
112112
glColor3d(1,1,1);

lib/PDL/Graphics/TriD/Graph.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ sub new {
133133
my $class = $_[0];
134134
my $options = ref($_[-1]) eq 'HASH' ? pop : $class->get_valid_options;
135135
my $ndiv = $options->{NDiv};
136-
my $points = zeroes(3,3)->append(my $id3 = identity(3));
137-
my $starts = zeroes(1,$ndiv+1)->ylinvals(0,1)->append(zeroes(2,$ndiv+1));
136+
my $points = zeroes(PDL::float(),3,3)->append(my $id3 = identity(3));
137+
my $starts = zeroes(PDL::float(),1,$ndiv+1)->ylinvals(0,1)->append(zeroes(PDL::float(),2,$ndiv+1));
138138
my $ends = $starts + append(0, ones 2) * -0.1;
139139
my $dupseq = yvals($ndiv+1,3)->flat;
140140
$_ = $_->dup(1,3)->rotate($dupseq) for $starts, $ends;

lib/PDL/Graphics/TriD/Objects.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ sub smoothn {
217217
my $ortho = $trip->crossp($trid);
218218
$ortho->norm($ortho); # normalise inplace
219219
# now add to vertices to smooth
220-
my $aver = ref($p)->zeroes($p->dims);
220+
my $aver = ref($p)->zeroes(PDL::float(), $p->dims);
221221
# step 1, upper right tri0, upper left tri1
222222
$aver->lags(1,1,2)->slice(':,:,:,1:-1') += $ortho;
223223
# step 2, lower right tri0, lower left tri1

0 commit comments

Comments
 (0)