Avoid expensive TriangleMesh BUILD method during clone.

Gives 6% speedup and uses less memory when slicing yoda.stl and should
give significantly bigger speedup on more complex models and plates.
This commit is contained in:
Mark Hindess 2013-05-13 21:24:49 +01:00
parent a86c48d85c
commit 7979dd9e9c

View File

@ -3,6 +3,7 @@ use Moo;
use Slic3r::Geometry qw(X Y Z A B unscale same_point);
use Slic3r::Geometry::Clipper qw(union_ex);
use Storable;
# public
has 'vertices' => (is => 'ro', required => 1); # id => [$x,$y,$z]
@ -92,11 +93,7 @@ sub merge {
}
sub clone {
my $self = shift;
return (ref $self)->new(
vertices => [ map [ @$_ ], @{$self->vertices} ],
facets => [ map [ @$_ ], @{$self->facets} ],
);
Storable::dclone($_[0])
}
sub _facet_edges {