Logo by KRAFTWERK - 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: Support us via Flattr FLATTR Link
 
*
Welcome, Guest. Please login or register. January 17, 2018, 12:25:14 AM


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] 2   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: MandelDonuts  (Read 1676 times)
Description: An attemp to create a toroidal MandelBulb
0 Members and 1 Guest are viewing this topic.
Aexion
Conqueror
*******
Posts: 116


The Fractal Hermit


WWW
« on: August 06, 2014, 12:43:11 PM »

Hello,

Lately I have been trying to make a toroidal Mandelbulb. Since the mandelbulb uses spherical coordinates, I wondered if one could create a torus based version.
After trying with the Toroidal coordinate system with no luck, I moved on a simple parametric curve that gives me very interesting results.
My idea was to calculate the mandelbulb angles and distances over a circular path, that turns it into a torus.
The resulting fractals are made of a combination of donuts and bridges.
By calculating the mandelbulb in this way, also opens other possibilities, since you can use other parametric curves.
I tried and spiral and also got very interesting results.
These functions are quite simple and just returns true or false if you're in the fractal or not.


MandelTorus1


Code:
bool MandelTorus1(double x, double y, double z,int iter){
const float cx=x;
const float cy=y;
const float cz=z;
const int power1=9; //Longitude power
const int power2=9; //Latitude power
const double tdist=1.5;//radius of the parametric circle.  Make it 0 if you want a dual power mandelbulb
unsigned char Counter=0;
float rh =x*x+z*z;
do{
rh=sqrt(rh);
const double phi=atan2(z,x);
const double phipow=phi*power1;
const double theta=atan2((double)rh,(double)y);
const double thetapow=theta*power2;
const double px=x-cos(phi)*tdist;
const double pz=z-sin(phi)*tdist;
const double rhrad=sqrt(px*px+pz*pz+y*y);
const double rh1=pow(rhrad,power2);
const double rh2=pow(rhrad,power1);
const float sintheta=sin(thetapow)*rh2;
x = sintheta * cos(phipow)+cx;
z = sintheta * sin(phipow)+cz;
y = cos(thetapow)*rh1+cy;
rh =x*x+z*z;
if (rh+y*y>16) break;//bailout
Counter++;
}while(Counter<iter);

if(Counter<iter)
return true;
else
return false;
}

MandelTorus2


Code:
bool MandelTorus2(double x, double y, double z,int iter){
const float cx=x;
const float cy=y;
const float cz=z;

const int power1=9; //Longitude power
const int power2=9; //Latitude power
const double tdist=1.5;
unsigned char Counter=0;
float rh =x*x+z*z;
do{
rh=sqrt(rh);
const double phi=atan2(z,x);
const double phipow=phi*power1;
const double theta=atan2((double)rh,(double)y);
const double px=x-cos(phi)*tdist;
const double pz=z-sin(phi)*tdist;
const double rhrad=sqrt(px*px+pz*pz+y*y);
const double tangle=atan2(sqrt(px*px+pz*pz),(double)y)*power2;
const double rh1=pow(rhrad,power2);
const double rh2=pow(rhrad,power1);
const float sintheta=(1.5+cos(tangle))*rh2;
x = sintheta * cos(phipow)+cx;
z = sintheta * sin(phipow)+cz;
y = sin(tangle)*rh1+cy;
rh =x*x+z*z;
if (rh+y*y>16) break;
Counter++;
}while(Counter<iter);

if(Counter<iter)
return true;
else
return false;
}

There are many variations to test, such as spirals, elliptic curves, and knots. Also, you can add a waving Y axis component to the circle, that will turn the torus into some sort of flower and creates a mandelflower set.  

Hope that you like it. If anyone can calculate the DE for these fractals, I will be very good.

Thanks!

ps. I have many other fractals to show in store, such as the Spherical Harmonics fractals, but lately have been busy working with Aural and has little time left to explore.
pps. Is there a section for indexing all 3D fractals? Say something like an image, the formula and a comment. I say that because this would prevent us to reinventing the wheel (something that happened to me sometime ago) and helps to the fractal programmers to code them!. smiley
ppps. Where I the forum I can announce my fractal music generator?  grin

« Last Edit: August 06, 2014, 12:45:28 PM by Aexion » Logged

Fractals all the way..
Incendia for 3D Fractals
Aural for Musical Fractals
Roquen
Iterator
*
Posts: 180


« Reply #1 on: August 06, 2014, 09:57:06 PM »

Nice.  Spherical Harmonics seems like an interesting idea.
Logged

All code submitted by me is in the public domain. (http://unlicense.org/)
Aexion
Conqueror
*******
Posts: 116


The Fractal Hermit


WWW
« Reply #2 on: August 07, 2014, 01:40:11 AM »

Nice.  Spherical Harmonics seems like an interesting idea.
Indeed, they can produce very interesting fractals:  grin

Logged

Fractals all the way..
Incendia for 3D Fractals
Aural for Musical Fractals
_revers_
Conqueror
*******
Posts: 138



« Reply #3 on: August 07, 2014, 09:20:55 AM »

QL smiley I thing MandelTorus2 looks better than Mandelbulb.
Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #4 on: August 07, 2014, 09:27:14 AM »

cool way to hybridise even more wink havent looked fully into how you do it, because it is hidden in the complete formula,
you apply the torus transform in every iteration rather than as pre-transform ?
Logged

---

divide and conquer - iterate and rule - chaos is No random!
Roquen
Iterator
*
Posts: 180


« Reply #5 on: August 07, 2014, 10:51:18 AM »

Just in case you haven't seen these:
http://www.ppsloan.org/publications/StupidSH36.pdf
http://jcgt.org/published/0002/02/06/
http://www.filmicworlds.com/2014/07/02/simple-and-fast-spherical-harmonic-rotation/
Logged

All code submitted by me is in the public domain. (http://unlicense.org/)
Aexion
Conqueror
*******
Posts: 116


The Fractal Hermit


WWW
« Reply #6 on: August 07, 2014, 01:45:17 PM »

cool way to hybridise even more wink havent looked fully into how you do it, because it is hidden in the complete formula,
you apply the torus transform in every iteration rather than as pre-transform ?
For the first formula, it just a circle.
I just use an angle from the Mandelbulb to calculate point in a circle, then the mandelbulb radius is calculated by subtracting that point from the actual iteration formula. Is a very simple approach.

The second formula is actually an attempt to use the torus equation, but it also uses the circle procedure.
« Last Edit: August 07, 2014, 02:07:29 PM by Aexion » Logged

Fractals all the way..
Incendia for 3D Fractals
Aural for Musical Fractals
Aexion
Conqueror
*******
Posts: 116


The Fractal Hermit


WWW
« Reply #7 on: August 07, 2014, 05:02:12 PM »

Here is a simple way to distort the Mandelbulb into the Spherical Harmonics functions. Its the same as in the MandelTorus1 function,
but instead using just a parametric circle, the point comes from the harmonic's parametric surface.
Any change in the powers of the mandelbulb or the spherical harmonic coefficients will make interesting shapes (they are good for making orange juice too.. smiley )
I didn't have tested the SuperFormula, but I suspect that they will work in the same way..
For the information of the Spherical Harmonics, Paul Bourke has a very good webpage about them, here is the link: http://paulbourke.net/geometry/sphericalh/
(BTW, Thanks for the links, I will check them!)



Code:
bool HarmonicBulb(double x, double y, double z,int iter){
const double m[8]={2,4,2,4,2,4,2,4}; // Spherical Harmonics coefficients.. Any integer makes something interesting (or not!)
const float cx=x;
const float cy=y;
const float cz=z;

float rh =x*x+z*z;
const int power1=13;//Longitude
const int power2=13;//Latitude.. Try 5 for the second example

double r;
unsigned int Counter=0;
do{
rh=sqrt(rh);
const double phi=atan2(z,x);
const double phipow=phi*power1;
const double theta=atan2((double)rh,(double)y);
const double thetapow=theta*power2;
r=pow(sin(m[0]*phi),m[1]);
r += pow(cos(m[2]*phi),m[3]);
r += pow(sin(m[4]*theta),m[5]);
r += pow(cos(m[6]*theta),m[7]);
const double hsintheta=sin(theta)*r;
const double px=x-hsintheta*cos(phi);
const double pz=z-hsintheta*sin(phi);
const double py=y-cos(theta)*r;
const double rhrad=sqrt(px*px+pz*pz+py*py);
const double rh1=pow(rhrad,power2);
const double rh2=pow(rhrad,power1);
const float sintheta=sin(thetapow)*rh2;
x = sintheta * cos(phipow)+cx;
z = sintheta * sin(phipow)+cz;
y = cos(thetapow)*rh1+cy;
rh =x*x+z*z;
if (rh+y*y>16) break;
Counter++;
}while(Counter<iter);

if(Counter<iter)
return true;
else
return false;
}



Logged

Fractals all the way..
Incendia for 3D Fractals
Aural for Musical Fractals
mclarekin
Fractal Senior
******
Posts: 1739



« Reply #8 on: August 08, 2014, 06:45:01 AM »

@ Aexion. Thanks for sharing, they look great. The infinite possibilities have just got more infinite grin
Logged
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #9 on: February 14, 2015, 04:54:14 PM »

GENIUS! cheesy
Logged

No sweat, guardian of wisdom!
LMarkoya
Strange Attractor
***
Posts: 282



« Reply #10 on: February 14, 2015, 05:17:05 PM »

Are you actually doing those in Incendia?huh???
Logged
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #11 on: February 14, 2015, 11:45:15 PM »

I remember he uses a kind of voxelstack export and renders with Incendia without using distance estimation smiley the hard way cheesy
Logged

No sweat, guardian of wisdom!
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #12 on: February 14, 2015, 11:49:07 PM »

naah, far to smooth for a voxelstack export wink i think a plain raymarche does the job here wink

beside of that, it reminds me of the pre-transforms in ultrafractal, wouldnt it be nice to have a space warp pre transform step built in into the current renderers? i talk about mandelbulber wink will post it right away there wink
Logged

---

divide and conquer - iterate and rule - chaos is No random!
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #13 on: February 14, 2015, 11:53:20 PM »

Uh, there is a ton of them I made but don't press the poor Buddhi! cheesy
Logged

No sweat, guardian of wisdom!
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #14 on: February 15, 2015, 12:06:41 AM »

sure, since it is an open source project anyone can do it wink

so, i am certainly not able to do it right now, but a generalised approach for mandelbulber, and a description of our 2 different approaches

- me: just one transform before iterating
- you: a transfom at each iteration?

is nice to have included them in the general workflow of mandelbulber .... since it is the only one under construction right now wink
Logged

---

divide and conquer - iterate and rule - chaos is No random!
Pages: [1] 2   Go Down
  Print  
 
Jump to:  


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.23 seconds with 28 queries. (Pretty URLs adds 0.021s, 2q)