Commit Graph

176 Commits

Author SHA1 Message Date
Hugo Saint-Vignes
83722342f7 [apps/statistics] Reload CurveView before drawing histogram labels 2021-01-05 16:43:01 +01:00
Hugo Saint-Vignes
a42208f773 [apps/shared] Handle null labelStep in numberOfLabels 2021-01-05 16:33:48 +01:00
Hugo Saint-Vignes
990c45b661 [apps/shared] Prevent label method from being called on uninitialized chars 2021-01-05 11:38:21 +01:00
Hugo Saint-Vignes
1939293cd2 [apps/shared] Add margin to avoid visible approximation errors 2020-12-21 16:12:27 +01:00
Léa Saviot
7f6a3f0fc1 [apps/curve_view] Fix KDCoordinate overflow
Scenario: (with the current auto zoom algorithm)
Graph f(x) = x! -> Auto axes are x=[-13,17647;13,17647],
y=[3628793;2628807]
Press "0" "EXE" to go to x = 0 -> Axes are x=[-13,17647;13,17647],
y=[-0.8612717;13.13873]
Press auto
Press "0" "EXE" to go to x = 0 -> the assertion about KDCoordinates
breaks.
2020-11-04 15:58:43 +01:00
Hugo Saint-Vignes
2f97dab6d1 [apps/shared] Add toggle buttons in Graph view
Change-Id: I7548d11fb114b2605ce34d3bda0776277b79ff9d
2020-11-04 15:58:25 +01:00
Hugo Saint-Vignes
4acbf3346b [apps/shared] Add comments and minimize threshold
Change-Id: Ieb56513ea0a7fab35acf15531277aec5cd6071ca
2020-11-04 15:58:03 +01:00
Hugo Saint-Vignes
ebe207d67d [apps/shared] Fix cache overlap when plotting polar curves
Change-Id: I4b1d6dccdedc5b3cea455e2ad2038336b4b48064
2020-11-04 15:55:40 +01:00
Émilie Feral
64ff5b4c70 [app/shared] CurveView: simplify implementation of
pixelLengthToFloatLength (avoid avoidable overflows)
2020-11-04 15:33:03 +01:00
Émilie Feral
5b4fc6ff84 [apps/shared] CurveView: implement CurveView::pixelLength(Axis) 2020-11-04 15:33:03 +01:00
Émilie Feral
d6751e6e03 [apps/shared] CurveView: improve floatLengthToPixelLength to avoid
useless computations (and potential overflowing)

This fixes the drawing of arrow(100,100,0.1,3) in matplotlib module of
python
2020-11-04 15:33:02 +01:00
Hugo Saint-Vignes
c130f8e881 [apps/shared] Prevent KDPoint overlfowed translation on cursorFrame
Change-Id: Ifc32eefaf4241d59d7567cadb9b2962ba5efb4d9
2020-11-04 15:32:59 +01:00
Hugo Saint-Vignes
e199143412 [apps/shared/curve_view] Small binary code size optimization
Change-Id: I4b61506edb434cb901a6fb92ef5c145f43c51035
2020-11-04 15:32:57 +01:00
Hugo Saint-Vignes
59d5adace3 [apps/shared] Optimize polar curve range display
Change-Id: Ic1b044212711d1f73e147cb0857084ff9d61fbd9
2020-11-04 15:30:53 +01:00
Hugo Saint-Vignes
0e11760f08 [apps/shared/curve_view] Improving performances for non cartesian curves
Change-Id: Ie1a9a6450e8f92ceaf93c5fe78711640be175e9e
2020-11-04 15:16:55 +01:00
Hugo Saint-Vignes
0322a1a6a7 [apps/shared] Fix draw curve issues when tStep << tStart
Change-Id: Iaf054cff1f78f3c800564a0e6c133192bdfab260
2020-11-04 15:11:43 +01:00
Hugo Saint-Vignes
e27c668c40 [apps,escher,kandinsky,poincare,python] Replace every "grey" with "gray"
Change-Id: I60a232849dce90f70e6977b6024d6e9b1ce1b731
2020-11-04 15:07:20 +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
95fef86ec0 [apps/graph] Activated caching for graph drawing
Added a default argument to CurveView::drawCurve : a function to initiate the
memoization of continuous functions. The function is implemented in
ContinuousFunctionCache and provided by GraphView. This should be invisible
to other types of curves that rely on CurveView::drawCurve.

Change-Id: I59aa55d67154b6d4bf9614b7ed87c48408773d86
2020-11-04 15:00:43 +01:00
Gabriel Ozouf
c71b2dee99 [curve_view] Factor bounding box code for joinDots
Change-Id: Iae974aa2bee12e6c56bad84fd3b45093fb2a856f
2020-10-23 08:56:56 +02:00
Gabriel Ozouf
26fdfcd25c [curve_view] Fixed variable names
Change-Id: I8aad13c6bce719ba8f3a30cd86f06f7c89ec041e
2020-10-23 08:56:56 +02:00
Gabriel Ozouf
fe8e490ac0 [curve_view] Filter unwanted vertical asymptotes
Change-Id: Ia603a2fb1553b6dfc038d2a28472ce48e41936db
2020-10-23 08:56:56 +02:00
Gabriel Ozouf
106916e7bf [curve_view] Add double evaluation
Add the possibility to use a double-typed evaluator when tracing a
curve, useful when errors caused by float approximation mess with the
drawing.

Change-Id: I3ab410deec4823149239b0a26b1885fd2a493226
2020-10-23 08:56:56 +02:00
Émilie Feral
c91c2a6e3f [app/shared] CurveView: Avoid dashSize overflow in
drawHorizontalOrVerticalSegment
2020-10-12 09:48:55 +02:00
Émilie Feral
8e025b0823 [apps/shared] CurveView: avoid overflowing KDCoordinate
This fixes the following bug: add the sequence, u(n)=2^n. On the graph,
go to "sum of terms" and try to sum terms from 0 to 18 by moving the
cursor. It hangs.
2020-10-12 09:48:55 +02:00
Léa Saviot
72e342e1b1 [apps/curve_view] Fix drawArrow
Compute everything in pixels + fix glitch when zooming on the tip of
arrow(0,0,2,3)
2020-06-04 14:58:20 +02:00
Émilie Feral
420dd04766 [apps/shared][python/port] CurveView::drawArrow uses pixel computation
instead of float computation to avoid precision errors, by default the
arrow size is decided in pixels.
2020-06-04 14:50:10 +02:00
Émilie Feral
c826c53659 [apps/shared] CurveView: change drawArrow API to take arrow shape
arguments in float instead of coordinates
2020-06-04 14:50:09 +02:00
Émilie Feral
e92b56b78e [apps/shared] CurveView: change drawArrow arguments (new definition of
arrow shape)
2020-06-04 14:50:09 +02: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
633776b92f [apps/shared] Fix CurveView::drawArrow on arrow without orientation 2020-04-01 11:46:25 +02:00
Émilie Feral
9e822e85e5 [apps/shared] CurveView: implement drawArrow 2020-04-01 10:18:08 +02:00
Émilie Feral
aaf71328ba [apps/shared] CurveView: resolve name conflict -
drawHorizontalOrVerticalSegment & drawSegment -
2020-04-01 10:18:08 +02:00
Romain Goyet
a3b1b51f75 [pyton/matplotlib] Support plot 2020-04-01 10:18:08 +02:00
Léa Saviot
bd0b9f8a4a [apps/curve_view] Fix typo
The labels would not float on the right of the display
2020-03-31 15:16:39 +02:00
Neven Sajko
aae5e49c01 Remove useless uses of const for return types
An integer or float value can not be assigned to, so there is no point
in qualifying it as const.
2020-03-02 09:48:23 +01:00
Émilie Feral
d61336936e [apps/shared] Create a class Dots to share dots masks between CurveView
and RoundCursorView. Use the same dot for illustrations of additional
results in Calculation app and Function app
2020-02-12 15:13:21 +01:00
Émilie Feral
06fa3bba5b [apps/shared][apps/calculation] CurveView: enable to personalize the
maximal glyph length of graduation labels. Shorten them in
ComplexGraphView
2020-02-12 15:13:21 +01:00
Émilie Feral
21f3cd629d [apps/shared] CurveView: fix drawLabelsAndGraduations
Fix following bug: when handling label = "0", not shifted,
the label position should be computed as for the other labels.
2020-02-12 15:13:21 +01:00
Émilie Feral
c6e54f90c3 [apps/shared] CurveView: fix confusion between after/before relative
position in drawLabel
2020-02-12 15:13:20 +01:00
Émilie Feral
800adce876 [apps/shared] CurveView: change API; drawLabel can draw a label at a
position and the relative position of the label (above, below, to the
left or right of the graduation) can be chosen. 'positionLabel' is a
private method used by 'drawLabelsAndGraduations' and 'drawLabel' to
determine the position of the label knowing the position of the
graudation and its relative position
2020-02-12 15:13:20 +01:00
Émilie Feral
17bc808257 [apps/shared] CurveView: fix drawLabelsAndGraduations when
graduationOnly is on: the graduation are not drawn only when outside of
the drawn rect
2020-02-12 15:13:20 +01:00
Émilie Feral
95137909c6 [apps/shared] CurveView: fixes drawLabelsAndGraduations when the 'fixCoordinate' parameter is true.
This fixes the graduation drawing of the box view in the statistics app
2020-02-12 15:13:20 +01:00
Émilie Feral
29bab70dcd [apps/shared] CurveView: add a parameter "color" to drawLabel 2020-02-12 15:13:20 +01:00
Émilie Feral
dfd4811136 [apps/shared] CurveView: change API to expose 'drawLabel' and
'drawLabelsAndGraduations'
2020-02-12 15:13:20 +01:00
Émilie Feral
98c6f4ba47 [apps/shared] CurveView: factorize code of drawLine and drawSegment 2020-02-12 15:13:20 +01:00
Émilie Feral
818067e03b [apps/shared] CurveView: add a parameter to drawSegment to draw dashed
segment
2020-02-12 15:13:20 +01:00
Émilie Feral
b47ded4074 [apps/calculation] Add a parameter in Shared::CurveView to choose the
curve thickness
2020-02-12 15:13:20 +01:00