mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 23:46:24 -06:00
Fix asserts which would not compile. (#3741)
This commit is contained in:
parent
3cb573dcb9
commit
e5bdc7d5bd
6 changed files with 19 additions and 26 deletions
|
@ -475,7 +475,7 @@ static ClipperLib_Z::Paths clip_extrusion(const ClipperLib_Z::Path& subject, con
|
|||
end = e2top;
|
||||
}
|
||||
|
||||
assert(start.z() > 0 && end.z() > 0);
|
||||
assert(start.z() >= 0 && end.z() >= 0);
|
||||
|
||||
// Interpolate extrusion line width.
|
||||
double length_sqr = (end - start).cast<double>().squaredNorm();
|
||||
|
@ -832,6 +832,8 @@ static ExtrusionEntityCollection traverse_extrusions(const PerimeterGenerator& p
|
|||
if (extrusion->is_closed) {
|
||||
ExtrusionLoop extrusion_loop(std::move(paths), pg_extrusion.is_contour ? elrDefault : elrHole);
|
||||
extrusion_loop.make_counter_clockwise();
|
||||
// TODO: it seems in practice that ExtrusionLoops occasionally have significantly disconnected paths,
|
||||
// triggering the asserts below. Is this a problem?
|
||||
for (auto it = std::next(extrusion_loop.paths.begin()); it != extrusion_loop.paths.end(); ++it) {
|
||||
assert(it->polyline.points.size() >= 2);
|
||||
assert(std::prev(it)->polyline.last_point() == it->polyline.first_point());
|
||||
|
@ -843,12 +845,11 @@ static ExtrusionEntityCollection traverse_extrusions(const PerimeterGenerator& p
|
|||
else {
|
||||
// Because we are processing one ExtrusionLine all ExtrusionPaths should form one connected path.
|
||||
// But there is possibility that due to numerical issue there is poss
|
||||
assert([&paths = std::as_const(paths)]() -> bool {
|
||||
for (auto it = std::next(paths.begin()); it != paths.end(); ++it)
|
||||
if (std::prev(it)->polyline.last_point() != it->polyline.first_point())
|
||||
return false;
|
||||
return true;
|
||||
}());
|
||||
// TODO: do we need some tolerance for disconnected paths below?
|
||||
for (auto it = std::next(paths.begin()); it != paths.end(); ++it) {
|
||||
assert(it->polyline.points.size() >= 2);
|
||||
assert(std::prev(it)->polyline.last_point() == it->polyline.first_point());
|
||||
}
|
||||
ExtrusionMultiPath multi_path;
|
||||
multi_path.paths.emplace_back(std::move(paths.front()));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue