mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[poincare/zoom] Method FullRange
Change-Id: Ibfaa0b694afecab312199b20b102a57901f34ae7
This commit is contained in:
committed by
Émilie Feral
parent
09c061e871
commit
81e425eb04
@@ -21,6 +21,7 @@ public:
|
||||
static bool InterestingRangesForDisplay(ValueAtAbscissa evaluation, float * xMin, float * xMax, float * yMin, float * yMax, float tMin, float tMax, Context * context, const void * auxiliary);
|
||||
static void RefinedYRangeForDisplay(ValueAtAbscissa evaluation, float xMin, float xMax, float * yMin, float * yMax, Context * context, const void * auxiliary, bool boundByMagnitude = false);
|
||||
static void RangeWithRatioForDisplay(ValueAtAbscissa evaluation, float yxRatio, float * xMin, float * xMax, float * yMin, float * yMax, Context * context, const void * auxiliary);
|
||||
static void FullRange(ValueAtAbscissa evaluation, float tMin, float tMax, float tStep, float * fMin, float * fMax, Context * context, const void * auxiliary);
|
||||
|
||||
/* If shrink is false, the range will be set to ratio by increasing the size
|
||||
* of the smallest axis. If it is true, the longest axis will be reduced.*/
|
||||
|
||||
@@ -262,6 +262,25 @@ void Zoom::RangeWithRatioForDisplay(ValueAtAbscissa evaluation, float yxRatio, f
|
||||
SetToRatio(yxRatio, xMin, xMax, yMin, yMax, true);
|
||||
}
|
||||
|
||||
void Zoom::FullRange(ValueAtAbscissa evaluation, float tMin, float tMax, float tStep, float * fMin, float * fMax, Context * context, const void * auxiliary) {
|
||||
float t = tMin;
|
||||
*fMin = FLT_MAX;
|
||||
*fMax = -FLT_MAX;
|
||||
while (t <= tMax) {
|
||||
float value = evaluation(t, context, auxiliary);
|
||||
if (value < *fMin) {
|
||||
*fMin = value;
|
||||
}
|
||||
if (value > *fMax) {
|
||||
*fMax = value;
|
||||
}
|
||||
t += tStep;
|
||||
}
|
||||
if (*fMin == *fMax) {
|
||||
RangeFromSingleValue(*fMin, fMin, fMax);
|
||||
}
|
||||
}
|
||||
|
||||
void Zoom::RangeFromSingleValue(float value, float * boundMin, float * boundMax) {
|
||||
constexpr float margin = 0.2f;
|
||||
float delta = margin * std::fabs(value);
|
||||
|
||||
Reference in New Issue
Block a user