|
diff --git a/engine.c b/engine.c index 5188fbd..ada3756 100644 --- a/ engine.c+++ b/ engine.c |
@@ -23,6 +23,13 @@ static void highlight_line(int value, int y, int max_x, uint32_t color); |
23 | static int64_t |
23 | static int64_t |
24 | engine_normalize(int height, int y) |
24 | engine_normalize(int height, int y) |
25 | { |
25 | { |
| |
26 | /* |
| |
27 | double xf = ((double)x) / 100.0f; |
| |
28 | double yf = g_normalize_factor * (xf*xf-xf) + xf; |
| |
29 | y = ax^2 + x - ax = a * (x^2 - x) + x |
| |
30 | int y = scale(g_min_y + (int)(((double)height) * yf)); |
| |
31 | */ |
| |
32 | |
26 | int64_t yf = (y << 16) / height; |
33 | int64_t yf = (y << 16) / height; |
27 | yf = (((yf * yf - (yf << 16)) * ((int64_t)g_normalize_factor))) + (yf << 32); |
34 | yf = (((yf * yf - (yf << 16)) * ((int64_t)g_normalize_factor))) + (yf << 32); |
28 | return (((int64_t)height) * yf) >> 32; |
35 | return (((int64_t)height) * yf) >> 32; |
@@ -58,17 +65,6 @@ engine_redraw() |
58 | |
65 | |
59 | for (int x=0; x<height; x+=20) { |
66 | for (int x=0; x<height; x+=20) { |
60 | int y = engine_normalize(height, x); |
67 | int y = engine_normalize(height, x); |
61 | /* |
| |
62 | int64_t xf = (x << 16) / 100; |
| |
63 | int64_t yf = (((xf * xf - (xf << 16)) * ((int64_t)g_normalize_factor))) + (xf << 32); |
| |
64 | int64_t yo = (((int64_t)height) * yf) >> 48; |
| |
65 | |
| |
66 | double xf = ((double)x) / 100.0f; |
| |
67 | double yf = g_normalize_factor * (xf*xf-xf) + xf; |
| |
68 | y = ax^2 + x - ax = a * (x^2 - x) + x |
| |
69 | int y = scale(g_min_y + (int)(((double)height) * yf)); |
| |
70 | */ |
| |
71 | |
| |
72 | display_line_color(0, scale(g_min_y + (y>>16)), MAX_X, scale(g_min_y + (y>>16)), 0x1f1f1f1f); |
68 | display_line_color(0, scale(g_min_y + (y>>16)), MAX_X, scale(g_min_y + (y>>16)), 0x1f1f1f1f); |
73 | if (y >> 16 > (tos2 * height) / 100 ) |
69 | if (y >> 16 > (tos2 * height) / 100 ) |
74 | t1++; |
70 | t1++; |
|