diff options
| author | Charles <sircharlesaze@gmail.com> | 2019-08-28 13:57:11 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2019-08-28 13:57:11 +0200 |
| commit | df6e7cbaa0edf2df8b5f3929a2eb34fa2aa5a28c (patch) | |
| tree | b27d14df93691892c8e906435b8c4ee9ac46b5bc /mandelbrot.c | |
| parent | ff61da6fb9720106d7869a0e5026810450d8f515 (diff) | |
| download | mandelbrot_cpu-df6e7cbaa0edf2df8b5f3929a2eb34fa2aa5a28c.tar.gz mandelbrot_cpu-df6e7cbaa0edf2df8b5f3929a2eb34fa2aa5a28c.tar.bz2 mandelbrot_cpu-df6e7cbaa0edf2df8b5f3929a2eb34fa2aa5a28c.zip | |
Proportionnal movement and zoom
Zooming and moving is proportionnal to the range we are viewing,
feels more natural than incrementing by a constant value.
Diffstat (limited to 'mandelbrot.c')
| -rw-r--r-- | mandelbrot.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/mandelbrot.c b/mandelbrot.c index 51d6648..d44b12b 100644 --- a/mandelbrot.c +++ b/mandelbrot.c @@ -3,9 +3,13 @@ #include <complex.h> #include "header.h" +#define PRINT_REAL_LO -2.0 +#define PRINT_REAL_HI 2.0 +#define PRINT_IMAG_LO -2.0 +#define PRINT_IMAG_HI 2.0 #define AXIS_DIV 46.0 -#define REAL_AXIS_STEP ((REAL_HI - REAL_LO) / AXIS_DIV) -#define IMAG_AXIS_STEP ((IMAG_HI - IMAG_LO) / AXIS_DIV) +#define REAL_AXIS_STEP ((PRINT_REAL_HI - PRINT_REAL_LO) / AXIS_DIV) +#define IMAG_AXIS_STEP ((PRINT_IMAG_HI - PRINT_IMAG_LO) / AXIS_DIV) #define IN_CHAR '*' #define OUT_CHAR ' ' @@ -25,9 +29,9 @@ int mandelbrot_in_set(double complex c) void mandelbrot_print(void) { - for (double i = IMAG_LO; i < IMAG_HI; i += IMAG_AXIS_STEP) + for (double i = PRINT_IMAG_LO; i < PRINT_IMAG_HI; i += IMAG_AXIS_STEP) { - for (double r = REAL_LO; r < REAL_HI; r += REAL_AXIS_STEP) + for (double r = PRINT_REAL_LO; r < PRINT_REAL_HI; r += REAL_AXIS_STEP) { if (mandelbrot_in_set(r + i * I) == -1) putchar(IN_CHAR); |
