diff --git a/apps/graph/graph/graph_controller.cpp b/apps/graph/graph/graph_controller.cpp index da2b65023..b08f9963b 100644 --- a/apps/graph/graph/graph_controller.cpp +++ b/apps/graph/graph/graph_controller.cpp @@ -59,9 +59,6 @@ void GraphController::interestingRanges(float * xm, float * xM, float * ym, floa float resultyMax = -FLT_MAX; float xMin = const_cast(this)->interactiveCurveViewRange()->xMin(); float xMax = const_cast(this)->interactiveCurveViewRange()->xMax(); - /* In practice, a step smaller than a pixel's width is needed for sampling - * the values of a function. Otherwise some relevant extremal values may be - * missed. */ assert(functionStore()->numberOfActiveFunctions() > 0); if (displaysNonCartesianFunctions()) { for (int i = 0; i < functionStore()->numberOfActiveFunctions(); i++) { @@ -106,10 +103,6 @@ void GraphController::interestingRanges(float * xm, float * xM, float * ym, floa } float GraphController::interestingXHalfRange() const { - if (displaysNonCartesianFunctions()) - { - return 5.0f; - } float characteristicRange = 0.0f; Poincare::Context * context = textFieldDelegateApp()->localContext(); CartesianFunctionStore * store = functionStore(); diff --git a/apps/shared/interactive_curve_view_range.cpp b/apps/shared/interactive_curve_view_range.cpp index 4c31d1e3f..42c05c9ee 100644 --- a/apps/shared/interactive_curve_view_range.cpp +++ b/apps/shared/interactive_curve_view_range.cpp @@ -152,16 +152,9 @@ void InteractiveCurveViewRange::setDefault() { m_yAuto = true; return; } -#if 0 - m_yAuto = false; - m_xMax = NormalizedXHalfRange(); - setXMin(-NormalizedXHalfRange()); - m_yMax = NormalizedYHalfRange(); - setYMin(-NormalizedYHalfRange()); - normalize(); -#else - m_yAuto = false; + m_yAuto = false; + // Compute the interesting ranges float a,b,c,d; m_delegate->interestingRanges(&a, &b, &c, &d); MemoizedCurveViewRange::setXMin(a); @@ -169,12 +162,15 @@ void InteractiveCurveViewRange::setDefault() { MemoizedCurveViewRange::setYMin(c); MemoizedCurveViewRange::setYMax(d); + // Add margins float xRange = m_xMax - m_xMin; float yRange = m_yMax - m_yMin; m_xMin = m_delegate->addMargin(m_xMin, xRange, false, true); MemoizedCurveViewRange::setXMax(m_delegate->addMargin(m_xMax, xRange, false, false)); m_yMin = m_delegate->addMargin(m_yMin, yRange, true, true); MemoizedCurveViewRange::setYMax(m_delegate->addMargin(m_yMax, yRange, true, false)); + + // Normalize the axes, so that a polar circle is displayed as a circle xRange = m_xMax - m_xMin; yRange = m_yMax - m_yMin; float xyRatio = xRange/yRange; @@ -192,7 +188,6 @@ void InteractiveCurveViewRange::setDefault() { m_yMin -= delta; MemoizedCurveViewRange::setYMax(m_yMax+delta); } -#endif } void InteractiveCurveViewRange::centerAxisAround(Axis axis, float position) {