Corrections to math. Threads are not always rectangles with semicircles. Better calculation of overlap.

This commit is contained in:
Alessandro Ranellucci 2011-12-17 19:52:34 +01:00
parent cd0fd80a69
commit 1e6ecd9eab
13 changed files with 62 additions and 41 deletions

View file

@ -12,8 +12,8 @@ sub fill_surface {
# no rotation is supported for this infill pattern
my $scaled_flow_width = scale $params{flow_width};
my $distance = $scaled_flow_width / $params{density};
my $scaled_flow_spacing = scale $params{flow_spacing};
my $distance = $scaled_flow_spacing / $params{density};
# TODO: adjust distance and flow width for solid surfaces
# using the same logic as Rectilinear infill
# (factor it out to parent class)
@ -47,7 +47,7 @@ sub fill_surface {
my $path = $loop->split_at($cur_pos);
# clip the path to avoid the extruder to get exactly on the first point of the loop
$path->clip_end(scale $Slic3r::flow_width);
$path->clip_end(scale $Slic3r::nozzle_diameter);
push @paths, $path->p;
}

View file

@ -27,7 +27,7 @@ sub fill_surface {
my $rotate_vector = $self->infill_direction($surface);
$self->rotate_points($expolygon, $rotate_vector);
my $distance_between_lines = scale $params{flow_width} / $params{density} * $self->multiplier;
my $distance_between_lines = scale $params{flow_spacing} / $params{density} * $self->multiplier;
my $bounding_box = [ bounding_box(map @$_, $expolygon) ];
my $bounding_box_polygon = Slic3r::Polygon->new([
[ $bounding_box->[X1], $bounding_box->[Y1] ],

View file

@ -19,18 +19,18 @@ sub fill_surface {
$bounding_box->[X1] += scale 0.1;
$bounding_box->[X2] -= scale 0.1;
my $min_spacing = scale $params{flow_width};
my $min_spacing = scale $params{flow_spacing};
my $distance_between_lines = $min_spacing / $params{density};
my $line_oscillation = $distance_between_lines - $min_spacing;
my $number_of_lines = int(($bounding_box->[X2] - $bounding_box->[X1]) / $distance_between_lines) + 1;
my $flow_width = undef;
my $flow_spacing = undef;
if ($params{density} == 1) {
my $extra_space = ($bounding_box->[X2] - $bounding_box->[X1]) % $distance_between_lines;
$distance_between_lines += $extra_space / ($number_of_lines - 1) if $number_of_lines > 1;
$flow_width = unscale $distance_between_lines;
$flow_spacing = unscale $distance_between_lines;
}
my $overlap_distance = $min_spacing * $Slic3r::overlap_factor;
my $overlap_distance = $Slic3r::nozzle_diameter * 0.20;
my @paths = ();
my $x = $bounding_box->[X1];
@ -79,7 +79,7 @@ sub fill_surface {
# paths must be rotated back
$self->rotate_points_back(\@paths, $rotate_vector);
return { flow_width => $flow_width }, @paths;
return { flow_spacing => $flow_spacing }, @paths;
}
1;

View file

@ -16,7 +16,7 @@ sub fill_surface {
my $rotate_vector = $self->infill_direction($surface);
$self->rotate_points($polygons, $rotate_vector);
my $distance_between_lines = scale $params{flow_width} / $params{density};
my $distance_between_lines = scale $params{flow_spacing} / $params{density};
my $number_of_lines = int(0.99999999 + $self->max_print_dimension / $distance_between_lines); # ceil
#printf "distance = %f\n", $distance_between_lines;