[poincare/zoom] Method NextUnit

Change-Id: I8200c38fd44b662dcffa8e9850fc272f3e2dc7e8
This commit is contained in:
Gabriel Ozouf
2020-11-17 11:03:34 +01:00
committed by EmilieNumworks
parent cfc37f1bac
commit e4162976e4
2 changed files with 18 additions and 0 deletions

View File

@@ -67,6 +67,7 @@ private:
* an asymptote, by recursively computing the slopes. In case of an extremum,
* the slope should taper off toward the center. */
static bool IsConvexAroundExtremum(ValueAtAbscissa evaluation, float x1, float x2, float x3, float y1, float y2, float y3, Context * context, const void * auxiliary, int iterations = 3);
static void NextUnit(float * mantissa, float * exponent);
};
}

View File

@@ -371,4 +371,21 @@ bool Zoom::IsConvexAroundExtremum(ValueAtAbscissa evaluation, float x1, float x2
return true;
}
void Zoom::NextUnit(float * mantissa, float * exponent) {
if (*mantissa == k_smallUnitMantissa) {
*mantissa = k_mediumUnitMantissa;
return;
}
if (*mantissa == k_mediumUnitMantissa) {
*mantissa = k_largeUnitMantissa;
return;
}
if (*mantissa == k_largeUnitMantissa) {
*mantissa = k_smallUnitMantissa;
*exponent = 10.f * *exponent;
return;
}
assert(false);
}
}