From 8e5bc917659288a257d5de9827458039f5498ef5 Mon Sep 17 00:00:00 2001 From: Leonard Kugis Date: Tue, 23 Jan 2018 01:08:38 +0100 Subject: OpenGL rendering added, cleaned up paths --- src/sets.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/sets.c') diff --git a/src/sets.c b/src/sets.c index 6787a6e..2c01987 100644 --- a/src/sets.c +++ b/src/sets.c @@ -7,9 +7,9 @@ #include "sets.h" -u32 mandelbrot_s(double x, double y, u32 iterations) +u32 mandelbrot_s(long double x, long double y, u32 iterations) { - double cx = x, cy = y, x2; + long double cx = x, cy = y, x2; u32 m = 0; while(m <= iterations && (x*x)+(y*y) <= 4) { @@ -21,16 +21,16 @@ u32 mandelbrot_s(double x, double y, u32 iterations) return m; } -u32 mandelbrot_r(double x, double y, u32 iterations) +u32 mandelbrot_r(long double x, long double y, u32 iterations) { return _mandelbrot_r(x, y, 0.0, 0.0, 0, iterations, 4.0); } -u32 _mandelbrot_r(double x, double y, double zx, double zy, u32 n, u32 iterations, double threshold) +u32 _mandelbrot_r(long double x, long double y, long double zx, long double zy, u32 n, u32 iterations, long double threshold) { - if ((n <= iterations) && ((zx * zx + zy * zy) < threshold)) { - double zx_new = (zx * zx - zy * zy + x); - double zy_new = (2 * zx * zy + y); + if ((n < iterations) && ((zx * zx + zy * zy) < threshold)) { + long double zx_new = (zx * zx - zy * zy + x); + long double zy_new = (2 * zx * zy + y); if ((zx_new == zx) && (zy_new == zy)) { return iterations; } @@ -39,7 +39,7 @@ u32 _mandelbrot_r(double x, double y, double zx, double zy, u32 n, u32 iteration return n; } -u32 julia(double x, double y, u32 iterations) +u32 julia(long double x, long double y, u32 iterations) { // TODO: Julia-Menge return 0; -- cgit v1.2.1