Files
Upsilon/apps/graph/function.h
Émilie Feral 529a06131d [apps/graph] Add a boolean in function to indicate wheter to display
derivative

Change-Id: I0565de1645952007347cf3aee5f1a70f8280e0f3
2016-10-24 10:31:20 +02:00

44 lines
1.1 KiB
C++

#ifndef GRAPH_FUNCTION_H
#define GRAPH_FUNCTION_H
#include <poincare.h>
#include <kandinsky.h>
#include "evaluate_context.h"
namespace Graph {
class Function {
public:
static constexpr const char * Parameter = "(x)";
Function(const char * text = nullptr, KDColor color = KDColorBlack);
~Function(); // Delete expression and layout, if needed
const char * text();
const char * name();
KDColor color() const { return m_color; }
Expression * expression();
ExpressionLayout * layout();
bool isActive();
void setActive(bool active);
bool displayDerivative();
void setDisplayDerivative(bool display);
void setContent(const char * c);
void setColor(KDColor m_color);
float evaluateAtAbscissa(float x, EvaluateContext * context) const;
float approximateDerivative(float x, EvaluateContext * context) const;
private:
constexpr static float k_epsilon = 0.0001f;
constexpr static int k_bodyLength = 255;
char m_text[k_bodyLength];
const char * m_name;
KDColor m_color;
Expression * m_expression;
ExpressionLayout * m_layout;
bool m_active;
bool m_displayDerivative;
};
}
#endif