From eea437dc84d2906b615fc243bb44cec57255fbe9 Mon Sep 17 00:00:00 2001 From: leo Date: Sun, 5 Mar 2023 18:36:32 -0300 Subject: First Commit --- Random/mandelbrot.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 Random/mandelbrot.c (limited to 'Random/mandelbrot.c') diff --git a/Random/mandelbrot.c b/Random/mandelbrot.c new file mode 100644 index 0000000..9f8a796 --- /dev/null +++ b/Random/mandelbrot.c @@ -0,0 +1,55 @@ +#include +#include +#include +#include +#define ite 500 + +double map(double x, double p1, double p2, double c1, double c2); +double mandel(double y, double x); + +int main(){ + const int dimx = 800, dimy = 800; + int i, j; + FILE *fp = fopen("out.ppm", "wb"); + + fprintf(fp, "P6\n%d %d\n255\n", dimx, dimy); + int c; + unsigned char color[3]; + unsigned char temp; + for(j=-dimy/2; j 4) + break; + } + + return map(i, ite, 0, 0, 255); +} + + +double map(double x, double p1, double p2, double c1, double c2){ + return 1.0*(x-p1)*(c2-c1)/(p2-p1) + c1; +} \ No newline at end of file -- cgit v1.2.3