Use EPSILON to match two layers by their floating point Z height.
This commit is contained in:
bubnikv 2017-12-13 10:32:25 +01:00
parent 673e98bc83
commit 91e847cb76

View File

@ -265,8 +265,8 @@ void ToolOrdering::fill_wipe_tower_partitions(const PrintConfig &config, coordf_
// Insert one additional wipe tower layer between lh.print_z and lt_object.print_z.
LayerTools lt_new(0.5f * (lt.print_z + lt_object.print_z));
// Find the 1st layer above lt_new.
for (j = i + 1; j < m_layer_tools.size() && m_layer_tools[j].print_z < lt_new.print_z; ++ j);
if (m_layer_tools[j].print_z == lt_new.print_z) {
for (j = i + 1; j < m_layer_tools.size() && m_layer_tools[j].print_z < lt_new.print_z - EPSILON; ++ j);
if (std::abs(m_layer_tools[j].print_z - lt_new.print_z) < EPSILON) {
m_layer_tools[j].has_wipe_tower = true;
} else {
LayerTools &lt_extra = *m_layer_tools.insert(m_layer_tools.begin() + j, lt_new);