Commit Graph

83 Commits

Author SHA1 Message Date
Gabriel Ozouf
13d1b7077c [apps/shared] Removed method computeYRange
This method of InteractiveCurveViewRangeDelegate was only used to
compute the Y range when Yauto was on.

Change-Id: I9b688a87e16fc58c7d2b00eb071076b98f945df6
2020-11-04 15:58:09 +01:00
Gabriel Ozouf
8970e294aa [apps] Remove modelVersion from curves apps
The graph range used to be reset to default whenever all functions were
modified. As we no longer want to reset the range without the user's
input, we do not need to track whether the functions changed at all.

/!\ As of this commit, there is no longer a way to restore the default
zoom, until a new automatic zoom button is added.

Change-Id: Ie74e8fd61e13055fa6ce2b2d1e883182d4ecffce
2020-11-04 15:58:09 +01:00
Gabriel Ozouf
1a5661fd4c [apps/range_parameter_controller] Remove YAuto
This allows for a great deal of simplifications in the class
RangeParamterController.

Change-Id: I5de55d4e8e1f598eb13b08fb8f042907f55b2fa8
2020-11-04 15:58:08 +01:00
Gabriel Ozouf
5a07db3452 [apps] Remove "Preadjustments" menu for curves
Change-Id: I1a30efd502c5db36325d87fa0f1dffacc37a4f1c
2020-11-04 15:58:08 +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
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
bd2609bcba [apps/graph] Remove horizontal margins when panning on some graph calculations
Change-Id: I1a28555c5b4f04986b223617ab15110711a74841
2020-11-04 15:07:20 +01:00
Gabriel Ozouf
4007f4d452 [apps] Tweaked panning for better cache alignement
Method InteractiveCurveViewRange::panToMakePointVisible now moves the
range of a whole number of pixels when panning horizontally. This allows
the cache of cartesian functions not to be invalidated.

Change-Id: Idb9904fef134dd13458e1f2287b0fe5145e8aec7
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
e1d7b6bb04 [apps] Avoid unsigned/signed comparison: storeChecksumAtIndex takes an
int as parameter
2020-04-07 09:51:39 +02:00
Léa Saviot
53705fb333 [apps/graph_ctrlr] Reload range if no previous model is present
We memoize the checksum of the x first models, and we check that one of
these models is still present when the graph view appears. If so, we do
not reload the range, other wise we reload it.

Scenario:
f(t) = [t^2  t+1] in parametric
Display the graph
f(x) = 1 on ]-inf;0]
g(x) = 2 on [0;inf[
Display the graph -> the range did not change
2020-03-11 11:43:36 +01:00
Léa Saviot
aab8974934 [apps] Memoize five model checksums 2020-03-11 11:43:36 +01:00
Ruben Dashyan
63424fb98b [apps/*/function_graph_controller] Factor selectFunctionWithCursor 2020-02-12 15:13:24 +01:00
Ruben Dashyan
246a9aa7a4 [apps/shared/function_graph_controller] Clarify function selection in initCursorParameters 2020-02-12 15:13:24 +01:00
Ruben Dashyan
1cdd61ea47 [apps/shared/function_graph_controller] Do not compute the numberOfActiveFunctions repeatedly 2020-02-12 15:13:24 +01:00
Léa Saviot
79a70f5b6e [apps/graph] Clip t when navigating curves vertically 2019-09-23 17:31:35 +02:00
Léa Saviot
e9974a216d [apps/graph] If only cartesians, jump to next curve when out of range
Scenario:

-----------•   ->press "right": the cursor goes on the lower curve

           -*-*-*-*-*-
2019-09-23 17:31:35 +02:00
Léa Saviot
ebfa251db8 [apps/grah} closestCurveIndexVertically renamed as next... 2019-09-23 17:31:35 +02:00
Émilie Feral
b4f9cbf4b3 [apps/shared] FunctionGraphController: fix confusion (int/float) 2019-09-09 12:12:18 +02:00
Émilie Feral
71e66ad513 [apps/shared] FunctionGraphController: fix moveCursorVertically, t does
not change when the cursor moves VERTICALLY
2019-09-05 14:20:58 +02:00
Léa Saviot
c3ee6a71e7 [apps/graph] Fix computeYRange for polar/cartesian functions
Was very slow, compute only 1000 values to evaluate the yRange
2019-09-03 14:21:14 +02:00
Émilie Feral
a7285ba1ca [apps/graph] Implement defaultCursorT for FunctionGraphController 2019-09-02 16:55:39 +02:00
Émilie Feral
0f43a04225 [apps/graph] Implement move cursor vertically on graph with
parametric/polar curves
2019-08-30 17:15:12 +02:00
Émilie Feral
2d5b60640d [apps/shared] Fix InteractiveCurveViewController::moveCursorVertically
for Sequence and Regression (add a TODO for Graph)
2019-08-30 17:14:26 +02:00
Léa Saviot
fa413edc61 [apps/graph] fix banner view for polar and parametric 2019-08-30 15:04:27 +02:00
Léa Saviot
850170e33b [apps/shared] computeYRange clips tMin..tMax to xMin..xMax if possible 2019-08-30 10:18:39 +02:00
Ruben Dashyan
8957cb9fea [apps/shared/curve_view_range] Define and use x|yCenter accessors 2019-08-29 15:13:41 +02:00
Ruben Dashyan
366daa9c88 [apps] Remove dummy checks in graph/graph_controller and shared/function_graph_controller 2019-08-29 15:13:40 +02:00
Léa Saviot
a945c02edf [poincare/Coordinate2D] Rename members x1 and x2 2019-08-29 11:07:22 +02:00
Léa Saviot
c71ef7ff79 [apps/graph] Evaluation methods renaming 2019-08-29 11:07:22 +02:00
Léa Saviot
28a721e96e [apps] Start fixing apps as cursor has new member variable 2019-08-29 11:07:22 +02:00
Ruben Dashyan
6d7e833a46 [apps/shared/function_banner_delegate] Factor reloadBannerViewForCursorOnFunction 2019-08-29 11:07:21 +02:00
Ruben Dashyan
d171c2a2be [apps/shared/function_graph_controller] Comment about the sampling step in computeYRange 2019-07-30 14:15:08 +02:00
Ruben Dashyan
292493ba36 [apps/*curve_view] Substitute resolution by pixelWidth 2019-07-30 14:15:08 +02:00
Ruben Dashyan
c80baae1e9 [apps/*/curve_view] Remove samplingRatio()
The resolution() method is useful to get a horizontal step equivalent to
the width of a pixel. A higher sampling ratio (or resolution) had been
introduced in the following commit.
[apps] In curve view, avoid white vertical lines in integral curves due to pixel rounding
2019-07-30 14:15:08 +02:00
Ruben Dashyan
503995746a [apps/shared/function_graph_controller] Clean resolution usage in computeYRange 2019-07-30 14:15:08 +02:00
Ruben Dashyan
44809f4b3f Substitute Escher app() by Container::activeApp() 2019-07-19 15:06:25 +02:00
Ruben Dashyan
3e992a3560 [apps] Replace app() by textFieldDelegateApp() in TextFieldDelegates 2019-07-19 15:06:25 +02:00
Ruben Dashyan
ff887ec4a0 [apps/shared] Define static app() accessor in FunctionApp class 2019-07-19 15:06:25 +02:00
Ruben Dashyan
0e1c1a017d [apps] Implement TextFieldDelegate methods in GraphControllers 2019-05-03 15:54:22 +02:00
Ruben Dashyan
94cf542ba3 [apps] Factorize InteractiveCurveViewController::moveCursorVertically 2019-05-03 15:54:21 +02:00
Ruben Dashyan
67f9f79322 [apps] Implement InteractiveCurveViewController::isCursorVisible
It was a pure virtual method implemented in derived classes
  Shared::FunctionGraphController,
  Regression::GraphController.
InteractiveCurveViewRange does not need anymore to hold CurveViewCursor
* m_cursor.
2019-05-03 15:54:21 +02:00
Ruben Dashyan
d8f97d62a4 [apps] Factorize Shared::InteractiveCurveViewController methods
cursorBottomMarginRatio(), displayBottomMarginRatio(),
estimatedBannerHeight() and k_viewHeight moved to
Shared::InteractiveCurveViewController from derived classes.

estimatedBannerNumberOfLines() moved from
Shared::FunctionGraphController to
Shared::InteractiveCurveViewController and implemented in
Regresssion::GraphController.
2019-05-03 15:54:21 +02:00
Ruben Dashyan
0b2ab14ced [apps/shared] Fix a typo in FunctionGraphController
Introduced in commit
[shared] Factorize GraphController::initCursorParameters of Graph and Sequence
2019-05-03 15:54:21 +02:00
Ruben Dashyan
e13651f6fb [apps] Remove Shared::InteractiveCurveViewController::initRangeParameters virtual method 2019-05-03 15:54:21 +02:00
Ruben Dashyan
51bd3312f5 [apps/shared] Clean FunctionGraphController::initRangeParameters()
The method is exactly called once, by
InteractiveCurveViewController::viewWillAppear, which also calls
initCursorParameters afterwards, which in turn calls
selectFunctionWithCursor. Hence the removed lines were redundant.
2019-05-03 15:54:21 +02:00
Ruben Dashyan
e7add02912 [apps] Remove FunctionGraphController::cursorView() virtual method
It was implemented by the Graph and Sequence GraphController derived
classes and was used
  1) in FunctionGraphController::viewWillAppear to set the cursorView
specific to each derived class,
  2) in FunctionGraphController::cursor/displayBottomMarginRatio()
methods.

Instead
  1) the viewWillAppear method of each derived classes sets its
cursorView itself
  2) one may already get the cursorView through curveView().
2019-05-03 15:54:21 +02:00
Émilie Feral
578c65d5dd [shared] Clean class names containing storage 2019-05-03 15:53:20 +02:00
Émilie Feral
ad8fea46c3 [shared] Clean unused classes 2019-05-03 15:53:20 +02:00