mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[shared] Create helper functions for ranges
These functions are used to test the full algorithm used to compute ranges. Change-Id: I48069e245aa6e879f66aecc29709fc6f992f5220
This commit is contained in:
committed by
LeaNumworks
parent
1e7babadb8
commit
a9aeae94df
@@ -154,27 +154,8 @@ int FunctionGraphController::numberOfCurves() const {
|
||||
}
|
||||
|
||||
void FunctionGraphController::interestingRanges(InteractiveCurveViewRange * range) {
|
||||
Poincare::Context * context = textFieldDelegateApp()->localContext();
|
||||
constexpr int maxLength = 10;
|
||||
float xMins[maxLength], xMaxs[maxLength], yMins[maxLength], yMaxs[maxLength];
|
||||
int length = functionStore()->numberOfActiveFunctions();
|
||||
|
||||
float ratio = InteractiveCurveViewRange::NormalYXRatio() / (1 + cursorTopMarginRatio() + cursorBottomMarginRatio());
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
ExpiringPointer<Function> f = functionStore()->modelForRecord(functionStore()->activeRecordAtIndex(i));
|
||||
f->rangeForDisplay(xMins + i, xMaxs + i, yMins + i, yMaxs + i, ratio, context);
|
||||
}
|
||||
|
||||
float xMin, xMax, yMin, yMax;
|
||||
Poincare::Zoom::CombineRanges(length, xMins, xMaxs, &xMin, &xMax);
|
||||
Poincare::Zoom::CombineRanges(length, yMins, yMaxs, &yMin, &yMax);
|
||||
Poincare::Zoom::SanitizeRange(&xMin, &xMax, &yMin, &yMax, range->NormalYXRatio());
|
||||
|
||||
range->setXMin(xMin);
|
||||
range->setXMax(xMax);
|
||||
range->setYMin(yMin);
|
||||
range->setYMax(yMax);
|
||||
InterestingRangesHelper(range, textFieldDelegateApp()->localContext(), functionStore(), ratio);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user