mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[poincare/zoom] Handle undefined functions
Rework the logic so that :
- an undefined function will be displayed with a clealry defined
null range.
- display both an undefined function and a correct function at the
same time will not affect the correct range.
Change-Id: Ife9dc0d2ace667cab5a6b8826347078fca33e4d5
This commit is contained in:
committed by
Émilie Feral
parent
20cbefad41
commit
958b172d08
@@ -285,10 +285,39 @@ void ContinuousFunction::rangeForDisplay(float * xMin, float * xMax, float * yMi
|
||||
};
|
||||
|
||||
if (fullyComputed) {
|
||||
/* The function has points of interest. */
|
||||
Zoom::RefinedYRangeForDisplay(evaluation, *xMin, *xMax, yMin, yMax, context, this);
|
||||
} else {
|
||||
Zoom::RangeWithRatioForDisplay(evaluation, InteractiveCurveViewRange::NormalYXRatio(), xMin, xMax, yMin, yMax, context, this);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Try to display an orthonormal range. */
|
||||
Zoom::RangeWithRatioForDisplay(evaluation, InteractiveCurveViewRange::NormalYXRatio(), xMin, xMax, yMin, yMax, context, this);
|
||||
if (std::isfinite(*xMin) && std::isfinite(*xMax) && std::isfinite(*yMin) && std::isfinite(*yMax)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* The function's profile is not great for an orthonormal range.
|
||||
* Try a basic range. */
|
||||
*xMin = - Zoom::k_defaultHalfRange;
|
||||
*xMax = Zoom::k_defaultHalfRange;
|
||||
Zoom::RefinedYRangeForDisplay(evaluation, *xMin, *xMax, yMin, yMax, context, this);
|
||||
if (std::isfinite(*xMin) && std::isfinite(*xMax) && std::isfinite(*yMin) && std::isfinite(*yMax)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* The function's order of magnitude cannot be computed. Try to just display
|
||||
* the full function. */
|
||||
float step = (*xMax - *xMin) / k_polarParamRangeSearchNumberOfPoints;
|
||||
Zoom::FullRange(evaluation, *xMin, *xMax, step, yMin, yMax, context, this);
|
||||
if (std::isfinite(*xMin) && std::isfinite(*xMax) && std::isfinite(*yMin) && std::isfinite(*yMax)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* The function is probably undefined. */
|
||||
*xMin = NAN;
|
||||
*xMax = NAN;
|
||||
*yMin = NAN;
|
||||
*yMax = NAN;
|
||||
}
|
||||
|
||||
void * ContinuousFunction::Model::expressionAddress(const Ion::Storage::Record * record) const {
|
||||
|
||||
Reference in New Issue
Block a user