Logo by AGUS - 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: Check out the originating "3d Mandelbulb" thread here
 
*
Welcome, Guest. Please login or register. April 19, 2024, 12:24:33 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] 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: Iterating C  (Read 8020 times)
0 Members and 1 Guest are viewing this topic.
Aexion
Conqueror
*******
Posts: 116


The Fractal Hermit


WWW
« on: December 22, 2011, 04:15:30 PM »

Hello,

Here is something interesting that I lately have been researching:
One of the fractal rule is that C is fixed value for the mandelbrot and julia iterations. This produces the fractals that you everyday see.
Well, I have experimented with a variable C, instead of a fixed one, and for many fractals I got interesting results.
The idea is this one (excuse my english, its not very good):
For every iteration step, you're really transforming the space into another space and subsequent iterations continue transforming the space.
For a mandelbulb, it means 3D rotation and scaling, and since the value of C is fixed for the iteration, that value doesn't follow the space transformations.
My idea was to make C to follow the transformations, but only the rotations, not the scale transformation.
This means that for every iteration, there's a different C value, at the same radius of the original one, but in a different position, but also, it correspond to the transformed value (Z).

This is my pseudo-code (its unoptimized and horrible, but was for testing purposes):
For every iteration:
I first calculate the classic mandelbulb and add the C value (cx,cy,cz)
Then transform the C value with the same function as the mandelbulb, but without changing the radius.

Code:
//Mandelbulb Iteration
const float r = sqrt(x*x + y*y + z*z);
const float theta = atan2(sqrt(x*x + z*z) , y)*8;
const float phi = atan2(z,x)*8;
const float r2=r*r*r*r;
const float r1=r2*r2;
const float sintheta=r1 * cos(theta);
x = sintheta * cos(phi)+cx;
y = sintheta * sin(phi)+cy;
z = r1 * sin(theta)+cz;

//C transformation, remove this segment for the classic mandelbulb
const float rc = sqrt(cx*cx + cy*cy + cz*cz);
const float theta1 = atan2(sqrt(cx*cx + cz*cz) , cy)*8;
const float phi1 = atan2(cz,cx)*8;
const float sintheta1=rc * cos(theta1);
cx = sintheta1 * cos(phi1);
cy = sintheta1 * sin(phi1);
cz = rc * sin(theta1);

This open some interesting questions:
1. How this looks with a different iteration functions..
2. Can this be used on other fractals..

Here are two examples, sorry for the low quality, but its because I just was making experiments:
The classic mandelbulb



And the variable C (its the same Mandelbulb with the same parameters and the same position):



If anyone makes a render of this, please let me know, since im interested on the results and also, my renders are not very good.. smiley
Logged

Fractals all the way..
Incendia for 3D Fractals
Aural for Musical Fractals
eiffie
Guest
« Reply #1 on: December 22, 2011, 04:44:16 PM »

Very interesting. I will also try rotating C by the original theta and phi as opposed to theta1 and phi1 in your code. I wonder what that will do.
Logged
Aexion
Conqueror
*******
Posts: 116


The Fractal Hermit


WWW
« Reply #2 on: December 22, 2011, 06:07:28 PM »

Very interesting. I will also try rotating C by the original theta and phi as opposed to theta1 and phi1 in your code. I wonder what that will do.

Nooo... Do not reverse the angles..  scared white
It transform from Mr. Happy Cauliflower to..
The Domain of Cthulhu!!

Its the same area, the same parameters but, with the angles reversed..
« Last Edit: December 22, 2011, 06:19:17 PM by Aexion » Logged

Fractals all the way..
Incendia for 3D Fractals
Aural for Musical Fractals
eiffie
Guest
« Reply #3 on: December 22, 2011, 06:55:29 PM »

I must not understand what you are doing because I get a sphere when using the same power to rotate C. I thought I followed your code??? I do get interesting results when C is rotated to a different power smiley and this will be fun to try with other fractals.


* rotC.jpg (112.36 KB, 720x1080 - viewed 459 times.)
« Last Edit: December 22, 2011, 06:59:27 PM by eiffie » Logged
Aexion
Conqueror
*******
Posts: 116


The Fractal Hermit


WWW
« Reply #4 on: December 22, 2011, 07:14:04 PM »

I must not understand what you are doing because I get a sphere when using the same power to rotate C. I thought I followed your code??? I do get interesting results when C is rotated to a different power smiley and this will be fun to try with other fractals.

Here is my iteration code..
The evil look comes from negative atan2 function in theta1 and phi1..
ps. sorry, no DE..just old plain escapetime
Code:
bool MBulbC(float cx, float cy, float cz,int iter){
float x=cx;
float y=cy;
float z=cz;
unsigned char Counter;
const float rc = sqrt(cx*cx + cy*cy + cz*cz);
for(Counter=0;Counter<iter;Counter++){


//mandelbulb
const float r = sqrt(x*x + y*y + z*z);//radius, used also for escape
const float theta = atan2(sqrt(x*x + z*z) , y)*8;
const float phi = atan2(z,x)*8;
const float r2=r*r*r*r;
const float r1=r2*r2;
const float sintheta=r1 * cos(theta);
x = sintheta * cos(phi)+cx;
y = sintheta * sin(phi)+cy;
z = r1 * sin(theta)+cz;


//c rotation
const float theta1 = -atan2(sqrt(cx*cx + cz*cz) , cy)*8;
const float phi1 = -atan2(cz,cx)*8;
const float sintheta1=rc * cos(theta1);
cx = sintheta1 * cos(phi1);
cy = sintheta1 * sin(phi1);
cz = rc * sin(theta1);


if (r>4) break;

}

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

Logged

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


The Fractal Hermit


WWW
« Reply #5 on: December 22, 2011, 08:28:39 PM »

I must not understand what you are doing because I get a sphere when using the same power to rotate C. I thought I followed your code??? I do get interesting results when C is rotated to a different power smiley and this will be fun to try with other fractals.

 embarrass
Now I understand why I get some different result: my "version" of the mandelbulb was an experimental one and some of the trigonometric functions are reversed.. also the rotation axis in a different orientation..  grin
Hence why I get that strange result..
(It often happens to me that I make experiments, and left them over the code.. then reuse the code forgetting the changes.. )
Anyways, try the version that I have posted and you will get the result that I have posted..
Logged

Fractals all the way..
Incendia for 3D Fractals
Aural for Musical Fractals
Jesse
Download Section
Fractal Schemer
*
Posts: 1013


« Reply #6 on: December 22, 2011, 08:40:57 PM »

Very interesting, mr first class formula supporter!   cheesy
Will surely try it out!
Logged
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #7 on: December 22, 2011, 10:25:58 PM »

Jesse if you write a formula only write the c rotation like I did for celticmode. and did you include quadrayteansform1 to the last binary? I guess you forgot it?
Logged

No sweat, guardian of wisdom!
Jesse
Download Section
Fractal Schemer
*
Posts: 1013


« Reply #8 on: December 23, 2011, 12:03:46 AM »

Jesse if you write a formula only write the c rotation like I did for celticmode. and did you include quadrayteansform1 to the last binary? I guess you forgot it?

I included only the ones in your latest update because you told me to discard older ones.
If you whish me to include it, please put it into your current formula collection for download!

For the c rotation i will have a look into your code, but Aexion's formulas result looks really promising, so i hope i can copy it first.

Cheers
Logged
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #9 on: December 23, 2011, 12:19:14 AM »

> (It often happens to me that I make experiments, and left them over the code.. then reuse the code forgetting the changes.. )

Common programmer's disease - especially for non-commercial products wink
Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
Syntopia
Fractal Molossus
**
Posts: 681



syntopiadk
WWW
« Reply #10 on: December 23, 2011, 12:25:21 AM »

Nice idea, Aexion. Here is few examples I came up with while trying it out.



* rotate1.jpg (189.53 KB, 800x674 - viewed 587 times.)

* rotate2.jpg (203.74 KB, 800x674 - viewed 490 times.)
Logged
Aexion
Conqueror
*******
Posts: 116


The Fractal Hermit


WWW
« Reply #11 on: December 23, 2011, 01:37:16 AM »

Very interesting, mr first class formula supporter!   cheesy
Will surely try it out!
Thanks Jesse!!

> (It often happens to me that I make experiments, and left them over the code.. then reuse the code forgetting the changes.. )

Common programmer's disease - especially for non-commercial products wink
Tell me that..  grin



Nice idea, Aexion. Here is few examples I came up with while trying it out.

Beautiful renders!! I like them


A non fixed C perhaps open possibilities, its time to experiment with other fractals and other functions for C..
If anyone found something, please let me know! smiley



Logged

Fractals all the way..
Incendia for 3D Fractals
Aural for Musical Fractals
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #12 on: December 23, 2011, 10:15:52 AM »

Code:
//Mandelbulb Iteration
const float r = sqrt(x*x + y*y + z*z);
const float theta = atan2(sqrt(x*x + z*z) , y)*8;
const float phi = atan2(z,x)*8;
const float r2=r*r*r*r;
const float r1=r2*r2;
const float sintheta=r1 * cos(theta);
x = sintheta * cos(phi)+cx;
y = sintheta * sin(phi)+cy;
z = r1 * sin(theta)+cz;

//C transformation, remove this segment for the classic mandelbulb
const float rc = sqrt(cx*cx + cy*cy + cz*cz);
const float theta1 = atan2(sqrt(cx*cx + cz*cz) , cy)*8;
const float phi1 = atan2(cz,cx)*8;
const float sintheta1=rc * cos(theta1);
cx = sintheta1 * cos(phi1);
cy = sintheta1 * sin(phi1);
cz = rc * sin(theta1);

Ramiro, thanks for sharing, the 'correct' (original) formulas are;
theta1 = atan2(cy , cx)
phi1 = arcsin(cz/rc)

then do;
// raise rc to a power, but you did not do so. wink
multiply angles by some values... then
costh*cosphi = x, cosphi*sinth = y, sinphi = z (multiplying by radius)

theory is here; http://www.fractalforums.com/theory/triplex-algebra/ smiley

There is a way to convert that nasty arcsin to atan2. I did this conversion some time ago;

acos(y/sqrt(r)) = 2*atan( sqrt(x*x+z*z) / (r+y) ) = 2* atan2( r+y  , sqrt(x*x+z*z))

for getting the assembly Inigo Quixles bulb. But arcsin is different fiery

As it was not enough, my expansion was very wrong!!!

The correct one is simply;

acos(y/sqrt(r)) = atan2(sqrt(x*x+z*z),y)

A shame on me... embarrass Now back to work to correct all help
« Last Edit: December 23, 2011, 11:00:34 AM by DarkBeam » Logged

No sweat, guardian of wisdom!
Aexion
Conqueror
*******
Posts: 116


The Fractal Hermit


WWW
« Reply #13 on: December 23, 2011, 10:46:09 AM »

Code:
//Mandelbulb Iteration
const float r = sqrt(x*x + y*y + z*z);
const float theta = atan2(sqrt(x*x + z*z) , y)*8;
const float phi = atan2(z,x)*8;
const float r2=r*r*r*r;
const float r1=r2*r2;
const float sintheta=r1 * cos(theta);
x = sintheta * cos(phi)+cx;
y = sintheta * sin(phi)+cy;
z = r1 * sin(theta)+cz;

//C transformation, remove this segment for the classic mandelbulb
const float rc = sqrt(cx*cx + cy*cy + cz*cz);
const float theta1 = atan2(sqrt(cx*cx + cz*cz) , cy)*8;
const float phi1 = atan2(cz,cx)*8;
const float sintheta1=rc * cos(theta1);
cx = sintheta1 * cos(phi1);
cy = sintheta1 * sin(phi1);
cz = rc * sin(theta1);

Ramiro, thanks for sharing, the 'correct' (original) formulas are;
theta1 = atan2(cy , cx)
phi1 = arcsin(cz/rc)

then do;
// raise rc to a power, but you did not do so. wink
multiply angles by some values... then
costh*cosphi = x, cosphi*sinth = y, sinphi = z (multiplying by radius)

theory is here; http://www.fractalforums.com/theory/triplex-algebra/ smiley

There is a way to convert that nasty arcsin to atan2. I did this conversion some time ago;

acos(y/sqrt(r)) = 2*atan( sqrt(x*x+z*z) / (r+y) ) = 2* atan2( r+y  , sqrt(x*x+z*z))

for getting the assembly Inigo Quixles bulb. But arcsin is different fiery

Oh..In chaos, there's no 'correct' formulas.. there's just formulas smiley

I do not rise rc to a power because C will change its radius and escape.. the objective of this formulation is to make C orbiting around..
Logged

Fractals all the way..
Incendia for 3D Fractals
Aural for Musical Fractals
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #14 on: December 23, 2011, 11:02:02 AM »

Okay let me correct those formulas then I go back 2 you angel
Logged

No sweat, guardian of wisdom!
Pages: [1] 2   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Iterating Random Powers Mandelbrot & Julia Set Alef 5 2933 Last post November 19, 2013, 05:28:45 PM
by Rychveldir

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