Fixes for gap detection and case with no pad, but zero elevation.
This commit is contained in:
parent
12396c3051
commit
10897524df
@ -1410,6 +1410,7 @@ class SLASupportTree::Algorithm {
|
||||
{
|
||||
// People were killed for this number (seriously)
|
||||
static const double SQR2 = std::sqrt(2.0);
|
||||
static const Vec3d DOWN = {0.0, 0.0, -1.0};
|
||||
|
||||
double gndlvl = m_result.ground_level;
|
||||
Vec3d endp = {jp(X), jp(Y), gndlvl};
|
||||
@ -1451,20 +1452,30 @@ class SLASupportTree::Algorithm {
|
||||
initvals(mv), bound(0.0, 2 * min_dist));
|
||||
|
||||
mv = std::get<0>(result.optimum);
|
||||
endp = jp + std::sqrt(2) * mv * dir;
|
||||
endp = jp + SQR2 * mv * dir;
|
||||
Vec3d pgnd = {endp(X), endp(Y), gndlvl};
|
||||
can_add_base = result.score > min_dist;
|
||||
|
||||
auto abort_in_shame =
|
||||
[&normal_mode, &can_add_base, &endp, jp, gndlvl]()
|
||||
{
|
||||
normal_mode = true;
|
||||
can_add_base = false; // Nothing left to do, hope for the best
|
||||
endp = {jp(X), jp(Y), gndlvl};
|
||||
};
|
||||
|
||||
// We have to check if the bridge is feasible.
|
||||
if (bridge_mesh_intersect(jp, dir, radius) < (endp - jp).norm()) {
|
||||
normal_mode = true;
|
||||
endp = {jp(X), jp(Y), gndlvl};
|
||||
}
|
||||
if (bridge_mesh_intersect(jp, dir, radius) < (endp - jp).norm())
|
||||
abort_in_shame();
|
||||
else {
|
||||
// If the new endpoint is below ground, do not make a pillar
|
||||
if (endp(Z) < gndlvl)
|
||||
endp = endp - SQR2 * (gndlvl - endp(Z)) * dir; // back off
|
||||
else {
|
||||
|
||||
if (!std::isinf(bridge_mesh_intersect(endp, DOWN, radius)))
|
||||
abort_in_shame();
|
||||
|
||||
Pillar &plr = m_result.add_pillar(endp, pgnd, radius);
|
||||
|
||||
if (can_add_base)
|
||||
|
@ -439,12 +439,10 @@ SLAPrint::ApplyStatus SLAPrint::apply(const Model &model, const DynamicPrintConf
|
||||
update_apply_status(this->invalidate_all_steps());
|
||||
m_objects = print_objects_new;
|
||||
// Delete the PrintObjects marked as Unknown or Deleted.
|
||||
bool deleted_objects = false;
|
||||
for (auto &pos : print_object_status)
|
||||
if (pos.status == PrintObjectStatus::Unknown || pos.status == PrintObjectStatus::Deleted) {
|
||||
update_apply_status(pos.print_object->invalidate_all_steps());
|
||||
delete pos.print_object;
|
||||
deleted_objects = true;
|
||||
}
|
||||
if (new_objects)
|
||||
update_apply_status(false);
|
||||
@ -870,19 +868,22 @@ void SLAPrint::process()
|
||||
po.m_supportdata->support_points = po.transformed_support_points();
|
||||
}
|
||||
|
||||
// If the builtin pad mode is engaged, we have to filter out all the
|
||||
// If the zero elevation mode is engaged, we have to filter out all the
|
||||
// points that are on the bottom of the object
|
||||
if(builtin_pad_cfg(po.m_config)) {
|
||||
double gnd = po.m_supportdata->emesh.ground_level();
|
||||
auto & pts = po.m_supportdata->support_points;
|
||||
|
||||
if (po.config().support_object_elevation.getFloat() <= EPSILON) {
|
||||
double gnd = po.m_supportdata->emesh.ground_level();
|
||||
auto & pts = po.m_supportdata->support_points;
|
||||
double tolerance = po.config().pad_enable.getBool()
|
||||
? po.m_config.pad_wall_thickness.getFloat()
|
||||
: po.m_config.support_base_height.getFloat();
|
||||
|
||||
// get iterator to the reorganized vector end
|
||||
auto endit = std::remove_if(
|
||||
pts.begin(),
|
||||
pts.end(),
|
||||
[&po, gnd](const sla::SupportPoint &sp) {
|
||||
[tolerance, gnd](const sla::SupportPoint &sp) {
|
||||
double diff = std::abs(gnd - double(sp.pos(Z)));
|
||||
return diff <= po.m_config.pad_wall_thickness.getFloat();
|
||||
return diff <= tolerance;
|
||||
});
|
||||
|
||||
// erase all elements after the new end
|
||||
@ -1352,7 +1353,7 @@ void SLAPrint::process()
|
||||
};
|
||||
|
||||
// Rasterizing the model objects, and their supports
|
||||
auto rasterize = [this, max_objstatus]() {
|
||||
auto rasterize = [this]() {
|
||||
if(canceled()) return;
|
||||
|
||||
// collect all the keys
|
||||
|
Loading…
Reference in New Issue
Block a user