[poincare/zoom] Limit explosion detection

Do not take strong variations into account if they would erase more
interesting variations.

Change-Id: I6299a64bed449a611f90eda4234af10a183958d1
This commit is contained in:
Gabriel Ozouf
2020-10-19 17:33:57 +02:00
committed by Émilie Feral
parent 3a90ed6109
commit 82c4fe2190

View File

@@ -152,8 +152,12 @@ bool Zoom::InterestingRangesForDisplay(ValueAtAbscissa evaluation, float * xMin,
*yMax = NAN;
return false;
} else {
resultX[0] = std::min(resultX[0], explosion[0]);
resultX[1] = std::max(resultX[1], explosion[1]);
float xMinWithExplosion = std::min(resultX[0], explosion[0]);
float xMaxWithExplosion = std::max(resultX[1], explosion[1]);
if (xMaxWithExplosion - xMinWithExplosion < k_maxRatioBetweenPointsOfInterest * (resultX[1] - resultX[0])) {
resultX[0] = xMinWithExplosion;
resultX[1] = xMaxWithExplosion;
}
/* Add breathing room around points of interest. */
float xRange = resultX[1] - resultX[0];
resultX[0] -= k_breathingRoom * xRange;