diff --git a/apps/shared/function_graph_controller.cpp b/apps/shared/function_graph_controller.cpp index 362205430..fce5e6b05 100644 --- a/apps/shared/function_graph_controller.cpp +++ b/apps/shared/function_graph_controller.cpp @@ -70,7 +70,6 @@ InteractiveCurveViewRangeDelegate::Range FunctionGraphController::computeYRange( float max = -FLT_MAX; float xMin = interactiveCurveViewRange->xMin(); float xMax = interactiveCurveViewRange->xMax(); - float step = (xMax - xMin)/curveView()->resolution(); if (functionStore()->numberOfActiveFunctions() <= 0) { InteractiveCurveViewRangeDelegate::Range range; range.min = xMin; @@ -80,8 +79,8 @@ InteractiveCurveViewRangeDelegate::Range FunctionGraphController::computeYRange( for (int i=0; inumberOfActiveFunctions(); i++) { Function * f = functionStore()->activeFunctionAtIndex(i); float y = 0.0f; - for (int i = 0; i <= curveView()->resolution(); i++) { - float x = xMin + i*step; + for (int j = 0; j <= curveView()->resolution(); j++) { + float x = xMin+(xMax-xMin)*j/curveView()->resolution(); y = f->evaluateAtAbscissa(x, myApp->localContext()); if (!std::isnan(y) && !std::isinf(y)) { min = min < y ? min : y;