From 0bf4d41fbd466314e7f2317cbdda7c8f90f2b6c8 Mon Sep 17 00:00:00 2001 From: Nikola Date: Mon, 13 Jul 2026 23:16:10 +0200 Subject: [PATCH] Removed: tricorn_V1 as it is an unsiutable comparison --- Implementierung/tricorn_V1.c | 61 ------------------------------------ 1 file changed, 61 deletions(-) delete mode 100644 Implementierung/tricorn_V1.c diff --git a/Implementierung/tricorn_V1.c b/Implementierung/tricorn_V1.c deleted file mode 100644 index e1d0684..0000000 --- a/Implementierung/tricorn_V1.c +++ /dev/null @@ -1,61 +0,0 @@ -#include "tricorn_V1.h" - -static const float convergenceLimit = 2.0f; // Mandelbrot set limit -static unsigned converge(float complex position,unsigned n); - -/** - * @brief Generates a Tricorn fractal image using the standard, unoptimized scalar implementation for benchmarking comparison (Version 2). - * @param start The starting complex coordinate (bottom-left or top-left depending on height sign). - * @param width The width of the target image in pixels. - * @param height The height of the target image. A negative height reverses the Y-axis calculation. - * @param res The step size (resolution) per pixel in the complex plane. - * @param n The maximum number of mathematical iterations per pixel. - * @param color If true, generates a 24-bit RGB image. If false, writes a grayscale image. - * @param img Pointer to the pre-allocated memory buffer where the bitmap data will be stored. - */ -void tricorn_V1(float complex start, size_t width, ssize_t height, float res, unsigned n, _Bool color, unsigned char* img){ - - float imag_direction = height < 0 ? -1.0f : 1.0f; - unsigned bytesPerColor = color ? 3 : 1; - height = height < 0? -height : height; - - // Simple iteration over every pixel in the picture - for(size_t i = 0; i < width; i++){ - for(ssize_t j = 0; j < height; j++){ - - unsigned value = converge(start + (i*res - I* imag_direction*j*res),n); - - // Pixel value position in the output array - size_t position = (j*width +i) * bytesPerColor; - - - if(!color){ // Grayscale colors as specified by the assignment r = g = b - img[position] = value; - } - else{ // Temporary colors with random multipliers - img[position] = ((value*3) % 255); - img[position + 1] = ((value*2) % 255) ; - img[position + 2] = ((value*5) % 255); - } - - } - } -} - -// Iterative application of the equation given by the assignment -static unsigned converge(float complex position,unsigned n){ - - complex float result = 0; - for(unsigned i = 0; i < n; i++){ - // Detection of unbounded behaviour - // If the magnitude of the result vector is greater than the convergence limit, we know that the function will grow unbounded - // Current convergence limit taken from mandelbrot set - if(sqrtf(powf (crealf(result),2)+powf(cimagf(result),2)) > convergenceLimit) - return 255-4*(i % 64); - - // Application of the given complex equation with m = 2 - result = cpowf(conjf(result),2) + position; - - } - return 0; -} \ No newline at end of file