diff --git a/kicad/stm32card/stm32card-backups/stm32card-2025-03-16_234857.zip b/kicad/stm32card/stm32card-backups/stm32card-2025-03-16_234857.zip deleted file mode 100644 index 5f752b4..0000000 Binary files a/kicad/stm32card/stm32card-backups/stm32card-2025-03-16_234857.zip and /dev/null differ diff --git a/kicad/stm32card/stm32card-backups/stm32card-2025-03-24_192551.zip b/kicad/stm32card/stm32card-backups/stm32card-2025-03-24_192551.zip new file mode 100644 index 0000000..c3bc033 Binary files /dev/null and b/kicad/stm32card/stm32card-backups/stm32card-2025-03-24_192551.zip differ diff --git a/recon/screen_tests_c/main.c b/recon/screen_tests_c/main.c new file mode 100644 index 0000000..be7b240 --- /dev/null +++ b/recon/screen_tests_c/main.c @@ -0,0 +1,108 @@ +#include +#include +#include + +#define RES_X 160 +#define RES_Y 80 +#define DEFAULT_CENTER_X 0 +#define DEFAULT_CENTER_Y 0 +#define MOUSE_BUTTON 0 +#define STEP_SIZE .25 +#define ZOOM_SIZE .25 + +#define INFTY 4 +#define INFTY_SQR INFTY * INFTY +#define ITERS 8 + +struct camera { + double min_r, min_i, max_r, max_i; +}; + +//god damb maybe I shoulda made a vector class +void shift_cam(struct camera *cam, double step_r, double step_i) { + double i_offset = (cam->max_i - cam->min_i) * step_i; + double r_offset = (cam->max_r - cam->min_r) * step_r; + cam->min_i += i_offset; + cam->max_i += i_offset; + cam->min_r += r_offset; + cam->max_r += r_offset; +} + +void zoom_cam(struct camera *cam, double zoom) { + double i_scale = (cam->max_i - cam->min_i) * zoom; + double r_scale = (cam->max_r - cam->min_r) * zoom; + cam->min_i += i_scale; + cam->max_i -= i_scale; + cam->min_r += r_scale; + cam->max_r -= r_scale; +} + +int main() { + int key_pressed; + struct camera cam = { + .min_r = -1, + .max_r = 1, + .min_i = -1, + .max_i = 1 + }; + InitWindow(160, 80, "mandelbrot fixed point test"); + + Image img = GenImageColor(RES_X, RES_Y, BLUE); + Texture tex = LoadTextureFromImage(img); + + SetTargetFPS(30); + while(!WindowShouldClose()) { + if(key_pressed = GetKeyPressed()) { + switch(key_pressed) { + case KEY_UP: + shift_cam(&cam, 0, STEP_SIZE); + break; + case KEY_DOWN: + shift_cam(&cam, 0, -STEP_SIZE); + break; + case KEY_RIGHT: + shift_cam(&cam, STEP_SIZE, 0); + break; + case KEY_LEFT: + shift_cam(&cam, -STEP_SIZE, 0); + break; + case KEY_W: + printf("a\n"); + zoom_cam(&cam, ZOOM_SIZE); + break; + case KEY_S: + zoom_cam(&cam, -ZOOM_SIZE); + break; + default: + break; + } + printf("(%f, %f) - (%f, %f)\n", cam.min_r, cam.min_i, cam.max_r, cam.max_i); + } + { + double scale_i = (cam.max_i - cam.min_i) / (double)GetScreenHeight(); + double scale_r = (cam.max_r - cam.min_r) / (double)GetScreenWidth(); + double c_i = cam.min_i; + double c_r = cam.min_r; + double z_i = 0; + double z_r = 0; + for(int y = 0; y < RES_Y; y++) { + for(int x = 0; x < RES_Y; x++) { + for(int i = 0; i < ITERS; i++) { + + if(pow(c_i, 2) + pow(c_r, 2) >= INFTY_SQR) { + break; + } + } + c_r += scale_r; + } + c_i += scale_i; + } + } + + BeginDrawing(); + DrawTexture(tex, 0, 0, WHITE); + EndDrawing(); + } + + return 0; +} diff --git a/recon/screen_tests_c/makefile b/recon/screen_tests_c/makefile new file mode 100644 index 0000000..f01bedb --- /dev/null +++ b/recon/screen_tests_c/makefile @@ -0,0 +1,6 @@ +.default: make +make: + gcc main.c -o mandelbrot -lraylib + +clean: + rm -f mandelbrot diff --git a/recon/screen_tests_c/mandelbrot b/recon/screen_tests_c/mandelbrot new file mode 100755 index 0000000..fcb80a4 Binary files /dev/null and b/recon/screen_tests_c/mandelbrot differ