xor (x, y)
"Hey, this looks like a cool pattern to _quickly_ implement..."
Famous last words.
Is bitwise_xor () a valid numeric expression for POV-Ray functions? Nope.
So I had to make a function to grab the kth bit of the binary representation of
decimal integer N.
Then an xor function.
Then a function that reassembles the xor'd bits into a decimal value.
Then puzzle out how to properly visualize that in a pigment {function {}}
statement, given all the things peculiar to POV-Ray.
All in all quite a bit longer than I expected it to take.
Perhaps consider adding (probably under-the-hood) dec2bin conversion functions.
Also binary functions, taking decimal arguments.
You may just want to have generic binary functions that take 2 arguments - the
number as an argument, plus the base the argument is in (maybe hex).
Or maybe there's a whole other system of doing all that, which makes more sense.
- BW
Post a reply to this message
Attachments:
Download 'mathpatterns1.png' (122 KB)
Preview of image 'mathpatterns1.png'
![mathpatterns1.png](/povray.unofficial.patches/attachment/%3Cweb.65a05833d9619d9a1f9dae3025979125%40news.povray.org%3E/mathpatterns1.png?preview=1)
|