mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-13 05:09:03 +08:00
Make angle increment (i.e. angle resolution) configurable
This commit is contained in:
parent
20ca6cea05
commit
627f23d5fe
@ -8,6 +8,7 @@ use Slic3r::Geometry::Clipper qw(intersection_pl intersection_ex);
|
|||||||
has 'lower_slices' => (is => 'rw', required => 1); # ExPolygons or ExPolygonCollection
|
has 'lower_slices' => (is => 'rw', required => 1); # ExPolygons or ExPolygonCollection
|
||||||
has 'perimeter_flow' => (is => 'rw', required => 1);
|
has 'perimeter_flow' => (is => 'rw', required => 1);
|
||||||
has 'infill_flow' => (is => 'rw', required => 1);
|
has 'infill_flow' => (is => 'rw', required => 1);
|
||||||
|
has 'resolution' => => (is => 'rw', default => sub { PI/36 });
|
||||||
|
|
||||||
sub detect_angle {
|
sub detect_angle {
|
||||||
my ($self, $expolygon) = @_;
|
my ($self, $expolygon) = @_;
|
||||||
@ -69,9 +70,8 @@ sub detect_angle {
|
|||||||
# bridge in several directions and then sum the length of lines having both
|
# bridge in several directions and then sum the length of lines having both
|
||||||
# endpoints within anchors
|
# endpoints within anchors
|
||||||
my %directions = (); # angle => score
|
my %directions = (); # angle => score
|
||||||
my $angle_increment = PI/36; # 5°
|
|
||||||
my $line_increment = $self->infill_flow->scaled_width;
|
my $line_increment = $self->infill_flow->scaled_width;
|
||||||
for (my $angle = 0; $angle < PI; $angle += $angle_increment) {
|
for (my $angle = 0; $angle < PI; $angle += $self->resolution) {
|
||||||
my $my_inset = [ map $_->clone, @$inset ];
|
my $my_inset = [ map $_->clone, @$inset ];
|
||||||
my $my_anchors = [ map $_->clone, @$anchors ];
|
my $my_anchors = [ map $_->clone, @$anchors ];
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ sub check_angle {
|
|||||||
|
|
||||||
# our epsilon is equal to the steps used by the bridge detection algorithm
|
# our epsilon is equal to the steps used by the bridge detection algorithm
|
||||||
###use XXX; YYY [ rad2deg($result), $expected ];
|
###use XXX; YYY [ rad2deg($result), $expected ];
|
||||||
return defined $result && abs(rad2deg($result) - $expected) < rad2deg(PI/36);
|
return defined $result && abs(rad2deg($result) - $expected) < rad2deg($bd->resolution);
|
||||||
}
|
}
|
||||||
|
|
||||||
__END__
|
__END__
|
||||||
|
Loading…
x
Reference in New Issue
Block a user