Welcome to Fractal Forums

Fractal Software => Programming => Topic started by: ker2x on April 16, 2014, 08:27:38 PM




Title: Help ! what is this code ?
Post by: ker2x on April 16, 2014, 08:27:38 PM
I didn't code fractals for a long time and... i found this, one of my code.
Look like a regular mandelbulb code, is it ?

Code:
    while(iter<MAXITER && r<2.0 && nx!=0.0 && r!=0.0 && nx!=-0.0 && r!=-0.0) {
      r2p = pow(r,p);
      th=atan(ny/nx)*p;
      ph=asin(nz/r)*p;
      nx=r2p*cos(ph)*cos(th)+x;
      ny=r2p*cos(ph)*sin(th)+y;
      nz=r2p*sin(ph)+z;
      pts[iter][0] = nx;
      pts[iter][1] = ny;
      pts[iter][2] = nz;
      r=sqrt(nx*nx+ny*ny+nz*nz);
      iter++;
    }


Title: Re: Help ! what is this code ?
Post by: cKleinhuis on April 16, 2014, 08:36:30 PM
on first sight i would confirm that ;)
power of magnitue and theta and phi:
 r2p = pow(r,p);
      th=atan(ny/nx)*p;
      ph=asin(nz/r)*p;

followed by back calculation
  nx=r2p*cos(ph)*cos(th)+x;
      ny=r2p*cos(ph)*sin(th)+y;
      nz=r2p*sin(ph)+z;

although the +x/y/z confuses me, might be some additional factor that you build in


Title: Re: Help ! what is this code ?
Post by: ker2x on April 16, 2014, 08:50:29 PM
Ha yes, probably, it's from one of my ooooold code. i totally forgot i ever did a budduabulb
From : http://www.fractalforums.com/movies-showcase-(rate-my-movie)/the-holy-3d-buddhabrot-!-o/ (http://www.fractalforums.com/movies-showcase-(rate-my-movie)/the-holy-3d-buddhabrot-!-o/)

Of course... i have no idea how i did that ;D

Thank you !