Replace Math::ConvexHull with Math::ConvexHull::MonotoneChain. #722
This commit is contained in:
parent
68c3a0dd61
commit
c793a2657f
2
Build.PL
2
Build.PL
@ -12,7 +12,7 @@ my $build = Module::Build->new(
|
|||||||
'File::Spec' => '0',
|
'File::Spec' => '0',
|
||||||
'Getopt::Long' => '0',
|
'Getopt::Long' => '0',
|
||||||
'Math::Clipper' => '1.09',
|
'Math::Clipper' => '1.09',
|
||||||
'Math::ConvexHull' => '1.0.4',
|
'Math::ConvexHull::MonotoneChain' => '0.01',
|
||||||
'Math::Geometry::Voronoi' => '1.3',
|
'Math::Geometry::Voronoi' => '1.3',
|
||||||
'Math::PlanePath' => '53',
|
'Math::PlanePath' => '53',
|
||||||
'Moo' => '0.091009',
|
'Moo' => '0.091009',
|
||||||
|
@ -5,7 +5,7 @@ use utf8;
|
|||||||
|
|
||||||
use File::Basename qw(basename dirname);
|
use File::Basename qw(basename dirname);
|
||||||
use List::Util qw(max sum);
|
use List::Util qw(max sum);
|
||||||
use Math::ConvexHull qw(convex_hull);
|
use Math::ConvexHull::MonotoneChain qw(convex_hull);
|
||||||
use Slic3r::Geometry qw(X Y Z X1 Y1 X2 Y2 MIN MAX);
|
use Slic3r::Geometry qw(X Y Z X1 Y1 X2 Y2 MIN MAX);
|
||||||
use Slic3r::Geometry::Clipper qw(JT_ROUND);
|
use Slic3r::Geometry::Clipper qw(JT_ROUND);
|
||||||
use threads::shared qw(shared_clone);
|
use threads::shared qw(shared_clone);
|
||||||
@ -1012,8 +1012,8 @@ sub OnDropFiles {
|
|||||||
package Slic3r::GUI::Plater::Object;
|
package Slic3r::GUI::Plater::Object;
|
||||||
use Moo;
|
use Moo;
|
||||||
|
|
||||||
use Math::ConvexHull qw(convex_hull);
|
use Math::ConvexHull::MonotoneChain qw(convex_hull);
|
||||||
use Slic3r::Geometry qw(X Y remove_coinciding_points);
|
use Slic3r::Geometry qw(X Y);
|
||||||
|
|
||||||
has 'name' => (is => 'rw', required => 1);
|
has 'name' => (is => 'rw', required => 1);
|
||||||
has 'input_file' => (is => 'rw', required => 1);
|
has 'input_file' => (is => 'rw', required => 1);
|
||||||
@ -1056,7 +1056,6 @@ sub make_thumbnail {
|
|||||||
my %params = @_;
|
my %params = @_;
|
||||||
|
|
||||||
my @points = map [ @$_[X,Y] ], @{$self->model_object->mesh->vertices};
|
my @points = map [ @$_[X,Y] ], @{$self->model_object->mesh->vertices};
|
||||||
remove_coinciding_points(\@points);
|
|
||||||
my $convex_hull = Slic3r::Polygon->new(convex_hull(\@points));
|
my $convex_hull = Slic3r::Polygon->new(convex_hull(\@points));
|
||||||
for (@$convex_hull) {
|
for (@$convex_hull) {
|
||||||
@$_ = map $_ * $params{scaling_factor}, @$_;
|
@$_ = map $_ * $params{scaling_factor}, @$_;
|
||||||
|
@ -4,9 +4,9 @@ use Moo;
|
|||||||
use File::Basename qw(basename fileparse);
|
use File::Basename qw(basename fileparse);
|
||||||
use File::Spec;
|
use File::Spec;
|
||||||
use List::Util qw(max);
|
use List::Util qw(max);
|
||||||
use Math::ConvexHull 1.0.4 qw(convex_hull);
|
use Math::ConvexHull::MonotoneChain qw(convex_hull);
|
||||||
use Slic3r::ExtrusionPath ':roles';
|
use Slic3r::ExtrusionPath ':roles';
|
||||||
use Slic3r::Geometry qw(X Y Z X1 Y1 X2 Y2 MIN PI scale unscale move_points nearest_point remove_coinciding_points);
|
use Slic3r::Geometry qw(X Y Z X1 Y1 X2 Y2 MIN PI scale unscale move_points nearest_point);
|
||||||
use Slic3r::Geometry::Clipper qw(diff_ex union_ex intersection_ex offset JT_ROUND JT_SQUARE);
|
use Slic3r::Geometry::Clipper qw(diff_ex union_ex intersection_ex offset JT_ROUND JT_SQUARE);
|
||||||
use Time::HiRes qw(gettimeofday tv_interval);
|
use Time::HiRes qw(gettimeofday tv_interval);
|
||||||
|
|
||||||
@ -139,7 +139,6 @@ sub validate {
|
|||||||
my $clearance;
|
my $clearance;
|
||||||
{
|
{
|
||||||
my @points = map [ @$_[X,Y] ], map @{$_->vertices}, @{$self->objects->[$obj_idx]->meshes};
|
my @points = map [ @$_[X,Y] ], map @{$_->vertices}, @{$self->objects->[$obj_idx]->meshes};
|
||||||
remove_coinciding_points(\@points);
|
|
||||||
my $convex_hull = Slic3r::Polygon->new(convex_hull(\@points));
|
my $convex_hull = Slic3r::Polygon->new(convex_hull(\@points));
|
||||||
$clearance = +($convex_hull->offset(scale $Slic3r::Config->extruder_clearance_radius / 2, 1, JT_ROUND))[0];
|
$clearance = +($convex_hull->offset(scale $Slic3r::Config->extruder_clearance_radius / 2, 1, JT_ROUND))[0];
|
||||||
}
|
}
|
||||||
@ -565,7 +564,6 @@ sub make_skirt {
|
|||||||
return if @points < 3; # at least three points required for a convex hull
|
return if @points < 3; # at least three points required for a convex hull
|
||||||
|
|
||||||
# find out convex hull
|
# find out convex hull
|
||||||
remove_coinciding_points(\@points);
|
|
||||||
my $convex_hull = convex_hull(\@points);
|
my $convex_hull = convex_hull(\@points);
|
||||||
|
|
||||||
# draw outlines from outside to inside
|
# draw outlines from outside to inside
|
||||||
|
Loading…
Reference in New Issue
Block a user