From 64e5d90a022f19711f4a972a491d17f180012fa5 Mon Sep 17 00:00:00 2001 From: sbosse Date: Mon, 14 Oct 2024 23:10:05 +0200 Subject: [PATCH] Mon 14 Oct 23:09:15 CEST 2024 --- user/fractal.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 user/fractal.c diff --git a/user/fractal.c b/user/fractal.c new file mode 100644 index 0000000..5dd771f --- /dev/null +++ b/user/fractal.c @@ -0,0 +1,79 @@ +/* +Copyright (C) 2016-2019 The University of Notre Dame +This software is distributed under the GNU General Public License. +See the file LICENSE for details. +*/ + + +#include "library/syscalls.h" +#include "library/string.h" +#include "library/nwindow.h" + +#define MAX_ITERS 2000 + +int in_set( float x, float y ); +void plot_point(int iter, int j, int k); + +struct nwindow *nw = 0; + +int main(int argc, char *argv[]) +{ + /* Setup the window */ + nw = nw_create_default(); + + int xsize = nw_width(nw); + int ysize = nw_height(nw); + + nw_clear(nw,0,0,xsize,ysize); + + float xlow = -2.0; + float ylow = -1.5; + float xfactor = 2.5/xsize; + float yfactor = 3.0/ysize; + + + /* For each point, see if it is in the Mandelbrot set */ + int iter,i,j; + + for(i=0;i