1
0
mirror of https://github.com/FULU-Foundation/OrcaSlicer-bambulab.git synced 2026-07-11 08:04:25 +00:00

Memory and speed optimization: only study meshes when needed

This commit is contained in:
Alessandro Ranellucci
2013-05-14 14:47:00 +02:00
parent e51dbb994d
commit 7eff002e21
+8 -2
View File
@@ -29,8 +29,8 @@ use constant I_FACET_EDGE => 6;
use constant FE_TOP => 0;
use constant FE_BOTTOM => 1;
# always make sure BUILD is idempotent
sub BUILD {
# always make sure this method is idempotent
sub analyze {
my $self = shift;
@{$self->edges} = ();
@@ -145,6 +145,8 @@ sub clean {
sub check_manifoldness {
my $self = shift;
$self->analyze;
# look for any edges not connected to exactly two facets
my ($first_bad_edge_id) =
grep { @{ $self->edges_facets->[$_] } != 2 } 0..$#{$self->edges_facets};
@@ -154,6 +156,10 @@ sub check_manifoldness {
map @{$self->vertices->[$_]}, @{$self->edges->[$first_bad_edge_id]};
return 0;
}
# empty the edges array as we don't really need it anymore
@{$self->edges} = ();
return 1;
}