mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-12 06:38:58 +08:00
SPE-2698: Fix crash during regions expansion.
This commit is contained in:
parent
ed27d06be3
commit
a3f75133c8
@ -283,6 +283,11 @@ std::vector<WaveSeed> wave_seeds(
|
||||
// Hope that at least one end of an open polyline is clipped by the boundary, thus an intersection point is created.
|
||||
(front.z() < 0 || back.z() < 0));
|
||||
|
||||
if (front != back && front.z() >= 0 && back.z() >= 0) {
|
||||
// Very rare case when both endpoints intersect boundary ExPolygons in existing points.
|
||||
// So the ZFillFunction callback hasn't been called.
|
||||
continue;
|
||||
} else
|
||||
if (front == back && (front.z() < idx_boundary_end)) {
|
||||
// This should be a very rare exception.
|
||||
// See https://github.com/prusa3d/PrusaSlicer/issues/12469.
|
||||
|
@ -284,3 +284,31 @@ SCENARIO("Region expansion basics", "[RegionExpansion]") {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("WaveSeed - ZFillFunction - SPE-2698", "[WaveSeedZFillFunctionSPE2698]")
|
||||
{
|
||||
const ExPolygons boundary = {{
|
||||
Point(-5900000, -20000000),
|
||||
Point(-6518889, -22009467),
|
||||
Point(-5779768, -22315621),
|
||||
Point(-5662934, -22033558),
|
||||
Point(-5615689, -21919501),
|
||||
Point(-5779767, -22315622),
|
||||
Point(-5040682, -22621761),
|
||||
Point(-4000000, -20000000),
|
||||
}};
|
||||
|
||||
const ExPolygons src = {{
|
||||
Point(-5615689, -21919501),
|
||||
Point(-5662934, -22033558),
|
||||
Point(-5779768, -22315621),
|
||||
Point(-5779767, -22315622),
|
||||
}};
|
||||
|
||||
std::vector<Slic3r::Algorithm::WaveSeed> wave_seeds = Slic3r::Algorithm::wave_seeds(src, boundary, 83561.8046, true);
|
||||
for (const Slic3r::Algorithm::WaveSeed &wave_seed : wave_seeds) {
|
||||
REQUIRE(wave_seed.src < src.size());
|
||||
REQUIRE(wave_seed.boundary < boundary.size());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user