changeset 1170:958e352919a5 3.0-integration

Avoid rounding error giving too few bins in column request
author Chris Cannam
date Wed, 23 Nov 2016 10:39:32 +0000
parents b5c88c448ca2
children 84042e8c3c03
files layer/Colour3DPlotRenderer.cpp
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/layer/Colour3DPlotRenderer.cpp	Mon Nov 21 15:33:08 2016 +0000
+++ b/layer/Colour3DPlotRenderer.cpp	Wed Nov 23 10:39:32 2016 +0000
@@ -31,7 +31,7 @@
 
 #include <vector>
 
-#define DEBUG_COLOUR_PLOT_REPAINT 1
+//#define DEBUG_COLOUR_PLOT_REPAINT 1
 
 using namespace std;
 
@@ -813,12 +813,12 @@
     if (minbin >= sh) minbin = sh - 1;
     if (minbin < 0) minbin = 0;
 
-    int nbins  = int(binfory[h-1]) - minbin + 1;
+    int nbins  = int(binfory[h-1] + 0.0001) - minbin + 1;
     if (minbin + nbins > sh) nbins = sh - minbin;
 
 #ifdef DEBUG_COLOUR_PLOT_REPAINT
     cerr << "minbin = " << minbin << ", nbins = " << nbins << ", last binfory = "
-         << binfory[h-1] << " (model height " << sh << ")" << endl;
+         << binfory[h-1] << " (rounds to " << int(binfory[h-1]) << ") (model height " << sh << ")" << endl;
 #endif
     
     int psx = -1;