mirror of
https://github.com/FULU-Foundation/OrcaSlicer-bambulab.git
synced 2026-05-14 13:02:39 -07:00
Better implementation of the external motion planner
This commit is contained in:
@@ -6,7 +6,7 @@ use warnings;
|
||||
|
||||
use Boost::Geometry::Utils;
|
||||
use Math::Geometry::Voronoi;
|
||||
use Slic3r::Geometry qw(X Y A B point_in_polygon same_line scale epsilon);
|
||||
use Slic3r::Geometry qw(X Y A B point_in_polygon same_line line_length scale epsilon);
|
||||
use Slic3r::Geometry::Clipper qw(union_ex JT_MITER);
|
||||
|
||||
# the constructor accepts an array of polygons
|
||||
@@ -110,10 +110,14 @@ sub encloses_point_quick {
|
||||
|
||||
sub encloses_line {
|
||||
my $self = shift;
|
||||
my ($line) = @_;
|
||||
|
||||
my ($line, $tolerance) = @_;
|
||||
my $clip = $self->clip_line($line);
|
||||
return @$clip == 1 && abs($line->length - Slic3r::Geometry::line_length($clip->[0])) < scale epsilon;
|
||||
if (!defined $tolerance) {
|
||||
# optimization
|
||||
return @$clip == 1 && same_line($clip->[0], $line);
|
||||
} else {
|
||||
return @$clip == 1 && abs(line_length($clip->[0]) - $line->length) < $tolerance;
|
||||
}
|
||||
}
|
||||
|
||||
sub point_on_segment {
|
||||
|
||||
Reference in New Issue
Block a user