Welcome to Fractal Forums

Fractal Math, Chaos Theory & Research => (new) Theories & Research => Topic started by: DarkBeam on January 27, 2015, 11:24:09 AM




Title: Infinitized (Sierpinski) fold using bitwise operators
Post by: DarkBeam on January 27, 2015, 11:24:09 AM
This type of fold is totally new.
The idea is to add a fractal level to Tglad's Mandelbox without heavy job for the CPU.
To do so we could exploit the floating point structure that is "sierpinski like" if you think about it. (Yes really I am that insane :D )

In fact fp numbers are structured like...
(Sign)(Exponent)(Mantissa)

If you can fold the mantissa preserving the exponent you can get a fractal fold  :evil1:

It is definitely not as easy as it seems too bad.

But I was able to do it! Now suppose to define some constants. If you use doubles, they must have the same size. But you set directly their bits not their value!
SEXP contains the bits of Sign and Exp. all on. If you use double they are dwords in 32 bit machines. So SEXP = 0xFFF00000 00000000
SEXP_parity is its "parity bit"= 0x00100000 00000000
Nbits is the number of bits turned on in SEXP... but - 1. Count them :P

Okay so... the code is this

Code:
x = x / foldl; // user defined
const SE1 = 1.0f and SEXP;
const mantissa = not SEXP;
// x is a coordinate you want to fold
if (x>2 or x<-2) {
   m = SE1 xor (x and signbit); // you can really find signbit DON'T YOU :D
   n = x; // Save the sign without splitting
} else {
   m = x and SEXP;
   n = x and mantissa;
   n = n xor SE1; // Split x in two parts
}
n = abs(n);
n = 0.5 - abs(x-1.5);
// but we must restore sign and exponent so...
x = m * n;
m = m and SEXP_parity; // or SEXP for that matters?
shl( m, Nbits ); // make it a sign shifting bits
x = x xor m; // now it has alternate signs DONE!
x = x * foldl;

Very hackish. And proud :) enjoy!


Title: Re: Infinitized (Sierpinski) fold using bitwise operators
Post by: cKleinhuis on January 27, 2015, 11:40:24 AM
so, where is the pretty picture ???


Title: Re: Infinitized (Sierpinski) fold using bitwise operators
Post by: DarkBeam on January 27, 2015, 11:43:14 AM
 :tease:

Too bad I haven't got it because MB is not a function plotter ;)

I cannot even post a picture of the fractal because I am using my tablet now ;)

Btw it's the fold used in Amazing Surf 2 (latest version)


Title: Re: Infinitized (Sierpinski) fold using bitwise operators
Post by: KRAFTWERK on January 27, 2015, 12:22:58 PM
so, where is the pretty picture ???

I like the code!  O0


Title: Re: Infinitized (Sierpinski) fold using bitwise operators
Post by: DarkBeam on January 28, 2015, 07:10:25 PM
Here is a picture (hopefully pretty? Chris?  ;D) - btw, here fold is different from the one illustrated above!

The fold center is moved to the borders before applying infinitization. The result is awe (I think)

(http://nocache-nocookies.digitalgott.com/gallery/16/4162_28_01_15_7_08_06.jpeg)


Title: Re: Infinitized (Sierpinski) fold using bitwise operators
Post by: quaz0r on January 29, 2015, 03:18:45 AM
mmm its pretty  :)


Title: Re: Infinitized (Sierpinski) fold using bitwise operators
Post by: knighty on February 05, 2015, 07:53:41 PM
Looks good!


Title: Re: Infinitized (Sierpinski) fold using bitwise operators
Post by: DarkBeam on February 06, 2015, 12:56:01 AM
Thanks again fold genius :)