Fix positioning and other things

This commit is contained in:
Alessandro Ranellucci 2012-09-22 21:03:57 +02:00
parent d488afd243
commit e2ab340edb
3 changed files with 24 additions and 14 deletions

View file

@ -409,7 +409,7 @@ sub process_bridges {
my @chords = map Slic3r::Line->new($_->[0], $_->[-1]), @edges;
my @midpoints = map $_->midpoint, @chords;
my $line_between_midpoints = Slic3r::Line->new(@midpoints);
$bridge_angle = rad2deg_dir($line_between_midpoints->direction);
$bridge_angle = Slic3r::Geometry::rad2deg_dir($line_between_midpoints->direction);
} elsif (@edges == 1) {
# TODO: this case includes both U-shaped bridges and plain overhangs;
# we need a trapezoidation algorithm to detect the actual bridged area
@ -418,10 +418,10 @@ sub process_bridges {
# our supporting edge is a straight line
if (@{$edges[0]} > 2) {
my $line = Slic3r::Line->new($edges[0]->[0], $edges[0]->[-1]);
$bridge_angle = rad2deg_dir($line->direction);
$bridge_angle = Slic3r::Geometry::rad2deg_dir($line->direction);
}
} elsif (@edges) {
my $center = bounding_box_center([ map @$_, @edges ]);
my $center = Slic3r::Geometry::bounding_box_center([ map @$_, @edges ]);
my $x = my $y = 0;
foreach my $point (map @$, @edges) {
my $line = Slic3r::Line->new($center, $point);
@ -430,7 +430,7 @@ sub process_bridges {
$x += cos($dir) * $len;
$y += sin($dir) * $len;
}
$bridge_angle = rad2deg_dir(atan2($y, $x));
$bridge_angle = Slic3r::Geometry::rad2deg_dir(atan2($y, $x));
}
Slic3r::debugf " Optimal infill angle of bridge on layer %d is %d degrees\n",