diff options
author | June McEnroe <june@causal.agency> | 2018-04-14 01:20:12 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2018-04-14 01:20:12 -0400 |
commit | 877d771b4900f7e36a5302ef7d9d6d518e9f044e (patch) | |
tree | 5b1768ae8d69a3b256a62248fc27012892b3cd93 | |
parent | Apply brot color in a second pass and time frames (diff) | |
download | src-877d771b4900f7e36a5302ef7d9d6d518e9f044e.tar.gz src-877d771b4900f7e36a5302ef7d9d6d518e9f044e.zip |
Sample at the centre of the pixel in brot
-rw-r--r-- | bin/brot.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/bin/brot.c b/bin/brot.c index ac54be56..f066414e 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; |