[apps] Move sumBetweenBounds from Shared::Function to Shared::SumGraphController

This commit is contained in:
Ruben Dashyan
2019-07-03 16:05:36 +02:00
committed by Léa Saviot
parent 1d0668a84c
commit 43d72e082f
11 changed files with 19 additions and 22 deletions

View File

@@ -1,5 +1,6 @@
#include "integral_graph_controller.h"
#include "../../shared/text_field_delegate.h"
#include <poincare/integral.h>
#include <poincare/layout_helper.h>
#include "../app.h"
@@ -46,4 +47,11 @@ Layout IntegralGraphController::createFunctionLayout(ExpiringPointer<Shared::Fun
return LayoutHelper::String(buffer, strlen(buffer), KDFont::SmallFont);
}
Poincare::Expression IntegralGraphController::sumBetweenBounds(Shared::ExpiringPointer<Shared::Function> function, double start, double end, Poincare::Context * context) const {
return Poincare::Integral::Builder(function->expressionReduced(context).clone(), Poincare::Symbol::Builder(UCodePointUnknownX), Poincare::Float<double>::Builder(start), Poincare::Float<double>::Builder(end)); // Integral takes ownership of args
/* TODO: when we approximate integral, we might want to simplify the integral
* here. However, we might want to do it once for all x (to avoid lagging in
* the derivative table. */
}
}