FIX: top z distance disappears in some cases
jira: STUDIO-8883 github: #5334 Change-Id: Ie70f6dada19cc17cd74fa6aa116d1ca4fb4a07d7
This commit is contained in:
parent
06da16f7b8
commit
849d41576c
|
@ -3258,9 +3258,11 @@ std::vector<LayerHeightData> TreeSupport::plan_layer_heights()
|
|||
for (int layer_nr = 0; layer_nr < contact_nodes.size(); layer_nr++) {
|
||||
if (contact_nodes[layer_nr].empty()) continue;
|
||||
SupportNode *node1 = contact_nodes[layer_nr].front();
|
||||
auto it = z_heights.lower_bound(node1->print_z + EPSILON);
|
||||
if (it == z_heights.end()) it = std::prev(it);
|
||||
int layer_nr2 = std::distance(z_heights.begin(), it);
|
||||
auto it = std::min_element(layer_heights.begin(), layer_heights.end(), [node1](const LayerHeightData &l1, const LayerHeightData &l2) {
|
||||
return std::abs(l1.print_z - node1->print_z) < std::abs(l2.print_z - node1->print_z);
|
||||
});
|
||||
if (it == layer_heights.end()) it = std::prev(it);
|
||||
int layer_nr2 = std::distance(layer_heights.begin(), it);
|
||||
contact_nodes2[layer_nr2].insert(contact_nodes2[layer_nr2].end(), contact_nodes[layer_nr].begin(), contact_nodes[layer_nr].end());
|
||||
}
|
||||
contact_nodes = contact_nodes2;
|
||||
|
@ -3284,7 +3286,7 @@ std::vector<LayerHeightData> TreeSupport::plan_layer_heights()
|
|||
if (accum_height > node1->height - EPSILON) break;
|
||||
}
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(debug) << format("plan_layer_heights adjust node's height %d %.2f: (%.3f,%d)->(%.3f,%.3f,%d)", layer_nr, node1->print_z,
|
||||
BOOST_LOG_TRIVIAL(debug) << format("plan_layer_heights adjust node's height print_z[%d]=%.2f: (%.3f,%d)->(%.3f,%.3f,%d)", layer_nr, node1->print_z,
|
||||
node1->height, node1->distance_to_top, new_height, accum_height, -num_layers);
|
||||
for (SupportNode *node : contact_nodes[layer_nr]) {
|
||||
node->height = new_height;
|
||||
|
|
Loading…
Reference in New Issue