[poincare/zoom] Improve null range

When displaying f(x) = undef, the range now defaults to an orthonormal
range, centered on the origin, with axis unit 1.

Change-Id: Ie3515be0572af4849b8ebd113449f4444755b34f
This commit is contained in:
Gabriel Ozouf
2020-10-14 10:24:47 +02:00
committed by Émilie Feral
parent 190568ea84
commit 482ca10363

View File

@@ -184,11 +184,16 @@ void Zoom::RefinedYRangeForDisplay(ValueAtAbscissa evaluation, float xMin, float
* its average order of magnitude. Then, bound is the value for the next
* order of magnitude and is used to cut the Y range. */
float bound = (pop > 0) ? std::exp(sum / pop + 1.f) : FLT_MAX;
sampleYMin = std::max(sampleYMin, - bound);
sampleYMax = std::min(sampleYMax, bound);
*yMin = sampleYMin;
*yMax = sampleYMax;
if (pop == 0) {
*yMin = 0;
*yMax = 0;
} else {
float bound = std::exp(sum / pop + 1.f);
sampleYMin = std::max(sampleYMin, - bound);
sampleYMax = std::min(sampleYMax, bound);
*yMin = sampleYMin;
*yMax = sampleYMax;
}
if (*yMin == *yMax) {
RangeFromSingleValue(*yMin, yMin, yMax);
}