mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-11-02 20:51:23 -07:00
Renamed encloses_line() to contains_line() and implemented it using diff_pl()
This commit is contained in:
parent
3025c77675
commit
bd62de7653
4 changed files with 10 additions and 18 deletions
|
|
@ -54,16 +54,11 @@ sub encloses_point_quick {
|
|||
return Boost::Geometry::Utils::point_within_polygon($point->pp, $self->pp);
|
||||
}
|
||||
|
||||
sub encloses_line {
|
||||
sub contains_line {
|
||||
my $self = shift;
|
||||
my ($line, $tolerance) = @_;
|
||||
my $clip = $self->clip_line($line);
|
||||
if (!defined $tolerance) {
|
||||
# optimization
|
||||
return @$clip == 1 && $clip->[0]->coincides_with($line);
|
||||
} else {
|
||||
return @$clip == 1 && abs($clip->[0]->length - $line->length) < $tolerance;
|
||||
}
|
||||
my ($line) = @_;
|
||||
|
||||
return @{Slic3r::Geometry::Clipper::diff_pl([$line->as_polyline], \@$self)} ? 0 : 1;
|
||||
}
|
||||
|
||||
sub bounding_box {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue