Fixed layer profile equality check for wipe tower validation (fixup of b43003d)

This commit is contained in:
Lukas Matena 2019-09-20 10:53:50 +02:00
parent a27026aa03
commit b241ba16ed

View File

@ -1236,7 +1236,8 @@ std::string Print::validate() const
// The comparison of the profiles is not just about element-wise equality, some layers may not be
// explicitely included. Always remember z and height of last reference layer that in the vector
// and compare to that.
// and compare to that. In case some layers are in the vectors multiple times, only the last entry is
// taken into account and compared.
size_t i = 0; // index into tested profile
size_t j = 0; // index into reference profile
coordf_t ref_z = -1.;
@ -1244,8 +1245,12 @@ std::string Print::validate() const
coordf_t ref_height = -1.;
while (i < layer_height_profile.size()) {
coordf_t this_z = layer_height_profile[i];
// find the last entry with this z
while (i+2 < layer_height_profile.size() && layer_height_profile[i+2] == this_z)
i += 2;
coordf_t this_height = layer_height_profile[i+1];
if (next_ref_z < this_z + EPSILON) {
if (ref_height < -1. || next_ref_z < this_z + EPSILON) {
ref_z = next_ref_z;
do { // one layer can be in the vector several times
ref_height = layer_height_profile_tallest[j+1];