mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-05 13:04:03 -06:00
More unit tests for bridge angle detection
This commit is contained in:
parent
9be57f750d
commit
38f6e3b643
3 changed files with 63 additions and 16 deletions
|
@ -61,18 +61,23 @@ sub clip_as_polyline {
|
|||
$self_pl->[0]->translate(1, 0);
|
||||
|
||||
my @polylines = @{intersection_pl([$self_pl], $polygons)};
|
||||
if (@polylines == 2) {
|
||||
if (@polylines == 1) {
|
||||
if ($polylines[0][0]->coincides_with($self_pl->[0])) {
|
||||
# compensate the above workaround for Clipper bug
|
||||
$polylines[0][0]->translate(-1, 0);
|
||||
}
|
||||
} elsif (@polylines == 2) {
|
||||
# If the split_at_first_point() call above happens to split the polygon inside the clipping area
|
||||
# we would get two consecutive polylines instead of a single one, so we use this ugly hack to
|
||||
# recombine them back into a single one in order to trigger the @edges == 2 logic below.
|
||||
# This needs to be replaced with something way better.
|
||||
if ($polylines[0][-1]->coincides_width($self_pl->[-1]) && $polylines[-1][0]->coincides_width($self_pl->[0])) {
|
||||
if ($polylines[0][-1]->coincides_with($self_pl->[-1]) && $polylines[-1][0]->coincides_width($self_pl->[0])) {
|
||||
my $p = $polylines[0]->clone;
|
||||
$p->pop_back;
|
||||
$p->append(@{$polylines[-1]});
|
||||
return [$p];
|
||||
}
|
||||
if ($polylines[0][0]->coincides_width($self_pl->[0]) && $polylines[-1][-1]->coincides_width($self_pl->[-1])) {
|
||||
if ($polylines[0][0]->coincides_with($self_pl->[0]) && $polylines[-1][-1]->coincides_width($self_pl->[-1])) {
|
||||
my $p = $polylines[-1]->clone;
|
||||
$p->pop_back;
|
||||
$p->append(@{$polylines[0]});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue