Merge branch 'master' into overhang

This commit is contained in:
Alessandro Ranellucci 2013-05-16 18:36:11 +02:00
commit 61c1045331
7 changed files with 11 additions and 4 deletions

View File

@ -68,6 +68,7 @@ use constant SCALING_FACTOR => 0.000001;
use constant RESOLUTION => 0.0125; use constant RESOLUTION => 0.0125;
use constant SCALED_RESOLUTION => RESOLUTION / SCALING_FACTOR; use constant SCALED_RESOLUTION => RESOLUTION / SCALING_FACTOR;
use constant OVERLAP_FACTOR => 1; use constant OVERLAP_FACTOR => 1;
use constant BRIDGE_OVERLAP_FACTOR => 0.2;
use constant SMALL_PERIMETER_LENGTH => (6.5 / SCALING_FACTOR) * 2 * PI; use constant SMALL_PERIMETER_LENGTH => (6.5 / SCALING_FACTOR) * 2 * PI;
use constant LOOP_CLIPPING_LENGTH_OVER_SPACING => 0.15; use constant LOOP_CLIPPING_LENGTH_OVER_SPACING => 0.15;
use constant INFILL_OVERLAP_OVER_SPACING => 0.45; use constant INFILL_OVERLAP_OVER_SPACING => 0.45;

View File

@ -20,7 +20,7 @@ has 'polyline' => (
# height is the vertical thickness of the extrusion expressed in mm # height is the vertical thickness of the extrusion expressed in mm
has 'height' => (is => 'rw'); has 'height' => (is => 'rw');
has 'flow_spacing' => (is => 'rw'); has 'flow_spacing' => (is => 'rw', required => 1);
has 'role' => (is => 'rw', required => 1); has 'role' => (is => 'rw', required => 1);
use constant EXTR_ROLE_PERIMETER => 0; use constant EXTR_ROLE_PERIMETER => 0;
@ -244,6 +244,7 @@ sub detect_arcs {
my $arc = Slic3r::ExtrusionPath::Arc->new( my $arc = Slic3r::ExtrusionPath::Arc->new(
polyline => Slic3r::Polyline->new(\@arc_points), polyline => Slic3r::Polyline->new(\@arc_points),
role => $self->role, role => $self->role,
flow_spacing => $self->flow_spacing,
orientation => $orientation, orientation => $orientation,
center => $arc_center, center => $arc_center,
radius => $arc_center->distance_to($points[$i]), radius => $arc_center->distance_to($points[$i]),
@ -253,6 +254,7 @@ sub detect_arcs {
push @paths, (ref $self)->new( push @paths, (ref $self)->new(
polyline => Slic3r::Polyline->new(@points[0..$i]), polyline => Slic3r::Polyline->new(@points[0..$i]),
role => $self->role, role => $self->role,
flow_spacing => $self->flow_spacing,
height => $self->height, height => $self->height,
) if $i > 0; ) if $i > 0;
@ -272,6 +274,7 @@ sub detect_arcs {
push @paths, (ref $self)->new( push @paths, (ref $self)->new(
polyline => Slic3r::Polyline->new(\@points), polyline => Slic3r::Polyline->new(\@points),
role => $self->role, role => $self->role,
flow_spacing => $self->flow_spacing,
height => $self->height, height => $self->height,
) if @points > 1; ) if @points > 1;

View File

@ -99,7 +99,7 @@ sub _build_width {
sub _build_spacing { sub _build_spacing {
my $self = shift; my $self = shift;
my $width = $self->width; my $width = $self->width;
return $width + &Slic3r::OVERLAP_FACTOR * ($width * PI / 4 - $width); return $width - (&Slic3r::BRIDGE_OVERLAP_FACTOR * $width);
} }
1; 1;

View File

@ -699,7 +699,7 @@ sub make_brim {
# JT_SQUARE ensures no vertex is outside the given offset distance # JT_SQUARE ensures no vertex is outside the given offset distance
# -0.5 because islands are not represented by their centerlines # -0.5 because islands are not represented by their centerlines
# TODO: we need the offset inwards/offset outwards logic to avoid overlapping extrusions # TODO: we need the offset inwards/offset outwards logic to avoid overlapping extrusions
push @loops, offset2(\@islands, ($i - 2) * $flow->scaled_spacing, ($i + 1.5) * $flow->scaled_spacing, undef, JT_SQUARE); push @loops, offset2(\@islands, ($i - 1.5) * $flow->scaled_spacing, +1.0 * $flow->scaled_spacing, undef, JT_SQUARE);
} }
@{$self->brim} = map Slic3r::ExtrusionLoop->pack( @{$self->brim} = map Slic3r::ExtrusionLoop->pack(

View File

@ -543,6 +543,8 @@ sub get_connected_facets {
sub split_mesh { sub split_mesh {
my $self = shift; my $self = shift;
$self->analyze;
my @meshes = (); my @meshes = ();
# loop while we have remaining facets # loop while we have remaining facets

View File

@ -40,6 +40,7 @@ use Slic3r::Test;
[ [5,5,0], [5,15,10], [5,5,10] ]; [ [5,5,0], [5,15,10], [5,5,10] ];
my $mesh = Slic3r::TriangleMesh->new(vertices => \@vertices, facets => \@facets); my $mesh = Slic3r::TriangleMesh->new(vertices => \@vertices, facets => \@facets);
$mesh->analyze;
my @lines = map $mesh->intersect_facet($_, 10), 0..$#facets; my @lines = map $mesh->intersect_facet($_, 10), 0..$#facets;
my $loops = Slic3r::TriangleMesh::make_loops(\@lines); my $loops = Slic3r::TriangleMesh::make_loops(\@lines);
is scalar(@$loops), 3, 'correct number of loops detected'; is scalar(@$loops), 3, 'correct number of loops detected';

View File

@ -111,7 +111,7 @@ sub vertices {
sub add_facet { sub add_facet {
push @{$mesh->facets}, [ [0,0,0], @{vertices(@_)} ]; push @{$mesh->facets}, [ [0,0,0], @{vertices(@_)} ];
$mesh->BUILD; $mesh->analyze;
} }
sub intersect { sub intersect {