Skip to content

Commit ccdb111

Browse files
committed
turn @nadd calc into conditional-ladder
1 parent 7479dd4 commit ccdb111

1 file changed

Lines changed: 1 addition & 13 deletions

File tree

lib/PDL/Graphics/TriD/Graph.pm

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -208,19 +208,7 @@ use fields qw(LatticeObj);
208208
sub add_lattice_axis {
209209
my ($this) = @_;
210210
my @widths = $this->{Scale}->slice('0:1')->t->diff2->list;
211-
my @nadd;
212-
for my $dim (0..1) {
213-
my $width = $widths[$dim];
214-
if ($width > 100) {
215-
$nadd[$dim] = 10;
216-
} elsif ($width>30) {
217-
$nadd[$dim] = 5;
218-
} elsif ($width>20) {
219-
$nadd[$dim] = 2;
220-
} else {
221-
$nadd[$dim] = 1;
222-
}
223-
}
211+
my @nadd = map $_ > 100 ? 10 : $_ > 30 ? 5 : $_ > 20 ? 2 : 1, @widths;
224212
my @nc = map int($this->{Scale}->slice("$_,0")->sclr/$nadd[$_])*$nadd[$_], 0,1;
225213
my @ns = map int($widths[$_]/$nadd[$_])+1, 0,1;
226214
# can be changed to topo heights?

0 commit comments

Comments
 (0)