Files
Upsilon/apps/graph/graph/extremum_graph_controller.cpp
Émilie Feral 37fd6f4d76 [apps/graph] Move function min and max computation from the controller
to the model CartesianFunction and take into account function domain
2019-09-09 11:42:16 +02:00

36 lines
1.5 KiB
C++

#include "extremum_graph_controller.h"
#include "../../shared/poincare_helpers.h"
#include <poincare/serialization_helper.h>
using namespace Poincare;
namespace Graph {
MinimumGraphController::MinimumGraphController(Responder * parentResponder, GraphView * graphView, BannerView * bannerView, Shared::InteractiveCurveViewRange * curveViewRange, Shared::CurveViewCursor * cursor) :
CalculationGraphController(parentResponder, graphView, bannerView, curveViewRange, cursor, I18n::Message::NoMinimumFound)
{
}
const char * MinimumGraphController::title() {
return I18n::translate(I18n::Message::Minimum);
}
Coordinate2D<double> MinimumGraphController::computeNewPointOfInterest(double start, double step, double max, Poincare::Context * context) {
return functionStore()->modelForRecord(m_record)->nextMinimumFrom(start, step, max, context);
}
MaximumGraphController::MaximumGraphController(Responder * parentResponder, GraphView * graphView, BannerView * bannerView, Shared::InteractiveCurveViewRange * curveViewRange, Shared::CurveViewCursor * cursor) :
CalculationGraphController(parentResponder, graphView, bannerView, curveViewRange, cursor, I18n::Message::NoMaximumFound)
{
}
const char * MaximumGraphController::title() {
return I18n::translate(I18n::Message::Maximum);
}
Coordinate2D<double> MaximumGraphController::computeNewPointOfInterest(double start, double step, double max, Poincare::Context * context) {
return functionStore()->modelForRecord(m_record)->nextMaximumFrom(start, step, max, context);
}
}