mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-19 11:23:42 +00:00
Bugfixes and improvements in surface detection
This commit is contained in:
@@ -10,10 +10,10 @@ has 'points' => (
|
||||
|
||||
sub cast {
|
||||
my $class = shift;
|
||||
my ($line) = @_;
|
||||
my ($line, %args) = @_;
|
||||
if (ref $line eq 'ARRAY') {
|
||||
@$line == 2 or die "Line needs two points!";
|
||||
return Slic3r::Line->new(points => [ map Slic3r::Point->cast($_), @$line ]);
|
||||
return $class->new(points => [ map Slic3r::Point->cast($_), @$line ], %args);
|
||||
} else {
|
||||
return $line;
|
||||
}
|
||||
@@ -51,6 +51,17 @@ sub has_endpoint {
|
||||
return $point->coincides_with($self->a) || $point->coincides_with($self->b);
|
||||
}
|
||||
|
||||
sub has_segment {
|
||||
my $self = shift;
|
||||
my ($line) = @_;
|
||||
|
||||
$line = $line->p if $line->isa('Slic3r::Line');
|
||||
|
||||
# a segment belongs to another segment if its points belong to it
|
||||
return Slic3r::Geometry::point_in_segment($line->[0], $self->p)
|
||||
&& Slic3r::Geometry::point_in_segment($line->[1], $self->p);
|
||||
}
|
||||
|
||||
sub parallel_to {
|
||||
my $self = shift;
|
||||
my ($line) = @_;
|
||||
|
||||
Reference in New Issue
Block a user