Skip to content

Commit 7479dd4

Browse files
committed
separate out @nc,@ns calc
1 parent 14682a1 commit 7479dd4

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/PDL/Graphics/TriD/Graph.pm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ use base qw(PDL::Graphics::TriD::Object);
207207
use fields qw(LatticeObj);
208208
sub add_lattice_axis {
209209
my ($this) = @_;
210-
my (@nadd,@nc,@ns);
211210
my @widths = $this->{Scale}->slice('0:1')->t->diff2->list;
211+
my @nadd;
212212
for my $dim (0..1) {
213213
my $width = $widths[$dim];
214214
if ($width > 100) {
@@ -220,9 +220,9 @@ sub add_lattice_axis {
220220
} else {
221221
$nadd[$dim] = 1;
222222
}
223-
$nc[$dim] = int($this->{Scale}->slice("$dim,0")->sclr/$nadd[$dim])*$nadd[$dim];
224-
$ns[$dim] = int($width/$nadd[$dim])+1;
225223
}
224+
my @nc = map int($this->{Scale}->slice("$_,0")->sclr/$nadd[$_])*$nadd[$_], 0,1;
225+
my @ns = map int($widths[$_]/$nadd[$_])+1, 0,1;
226226
# can be changed to topo heights?
227227
my $verts = PDL->zeroes(PDL::float(),3,$ns[0],$ns[1]);
228228
$verts->slice("2") .= 1012.5;

0 commit comments

Comments
 (0)