mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-06 21:44:08 -06:00
Extended (and fixed) unit testing to track down (and fix) an issue caused by floating point math that reversed some holes into contours when they should actually be ignored
This commit is contained in:
parent
fbea5dae8f
commit
98a8c64ed7
3 changed files with 113 additions and 25 deletions
|
@ -105,8 +105,28 @@ sub make_surfaces {
|
|||
my ($loops) = @_;
|
||||
|
||||
{
|
||||
# merge everything
|
||||
my $expolygons = union_ex($loops);
|
||||
|
||||
# sometimes the magic of floating point values produces holes outside of any contour;
|
||||
# we need to ignore such holes, but Clipper will convert them to contours.
|
||||
# so we identify them and remove them manually.
|
||||
|
||||
# get expolygons without holes (candidate for reverse holes detection)
|
||||
my @expolygons_without_holes = grep { @$_ == 1 } @$expolygons;
|
||||
|
||||
# remove all holes from such expolygons
|
||||
my $diff = diff_ex(
|
||||
[ map @$_, @expolygons_without_holes ],
|
||||
[ map [ reverse @$_ ], grep !is_counter_clockwise($_), @$loops ],
|
||||
);
|
||||
|
||||
# merge resulting holes (true holes) and other expolygons
|
||||
$expolygons = [
|
||||
(grep { @$_ > 1 } @$expolygons),
|
||||
@$diff,
|
||||
];
|
||||
|
||||
Slic3r::debugf " %d surface(s) having %d holes detected from %d polylines\n",
|
||||
scalar(@$expolygons), scalar(map $_->holes, @$expolygons), scalar(@$loops);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue