mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/graph] Reworked function caching
Instead of being memoized all at once before display, functions values are now stored at evaluation time. Fixed some quirks with caching preparation. Change-Id: I5d212c271c8c41a6dc9074a15c720f0bccf8ac40
This commit is contained in:
committed by
Émilie Feral
parent
42fcf557b8
commit
1bee23cf4f
@@ -15,12 +15,13 @@ public:
|
||||
* function */
|
||||
static constexpr int k_numberOfAvailableCaches = 2;
|
||||
|
||||
static void PrepareCache(void * f, void * ctx, void * cch, float tMin, float tStep);
|
||||
static void PrepareForCaching(void * fun, ContinuousFunctionCache * cache, float tMin, float tStep);
|
||||
|
||||
ContinuousFunctionCache() { clear(); }
|
||||
|
||||
float step() const { return m_tStep; }
|
||||
bool filled() const { return m_filled; }
|
||||
void clear();
|
||||
Poincare::Coordinate2D<float> valueForParameter(const ContinuousFunction * function, float t) const;
|
||||
Poincare::Coordinate2D<float> valueForParameter(const ContinuousFunction * function, Poincare::Context * context, float t);
|
||||
private:
|
||||
/* The size of the cache is chosen to optimize the display of cartesian
|
||||
* function */
|
||||
@@ -29,14 +30,11 @@ private:
|
||||
|
||||
static float StepFactor(ContinuousFunction * function);
|
||||
|
||||
void invalidateBetween(int iInf, int iSup);
|
||||
void setRange(ContinuousFunction * function, float tMin, float tStep);
|
||||
void memoize(ContinuousFunction * function, Poincare::Context * context);
|
||||
void memoizeYForX(ContinuousFunction * function, Poincare::Context * context);
|
||||
void memoizeYForXBetweenIndices(ContinuousFunction * function, Poincare::Context * context, int iInf, int iSup);
|
||||
void memoizeXYForT(ContinuousFunction * function, Poincare::Context * context);
|
||||
float parameterForIndex(int i) const;
|
||||
int indexForParameter(const ContinuousFunction * function, float t) const;
|
||||
void pan(ContinuousFunction * function, Poincare::Context * context, float newTMin);
|
||||
Poincare::Coordinate2D<float> valuesAtIndex(const ContinuousFunction * function, Poincare::Context * context, float t, int i);
|
||||
void pan(ContinuousFunction * function, float newTMin);
|
||||
|
||||
float m_tMin, m_tStep;
|
||||
float m_cache[k_sizeOfCache];
|
||||
@@ -44,7 +42,6 @@ private:
|
||||
* with cartesian functions. When dealing with parametric or polar functions,
|
||||
* m_startOfCache should be zero.*/
|
||||
int m_startOfCache;
|
||||
bool m_filled;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user