From 1caa0fb05105978d04eba67559bb3afaae826b71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Wed, 28 Aug 2019 14:58:18 +0200 Subject: [PATCH] [apps/shared] tMin and tMax attributes to CartesianFunction --- apps/shared/cartesian_function.cpp | 16 ++++++++++++++++ apps/shared/cartesian_function.h | 19 +++++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/apps/shared/cartesian_function.cpp b/apps/shared/cartesian_function.cpp index a3fca1f14..d012f07b8 100644 --- a/apps/shared/cartesian_function.cpp +++ b/apps/shared/cartesian_function.cpp @@ -128,6 +128,22 @@ double CartesianFunction::approximateDerivative(double x, Poincare::Context * co return PoincareHelpers::ApproximateToScalar(derivative, context); } +double CartesianFunction::tMin() const { + return recordData()->tMin(); +} + +double CartesianFunction::tMax() const { + return recordData()->tMax(); +} + +void CartesianFunction::setTMin(double tMin) { + recordData()->setTMin(tMin); +} + +void CartesianFunction::setTMax(double tMax) { + recordData()->setTMax(tMax); +} + void * CartesianFunction::Model::expressionAddress(const Ion::Storage::Record * record) const { return (char *)record->value().buffer+sizeof(CartesianFunctionRecordDataBuffer); } diff --git a/apps/shared/cartesian_function.h b/apps/shared/cartesian_function.h index cc17e6187..28a980611 100644 --- a/apps/shared/cartesian_function.h +++ b/apps/shared/cartesian_function.h @@ -26,17 +26,22 @@ public: void setPlotType(PlotType plotType); // Evaluation - float evaluateAtAbscissa(float x, Poincare::Context * context) const override { - return templatedApproximateAtAbscissa(x, context); + Poincare::Coordinate2D evaluateAtParameter(float t, Poincare::Context * context) const override { + return templatedApproximateAtParameter(t, context); } - double evaluateAtAbscissa(double x, Poincare::Context * context) const override { - return templatedApproximateAtAbscissa(x, context); + Poincare::Coordinate2D evaluateAtParameter(double t, Poincare::Context * context) const override { + return templatedApproximateAtParameter(t, context); } // Derivative bool displayDerivative() const; void setDisplayDerivative(bool display); int derivativeNameWithArgument(char * buffer, size_t bufferSize); double approximateDerivative(double x, Poincare::Context * context) const; + // tMin and tMax + double tMin() const; + double tMax() const; + void setTMin(double tMin); + void setTMax(double tMax); private: /* CartesianFunctionRecordDataBuffer is the layout of the data buffer of Record * representing a CartesianFunction. See comment on @@ -53,9 +58,15 @@ private: void setPlotType(PlotType plotType) { m_plotType = plotType; } bool displayDerivative() const { return m_displayDerivative; } void setDisplayDerivative(bool display) { m_displayDerivative = display; } + double tMin() const { return m_tMin; } + double tMax() const { return m_tMax; } + void setTMin(double tMin) { m_tMin = tMin; } + void setTMax(double tMax) { m_tMax = tMax; } private: PlotType m_plotType; bool m_displayDerivative; + double m_tMin; + bool m_tMax; /* In the record, after the boolean flag about displayDerivative, there is * the expression of the function, directly copied from the pool. */ //char m_expression[0];