Welcome to Fractal Forums

Fractal Software => Programming => Topic started by: emrys on May 20, 2015, 08:02:06 PM




Title: rotate()
Post by: emrys on May 20, 2015, 08:02:06 PM
Hey all

I'm attempting to implement the KIFS function in Houdini but I'm not entirely sure what the rotate() functions are doing in the code. I've tried searching, but to no avail. Of course I'm not even sure what language this is, so that might help :). Did I mention I'm new here?

Thanks

Code:
Menger3(x,y,z){
   r=x*x+y*y+z*z;
   for(i=0;i<MI && r<bailout;i++){
      rotate1(x,y,z);

      x=abs(x);y=abs(y);z=abs(z);
      if(x-y<0){x1=y;y=x;x=x1;}
      if(x-z<0){x1=z;z=x;x=x1;}
      if(y-z<0){y1=z;z=y;y=y1;}
     
      z-=0.5*CZ*(scale-1)/scale;
      z=-abs(-z);
      z+=0.5*CZ*(scale-1)/scale; // equals to a shifted ABS

      rotate2(x,y,z);
   
      x=scale*x-CX*(scale-1);
      y=scale*y-CY*(scale-1);
      z=scale*z;
     
      r=x*x+y*y+z*z;
   }
   return sqrt(x*x+y*y+z*z)*scale^(-i);
}


Title: Re: rotate()
Post by: dom767 on May 24, 2015, 11:40:21 AM
The rotate makes each iteration of the fractal curve away from the standard fractal you started with.

I covered the basics on this article recently...
http://woo4.me/wooscripter/kaleidoscopic-ifs-fractals/

And I rendered this the other day. :)
(http://i.imgur.com/JTNJ7yG.jpg)

Enjoy getting into fractals!


Title: Re: rotate()
Post by: Dodonaea on May 25, 2015, 04:15:53 PM
Thanks dom767, very informative tutorial!


Title: Re: rotate()
Post by: emrys on May 25, 2015, 07:50:06 PM
Thanks dom767 that's a great tutorial.

I was also sent this link via PM:
https://github.com/Syntopia/Fragmentarium/blob/master/Fragmentarium-Source/Examples/Include/MathUtils.frag

These should definitely put me on the right track.