Logo by Khaotik - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Follow us on Twitter
 
*
Welcome, Guest. Please login or register. April 26, 2024, 03:08:45 PM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: Help ! what is this code ?  (Read 418 times)
0 Members and 1 Guest are viewing this topic.
ker2x
Fractal Molossus
**
Posts: 795


WWW
« 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++;
    }
Logged

often times... there are other approaches which are kinda crappy until you put them in the context of parallel machines
(en) http://www.blog-gpgpu.com/ , (fr) http://www.keru.org/ ,
Sysadmin & DBA @ http://www.over-blog.com/
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #1 on: April 16, 2014, 08:36:30 PM »

on first sight i would confirm that wink
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
Logged

---

divide and conquer - iterate and rule - chaos is No random!
ker2x
Fractal Molossus
**
Posts: 795


WWW
« Reply #2 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/

Of course... i have no idea how i did that grin

Thank you !
Logged

often times... there are other approaches which are kinda crappy until you put them in the context of parallel machines
(en) http://www.blog-gpgpu.com/ , (fr) http://www.keru.org/ ,
Sysadmin & DBA @ http://www.over-blog.com/
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
I arrive, and I come with code. Meet & Greet CraigM 3 1645 Last post January 16, 2009, 12:13:07 PM
by Cyclops
some code Mandelbulb 3d Jesse 7 3109 Last post August 15, 2011, 10:27:15 PM
by Jesse
Break the code Fractal Humor KRAFTWERK 11 7208 Last post November 25, 2011, 05:27:04 PM
by cKleinhuis
Love and Code Images Showcase (Rate My Fractal) yv3 0 821 Last post December 23, 2011, 09:13:07 PM
by yv3
How to convert MB3D parameter code to people can read like flame code? Mandelbulb 3d fengda2870 4 7311 Last post December 30, 2016, 03:32:42 PM
by lycium

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.269 seconds with 24 queries. (Pretty URLs adds 0.021s, 2q)