Changeset 14771
- Timestamp:
- Sep 7, 2007, 10:17:28 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20070830/psLib/src/math/psHistogram.c
r12434 r14771 5 5 * @author GLG (MHPCC), EAM (IfA) 6 6 * 7 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $8 * @date $Date: 2007-0 3-14 02:36:28 $7 * @version $Revision: 1.5.8.1 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2007-09-07 20:17:28 $ 9 9 * 10 10 * Copyright 2006 IfA, University of Hawaii … … 282 282 out->maxNum++; 283 283 } else { 284 // If this is a uniform histogram, determining the correct 285 // number is trivial.284 // If this is a uniform histogram, determining the correct bin 285 // number is almost trivial. start with a guess from the uniform scale. 286 286 if (out->uniform == true) { 287 floatbinSize = out->bounds->data.F32[1] - out->bounds->data.F32[0]; // Histogram bin size287 double binSize = out->bounds->data.F32[1] - out->bounds->data.F32[0]; // Histogram bin size 288 288 binNum = (inF32->data.F32[i] - out->bounds->data.F32[0]) / binSize; 289 binNum = PS_MAX (binNum, 0); 290 binNum = PS_MIN (binNum, numBins - 1); 291 292 // we may slightly overshoot or undershoot. creep up or down on the true bin 293 if (inF32->data.F32[i] < out->bounds->data.F32[binNum]) { 294 psTrace("psLib.math", 6, "missed target bin, adjusting: %f vs %f to %f\n", inF32->data.F32[i], out->bounds->data.F32[binNum], out->bounds->data.F32[binNum+1]); 295 while ((inF32->data.F32[i] < out->bounds->data.F32[binNum]) && (binNum > 0)) { 296 binNum --; 297 } 298 299 } 300 if (inF32->data.F32[i] > out->bounds->data.F32[binNum+1]) { 301 psTrace("psLib.math", 6, "missed target bin, adjusting: %f vs %f to %f\n", inF32->data.F32[i], out->bounds->data.F32[binNum], out->bounds->data.F32[binNum+1]); 302 while ((inF32->data.F32[i] > out->bounds->data.F32[binNum+1]) && (binNum < numBins - 1)) { 303 binNum ++; 304 } 305 } 306 289 307 if (errorsF32) { 290 308 if (!UpdateHistogramBins(binNum, out, inF32->data.F32[i], errorsF32->data.F32[i])) {
Note:
See TracChangeset
for help on using the changeset viewer.
