Ported some more methods to C++
This commit is contained in:
parent
678112b926
commit
5a96bad8c2
9 changed files with 61 additions and 50 deletions
|
@ -71,7 +71,6 @@ use Slic3r::Print::Object;
|
|||
use Slic3r::Print::Simple;
|
||||
use Slic3r::Print::SupportMaterial;
|
||||
use Slic3r::Surface;
|
||||
use Slic3r::TriangleMesh;
|
||||
our $build = eval "use Slic3r::Build; 1";
|
||||
use Thread::Semaphore;
|
||||
|
||||
|
|
|
@ -158,21 +158,6 @@ sub _arrange {
|
|||
);
|
||||
}
|
||||
|
||||
# makes sure all objects have at least one instance
|
||||
sub add_default_instances {
|
||||
my ($self) = @_;
|
||||
|
||||
# apply a default position to all objects not having one
|
||||
my $added = 0;
|
||||
foreach my $object (@{$self->objects}) {
|
||||
if ($object->instances_count == 0) {
|
||||
$object->add_instance(offset => Slic3r::Pointf->new(0,0));
|
||||
$added = 1;
|
||||
}
|
||||
}
|
||||
return $added;
|
||||
}
|
||||
|
||||
# this returns the bounding box of the *transformed* instances
|
||||
sub bounding_box {
|
||||
my $self = shift;
|
||||
|
@ -535,16 +520,6 @@ sub unique_materials {
|
|||
return sort keys %materials;
|
||||
}
|
||||
|
||||
sub facets_count {
|
||||
my $self = shift;
|
||||
return sum(map $_->mesh->facets_count, grep !$_->modifier, @{$self->volumes});
|
||||
}
|
||||
|
||||
sub needed_repair {
|
||||
my $self = shift;
|
||||
return (first { !$_->mesh->needed_repair } grep !$_->modifier, @{$self->volumes}) ? 0 : 1;
|
||||
}
|
||||
|
||||
sub mesh_stats {
|
||||
my $self = shift;
|
||||
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
package Slic3r::TriangleMesh;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use List::Util qw(first);
|
||||
use Slic3r::Geometry qw(X Y);
|
||||
use Slic3r::Geometry::Clipper qw(union_ex offset);
|
||||
|
||||
sub needed_repair {
|
||||
my $self = shift;
|
||||
|
||||
my $stats = $self->stats;
|
||||
return (first { $stats->{$_} > 0 }
|
||||
qw(degenerate_facets edges_fixed facets_removed facets_added facets_reversed backwards_edges)) ? 1 : 0;
|
||||
}
|
||||
|
||||
sub center {
|
||||
my $self = shift;
|
||||
return $self->bounding_box->center;
|
||||
}
|
||||
|
||||
1;
|
Loading…
Add table
Add a link
Reference in a new issue