# HG changeset patch # User Chris Cannam # Date 1480356599 0 # Node ID 47ee4706055cd7b28e54f0dd3a9196d24c71b6cd # Parent 9d443c13c5d15b1bb7500471bfed93425fd9b1ba Further fix to decision about when not to interpolate in ColumnOp::distribute diff -r 9d443c13c5d1 -r 47ee4706055c base/ColumnOp.cpp --- a/base/ColumnOp.cpp Mon Nov 28 14:41:45 2016 +0000 +++ b/base/ColumnOp.cpp Mon Nov 28 18:09:59 2016 +0000 @@ -99,6 +99,22 @@ vector out(h, 0.f); int bins = int(in.size()); + if (interpolate) { + // If the bins are all closer together than the target y + // coordinate increments, then we don't want to interpolate + // after all. But because the binfory mapping isn't + // necessarily linear, just checking e.g. whether bins > h is + // not enough -- the bins could still be spaced more widely at + // either end of the scale. We are prepared to assume however + // that if the bins are closer at both ends of the scale, they + // aren't going to diverge mysteriously in the middle. + if (h > 1 && + fabs(binfory[1] - binfory[0]) >= 1.0 && + fabs(binfory[h-1] - binfory[h-2]) >= 1.0) { + interpolate = false; + } + } + for (int y = 0; y < h; ++y) { if (interpolate) {