Commit Graph

19 Commits

Author SHA1 Message Date
Gabriel Ozouf
d2b36be846 [poincare/zoom] Move automatic zoom to Poincare
Change-Id: I7a70ab54b33b9150682cc4f999ff4999a8288b7f
2020-11-04 15:58:07 +01:00
Gabriel Ozouf
a6db9688cd [apps/function] Factorize zoom in Function class
The new zoom implemented for ContinuousFunction is now factorized inside
Function to benefit the Sequence class. The same things is done to code
added to Graph::GraphController, which is moved into
FunctionGraphController.
This removes the reimplementation of several methods, most notably
computeYRange, as the implementation for function is general enough to
work on sequences.

Change-Id: I9b8211354064f46c3fa3dde3191dcb39d627a1d2
2020-11-04 15:30:53 +01:00
Gabriel Ozouf
33f9bb50a3 [apps/continuous_function] Forced X axis display
The auto zoom did not display the X axis when drawing positive curves
with roots, such as sqrt(x).

Change-Id: Ic80fd3207691dc917f7b64c07d7745ab5df1daa3
2020-11-04 15:30:53 +01:00
Gabriel Ozouf
8104caea50 [apps/shared] New automatic zoom on curves
Initial zoom for displaying curves is computed according to the
following rules :
  - For polar and parametric curves, the algorithm has not changed.
    Vertical and horizontal ranges are chosen in order to display the
    full curve with orthonormal graduations.
  - For cartesian curves, the horizontal range is chosen in order to
    display all points of interest (roots, extrema, asymptotes...).
    The vertical range is fitted to be able to display those points, but
    also cuts out points outside of the function's order of magnitude.

Change-Id: Idf8233fc2e6586b85d34c4da152c83e75513d85c
2020-11-04 15:30:53 +01:00
Hugo Saint-Vignes
8688fd5b95 [apps/shared] Add template for privateEvaluateXYAtParameter
Change-Id: I97b4165307f57e52924e321cb85154cb32ba1008
2020-11-04 15:11:43 +01:00
Gabriel Ozouf
2bfdc482a6 [apps/continuous_function] Cut clearCache method
Inlined call to ContinuousFunction::clearCache and removed the method,
as its name was confusing.

Change-Id: I54454fb0b06167e01249afaa5b23932451125f2e
2020-11-04 15:07:19 +01:00
Gabriel Ozouf
1bee23cf4f [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
2020-11-04 15:07:19 +01:00
Gabriel Ozouf
42fcf557b8 [apps/graph] Limited number of cached functions
The caches used for function values memoization are now stored in
ContinuousFunctionStore : there are now only a fixed number, instead of
one per function. This effectively enables caching only for the first
few functions on screen, while reducing the memory usage.

Change-Id: I2ade091717f73a14a756fe527c773db8e8627be7
2020-11-04 15:04:24 +01:00
Gabriel Ozouf
c70b545ba1 [apps/shared] Cache lookup on function evaluation
When evaluating a ContinuousFunction for a float value, the function
will first try to ask its cache (if it has been filled beforehand).

Change-Id: I519d2d3dcf344ba63e30a0f011db2306c7141315
2020-11-04 14:45:35 +01:00
Gabriel Ozouf
a9c633a540 [apps/shared] Functions cache clears on change
Added several triggers to clear the cache when the function's type,
range or content is changed.

Change-Id: I4f49a90bb6571e335a4a601723d7715b8de1e25e
2020-11-04 14:45:35 +01:00
Romain Goyet
84768472bd Explicit std::min/max template usage
This is unfortunately required in several cases:
 - Sometimes when we use either float and double (this should be changed)
 - Because KDCoordinate is not an int, so any arithmemtic promotes it to
an int
 - Because we mix pointer differences and ints
2020-04-14 09:31:02 -04:00
Romain Goyet
950862f8d0 Use std::min and std::max 2020-04-14 09:31:02 -04:00
Émilie Feral
886fc98350 [escher] Palette: factorize data color iteration 2020-04-01 10:18:08 +02:00
Léa Saviot
a3a1f86f8d [apps] Add context parameter to fix tests 2020-02-12 15:13:21 +01:00
Léa Saviot
756eeeb2d8 [poincare/parser] Add context 2020-02-12 15:13:21 +01:00
Ruben Dashyan
c3cf5c1ef4 Rename UCodePointUnknownX to UCodePointUnknown 2020-02-12 15:13:15 +01:00
Ruben Dashyan
34aa27ea08 [apps/shared/continuous_function] Simplify templatedApproximateAtParameter 2020-02-12 15:13:15 +01:00
Ruben Dashyan
5750d00574 [apps/shared] Remove redundant call to isCircularlyDefined
ExpressionModel::expressionReduced does already call isCircularlyDefined
and returns undef if true.
The isCircularlyDefined method is then made private.
2020-02-12 15:13:15 +01:00
Ruben Dashyan
5f9464a548 [apps] In Shared, move cartesian_function.* to continuous_function.* 2019-09-20 17:11:42 +02:00