chore(math): tune cubic-bezier precison to 10bits

10 bits is already enough for normally used ease functions(ease, ease-in, ease-out, ease-in-out).
14 bits provides more accuracy and requires additional shift operation.
>14bits provices more accuracy but requires 64bit calculation and additional shift operation.

Add normally used ease function in test.

Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
This commit is contained in:
Neo Xu
2023-06-18 15:40:33 +08:00
committed by Gabor Kiss-Vamosi
parent b374282e23
commit 043c48761f
3 changed files with 109 additions and 110 deletions

View File

@@ -75,17 +75,6 @@ uint32_t lv_bezier3(uint32_t t, uint32_t u0, uint32_t u1, uint32_t u2, uint32_t
*/
int32_t lv_cubic_bezier(int32_t x, int32_t x1, int32_t y1, int32_t x2, int32_t y2);
/**
* Calculate the y value of cubic-bezier(x1, y1, x2, y2) function as specified x.
* @param x time in range of [0..1]
* @param x1 x of control point 1 in range of [0..1]
* @param y1 y of control point 1 in range of [0..1]
* @param x2 x of control point 2 in range of [0..1]
* @param y2 y of control point 2 in range of [0..1]
* @return the value calculated
*/
float lv_cubic_bezier_f(float x, float x1, float y1, float x2, float y2);
/**
* Calculate the atan2 of a vector.
* @param x