POV-Ray : Newsgroups : povray.unofficial.patches : yuqk feature requests / suggestions : Re: yuqk feature requests / suggestions Server Time
27 Jul 2024 08:13:04 EDT (-0400)
  Re: yuqk feature requests / suggestions  
From: Bald Eagle
Date: 11 Jan 2024 16:10:00
Message: <web.65a05833d9619d9a1f9dae3025979125@news.povray.org>
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


 

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.