Fixed tricorn_V3.c to adjust mathematical direction based on height sign
This commit is contained in:
@@ -16,6 +16,7 @@ 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;
|
||||
unsigned bytesPerColor = color ? 3 : 1;
|
||||
|
||||
@@ -23,7 +24,7 @@ void tricorn_V3(float complex start, size_t width, ssize_t height, float res, un
|
||||
for(size_t i = 0; i < width; i++){
|
||||
for(ssize_t j = 0; j < height; j++){
|
||||
|
||||
unsigned value = converge(start + (i*res - I*j*res),n);
|
||||
unsigned value = converge(start + (i*res - imag_direction*j*res),n);
|
||||
|
||||
// Pixel value position in the output array
|
||||
size_t position = (j*width +i) * bytesPerColor;
|
||||
|
||||
Reference in New Issue
Block a user