diff options
| author | Charles <sircharlesaze@gmail.com> | 2019-08-27 19:04:34 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2019-08-27 19:04:34 +0200 |
| commit | ce5cf1b60dae81540b2db366b1408a961f771dcc (patch) | |
| tree | 25de8dc9727deb188f57fe01c2cf7575d5fbb4bc /mandelbrot.c | |
| parent | 7c48d434f0a68ac47ebe1bd66daa2c86842979c7 (diff) | |
| download | mandelbrot-ce5cf1b60dae81540b2db366b1408a961f771dcc.tar.gz mandelbrot-ce5cf1b60dae81540b2db366b1408a961f771dcc.tar.bz2 mandelbrot-ce5cf1b60dae81540b2db366b1408a961f771dcc.zip | |
Set visualization
Loop throught each pixel and color it black if its in the set,
white otherwise.
This is eavily inspired by the coding train video on the subject.
(https://www.youtube.com/watch?v=6z7GQewK-Ks)
Diffstat (limited to 'mandelbrot.c')
| -rw-r--r-- | mandelbrot.c | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/mandelbrot.c b/mandelbrot.c index 053ce70..c5f5148 100644 --- a/mandelbrot.c +++ b/mandelbrot.c @@ -1,28 +1,11 @@ #include <stdio.h> #include <math.h> #include <complex.h> - -#define LO -1.7 -#define HI 1.7 -#define AXIS_DIV 46.0 -#define AXIS_STEP ((HI - LO) / AXIS_DIV) - -#define MAX_ITERATION 1000 -#define _INFINITY 1000 +#include "header.h" #define IN_CHAR '*' #define OUT_CHAR ' ' -/* -#define SQUARE(x) (pow((x), 2)) -#define SQUARE_CML(z) (SQUARE(creal(z)) - SQUARE(cimag(z)) + 2 * creal(z) * cimag(z) * I) - -double magnitude(double complex z) -{ - return sqrt(SQUARE(creal(z)) + SQUARE(cimag(z))); -} -*/ - double mandelbrot_in_set(double complex c) { int i; @@ -52,3 +35,9 @@ void mandelbrot_print(void) } } +/* +#define SQUARE(x) (pow((x), 2)) +#define SQUARE_CML(z) (SQUARE(creal(z)) - SQUARE(cimag(z)) + 2 * creal(z) * cimag(z) * I) + +double magnitude(double complex z) { return sqrt(SQUARE(creal(z)) + SQUARE(cimag(z))); } +*/ |
