From d868c96aa700a5b3adc303a06aaceed6bd0b04dd Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Sat, 14 Apr 2018 01:20:12 -0400 Subject: Sample at the centre of the pixel in brot --- bin/brot.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'bin') diff --git a/bin/brot.c b/bin/brot.c index 1f76fd08..253167ae 100644 --- a/bin/brot.c +++ b/bin/brot.c @@ -57,8 +57,8 @@ void draw(uint32_t *buf, size_t width, size_t height) { double xRatio = (width > height) ? (double)width / (double)height : 1.0; for (size_t y = 0; y < height; ++y) { for (size_t x = 0; x < width; ++x) { - double zx = ((double)x / (double)width - 0.5) * xRatio; - double zy = ((double)y / (double)height - 0.5) * yRatio; + double zx = (((double)x + 0.5) / (double)width - 0.5) * xRatio; + double zy = (((double)y + 0.5) / (double)height - 0.5) * yRatio; buf[y * width + x] = mandelbrot((zx + zy * I) * transform + translate); } } @@ -81,7 +81,7 @@ bool input(char in) { switch (in) { case 'q': return false; break; case '.': depth++; - break; case ',': if (depth) depth--; + break; case ',': if (depth > 1) depth--; break; case 'l': translate += translateStep * transform; break; case 'h': translate -= translateStep * transform; break; case 'j': translate += translateStep * I * transform; -- cgit 1.4.1