Fixed tricorn_V3.c to correctly handle complex numbers and add threaded V4 skeleton

This commit is contained in:
Yashar Alan Zenker
2026-07-04 15:28:51 +02:00
parent c1bbaf7eda
commit b630fa965e
4 changed files with 93 additions and 8 deletions
+3 -4
View File
@@ -15,16 +15,15 @@ static unsigned converge(float complex position,unsigned n);
*/
void tricorn_V3(float complex start, size_t width, ssize_t height, float res, unsigned n, _Bool color, unsigned char* img){
// Absolute height for iteration purposes
unsigned imag_direction = height < 0 ? -1 : 1;
height = height < 0 ? height*-1 : height;
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 - imag_direction*j*res),n);
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;