Renamed encloses_line() to contains_line() and implemented it using diff_pl()

This commit is contained in:
Alessandro Ranellucci 2013-11-21 14:35:28 +01:00
parent 3025c77675
commit bd62de7653
4 changed files with 10 additions and 18 deletions

View file

@ -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 {