Fix bridge detector

Test line direction is changed to reflect 0=east angle system
Test patern rotation direction is reversed - $angle represents infill direction
Angle test is changed to avoid returning negative value (this does happen otherwise - adding increments to $angle
creates ~ 1e-15 rounding error)
visilibity
Petr Ledvina 2014-04-23 11:04:56 +02:00
parent 1fc76b73a4
commit 802ebfb0d6
1 changed files with 5 additions and 5 deletions

View File

@ -89,16 +89,16 @@ sub detect_angle {
my $my_anchors = [ map $_->clone, @$anchors ]; my $my_anchors = [ map $_->clone, @$anchors ];
# rotate everything - the center point doesn't matter # rotate everything - the center point doesn't matter
$_->rotate($angle, [0,0]) for @$my_clip_area, @$my_anchors; $_->rotate(-$angle, [0,0]) for @$my_clip_area, @$my_anchors;
# generate lines in this direction # generate lines in this direction
my $bounding_box = Slic3r::Geometry::BoundingBox->new_from_points([ map @$_, map @$_, @$my_anchors ]); my $bounding_box = Slic3r::Geometry::BoundingBox->new_from_points([ map @$_, map @$_, @$my_anchors ]);
my @lines = (); my @lines = ();
for (my $x = $bounding_box->x_min; $x <= $bounding_box->x_max; $x += $line_increment) { for (my $y = $bounding_box->y_min; $y <= $bounding_box->y_max; $y+= $line_increment) {
push @lines, Slic3r::Polyline->new( push @lines, Slic3r::Polyline->new(
[$x, $bounding_box->y_min + scaled_epsilon], [$bounding_box->x_min, $y],
[$x, $bounding_box->y_max - scaled_epsilon], [$bounding_box->x_max, $y],
); );
} }
@ -143,7 +143,7 @@ sub detect_angle {
} }
if (defined $self->angle) { if (defined $self->angle) {
if ($self->angle >= PI - epsilon) { if ($self->angle >= PI) {
$self->angle($self->angle - PI); $self->angle($self->angle - PI);
} }