Have Clipper.pm only return ExPolygon::XS objects

This commit is contained in:
Alessandro Ranellucci 2013-07-07 15:17:09 +02:00
parent 9dc1a3c69d
commit a1e4bda670
8 changed files with 22 additions and 16 deletions

View file

@ -90,7 +90,7 @@ sub fill_surface {
# path is more straight
@paths = map Slic3r::Polyline->new(@$_),
@{ Boost::Geometry::Utils::polygon_multi_linestring_intersection(
$surface->expolygon,
$surface->expolygon->arrayref,
\@polygons,
) };
@ -115,7 +115,7 @@ sub fill_surface {
# clip paths again to prevent connection segments from crossing the expolygon boundaries
@paths = map Slic3r::Polyline->new(@$_),
@{ Boost::Geometry::Utils::multi_polygon_multi_linestring_intersection(
[ $surface->expolygon->offset_ex(scaled_epsilon) ],
[ map $_->arrayref, $surface->expolygon->offset_ex(scaled_epsilon) ],
[ @paths ],
) } if @paths; # this temporary check is a workaround for the multilinestring bug in B::G::U
}

View file

@ -17,7 +17,7 @@ sub fill_surface {
$self->rotate_points($expolygon, $rotate_vector);
my ($expolygon_off) = $expolygon->offset_ex(scale $params{flow_spacing}/2);
return {} if !$expolygon_off; # skip some very small polygons (which shouldn't arrive here)
return {} if !defined $expolygon_off; # skip some very small polygons (which shouldn't arrive here)
my $flow_spacing = $params{flow_spacing};
my $min_spacing = scale $params{flow_spacing};
@ -66,7 +66,7 @@ sub fill_surface {
# clip paths against a slightly offsetted expolygon, so that the first and last paths
# are kept even if the expolygon has vertical sides
my @paths = @{ Boost::Geometry::Utils::polygon_multi_linestring_intersection(
+($expolygon->offset_ex(scaled_epsilon))[0], # TODO: we should use all the resulting expolygons and clip the linestrings to a multipolygon object
+($expolygon->offset_ex(scaled_epsilon))[0]->arrayref, # TODO: we should use all the resulting expolygons and clip the linestrings to a multipolygon object
[ @{ $self->cache->{$cache_id} } ],
) };