Skip to content

Commit c00864a

Browse files
committed
make demos/test5.p only construct each object once
1 parent c9ee108 commit c00864a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

demos/test5.p

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ my @objs = (
2222
['Lattice', {Shading=>3, Lighting => 1, Smooth=>1}],
2323
);
2424
my $i = 0;
25-
@objs = map [$i++, @$_], @objs;
26-
my ($below_obj, $above_obj) = map [$_, 'Lines'], -1, 0+@objs;
25+
@objs = map mk_trid($i++, @$_), @objs;
26+
my ($below_obj, $above_obj) = map mk_trid($_, 'Lines'), -1, 0+@objs;
2727

2828
sub mk_trid { "PDL::Graphics::TriD::$_[1]"->new($y+pdl(0,0,$_[0]),$c,$_[2]) }
2929

3030
my $win = PDL::Graphics::TriD::get_current_window();
3131
my $g = PDL::Graphics::TriD::Graph->new;
32-
my @all = [map mk_trid(@$_), $below_obj, @objs, $above_obj];
33-
push @all, map [map mk_trid(@$_), $below_obj, $_, $above_obj], @objs;
32+
my @all = [$below_obj, @objs, $above_obj];
33+
push @all, map [$below_obj, $_, $above_obj], @objs;
3434
for my $these (@all) {
3535
$g->clear_data;
3636
$win->clear_viewport;

0 commit comments

Comments
 (0)