mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-23 07:40:42 +01:00
[apps/graph] init Range to -5..5 if polar/param
This commit is contained in:
@@ -34,10 +34,15 @@ void GraphController::viewWillAppear() {
|
||||
}
|
||||
|
||||
float GraphController::interestingXHalfRange() const {
|
||||
if (displaysNonCartesianFunctions())
|
||||
{
|
||||
return 5.0f;
|
||||
}
|
||||
float characteristicRange = 0.0f;
|
||||
Poincare::Context * context = textFieldDelegateApp()->localContext();
|
||||
for (int i = 0; i < functionStore()->numberOfActiveFunctions(); i++) {
|
||||
ExpiringPointer<CartesianFunction> f = functionStore()->modelForRecord(functionStore()->activeRecordAtIndex(i));
|
||||
CartesianFunctionStore * store = functionStore();
|
||||
for (int i = 0; i < store->numberOfActiveFunctions(); i++) {
|
||||
ExpiringPointer<CartesianFunction> f = store->modelForRecord(store->activeRecordAtIndex(i));
|
||||
float fRange = f->expressionReduced(context).characteristicXRange(context, Poincare::Preferences::sharedPreferences()->angleUnit());
|
||||
if (!std::isnan(fRange)) {
|
||||
characteristicRange = maxFloat(fRange, characteristicRange);
|
||||
@@ -83,4 +88,10 @@ double GraphController::defaultCursorT(Ion::Storage::Record record) {
|
||||
return function->tMin();
|
||||
}
|
||||
|
||||
bool GraphController::displaysNonCartesianFunctions() const {
|
||||
CartesianFunctionStore * store = functionStore();
|
||||
return store->numberOfActiveFunctionsOfType(CartesianFunction::PlotType::Polar) > 0
|
||||
|| store->numberOfActiveFunctionsOfType(CartesianFunction::PlotType::Parametric) > 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user