[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

@@ -2,7 +2,6 @@
#include "expression_model_store.h"
#include "poincare_helpers.h"
#include <poincare/derivative.h>
#include <poincare/integral.h>
#include <poincare/serialization_helper.h>
#include <escher/palette.h>
#include <ion/unicode/utf8_decoder.h>
@@ -95,15 +94,6 @@ double CartesianFunction::approximateDerivative(double x, Poincare::Context * co
return PoincareHelpers::ApproximateToScalar<double>(derivative, context);
}
double CartesianFunction::sumBetweenBounds(double start, double end, Poincare::Context * context) const {
// TODO: this does not work yet because integral does not understand UnknownX
Poincare::Integral integral = Poincare::Integral::Builder(expressionReduced(context).clone(), 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. */
return PoincareHelpers::ApproximateToScalar<double>(integral, context);
}
void * CartesianFunction::Model::expressionAddress(const Ion::Storage::Record * record) const {
return (char *)record->value().buffer+sizeof(CartesianFunctionRecordDataBuffer);
}