r/fractals • u/jacob_ewing • 1d ago
XOR
I was trying to make an icon and got this when fiddling with the settings. The checker pattern comes from XORing z - c against zi - ci.
I've used that before, but I found this one rather striking.
2
u/FowlOnTheHill 1d ago
Could you explain what you are XORing? A one bit image?
2
u/jacob_ewing 19h ago
Sure. So, you know how in the Mandelbrot set, you start off with a coordinate that you're rendering (c, ci), and repeatedly use it recalculating another point (z, zi). It ends when either (z, zi) falls outside of a radius of 2 or when a maximum number of iterations has been reached.
In this case, when the loop is done, it takes the displacement between (c, ci) and (z, zi), scales it up, XORs the rounded values together, scales it back down, and adds that resulting scalar to the count, which is then used to calculate colour.
If you want to check out the code, I have it up on github at https://github.com/jacobEwing/webtoys/tree/main/mandelbrot
The function that does this work is createColour, defined near the top of mandelbrot.js, and the key line is this one:
count += config.options.coefficients.displacementXOR * ((config.map.accuracy * (countInfo.zi - countInfo.ci)) ^ (config.map.accuracy * (countInfo.z - countInfo.c))) / (config.map.accuracy);2
u/FowlOnTheHill 19h ago
Thank you! It didn’t occur to me that the zi and ci were the imaginary components. Thats neat! I’ll have to play with that!
2
2


3
u/Bulky_Nature_3861 1d ago
Looks like a chessboard! Do you have any more color schemes?