Logo by Pauldelbrot - 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. April 19, 2024, 07:26:29 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]   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: Matrix multiplication instead of spherical coordinate system  (Read 7362 times)
0 Members and 1 Guest are viewing this topic.
Mircode
Alien
***
Posts: 37


« on: February 19, 2010, 12:57:09 PM »

Hi there!

When I first saw the Mandelbulb I got really fascinated, so I started to read all about it on the page by Daniel White. I found that the idea was pretty cool and I started to think about the formula. Then an idea came to my mind.

When I took a look at this forum here I saw that godzillions of variations already exist but I'm too lazy to look them through to see if someone already had this idea. But on the other hand, I dont want it to be lost, so I'll post it anyway.

Basically I thought that there must be a possibility to get rid of the inhomogeneity of a spherical coordinate system that is taken as a basis here.
I hate the standard spherical coordinate system. If I explained why I'm afraid I'd use mathematical terms like "singularity" wrongly. And I fear that my approach uses this coordinate system, too. In a way. But enough blabla.

So here my idea:

Instead of doubling these angles in a spherical coordinate system like that

double yang = atan2(sqrt(x*x + y*y) , z);
double zang = atan2(y , x);
newx = (r*r) * sin( yang*2 + 0.5*pi ) * cos(zang*2 +pi);
newy = (r*r) * sin( yang*2 + 0.5*pi ) * sin(zang*2 +pi);
newz = (r*r) * cos( yang*2 + 0.5*pi );

we could use rotations in relation to local coordinate systems, best describable by matrix multiplications i guess.

First we go from (1,0,0) to the point we want to rotate (yellow). But we rotate the coordinate system with us. Step one is around the x-axis by phi1, step two is around the new z axis by phi2. See pic1.
Then we do these two steps again to obtain our result. See pic2.
The rest (distance from (0,0,0) and addition of C) is similar to the original idea.

EDIT: Doesnt work exactly the way I painted it, see below.

I don't know whether the resulting fractal is different from the "normal" one in any way, but my feeling tells me it's worth the try.

So I hope that someone finds the time and the motivation to implement it (I lack both) and that it is the pot of gold at the end of the rainbow that everyone looks for.  Yes !!

Best wishes,
  Mirko Kunze


* pic1.jpg (39.34 KB, 658x592 - viewed 391 times.)

* pic2.jpg (39.21 KB, 714x616 - viewed 353 times.)
« Last Edit: March 11, 2010, 09:34:49 PM by Mircode » Logged
Paolo Bonzini
Guest
« Reply #1 on: February 19, 2010, 03:05:09 PM »

we could use rotations in relation to local coordinate systems, best describable by matrix multiplications i guess.

First we go from (1,0,0) to the point we want to rotate (yellow). But we rotate the coordinate system with us. Step one is around the x-axis by phi1, step two is around the new z axis by phi2. See pic1.
Then we do these two steps again to obtain our result. See pic2.
The rest (distance from (0,0,0) and addition of C) is similar to the original idea.

I don't know whether the resulting fractal is different from the "normal" one in any way, but my feeling tells me it's worth the try.

It most likely is.  I worked out the math for something similar using quaternions (which are simpler than matrices when you deal with rotations).  You can try using that as well.  Here is the paper describing my work:

http://github.com/bonzini/mbulb/raw/master/mbulb.pdf

It starts by defining the 2D mandelbrot set using purely-imaginary quaternions (the resulting iteration is v \leftarrow vi\bar v + c and then sees what changes in 3D.
Logged
twinbee
Fractal Fertilizer
*****
Posts: 383



WWW
« Reply #2 on: February 21, 2010, 11:33:57 PM »

I might be misunderstanding here, but rotating theta then phi in a global rotation frame is the same as rotating them in reverse when using local rotation frames (i.e. phi before theta). In the end, they both produce the same standard spherical coords system (albeit rotated, or upside down etc.).
Logged
Mircode
Alien
***
Posts: 37


« Reply #3 on: February 22, 2010, 05:52:56 PM »

Thanks for the answers!

@ Paolo Bonzini:
I took a quick look on your paper. It looks interesting and I think it includes my idea but I'm not sure yet. I will try to read it more carefully when I have some time.
Can I see the results somewhere?

@ twinbee:
"I might be misunderstanding here, but rotating theta then phi in a global rotation frame is the same as rotating them in reverse when using local rotation frames" I didn't know that but it became obvious when I tinkered around to describe the formula more mathematically and less graphically wink
Please be clement with me, these "areas" of maths are more like a hobby.

Let me try to point out the difference:

The standard approach for the angles is:
Find R(\theta,\phi) so that (x_n,y_n,z_n)=R(\theta,\phi)(1,0,0)
Then calculate the new point like this: (x_{n+1},y_{n+1},z_{n+1})=R(n\theta,n\phi)(1,0,0)
But I want to suggest this: (x_{n+1},y_{n+1},z_{n+1})=R(\theta,\phi)^n(1,0,0)
(Change of the distance to 0 and addition of C are left aside here)

In MATLAB-code that would be
Code:
phi1 = atan2(x0(3),x0(2));
phi2 = atan2(sqrt(x0(2)^2+x0(3)^2),x0(1));

rotx = [ 1     0          0
         0 cos(phi1) -sin(phi1)
         0 sin(phi1)  cos(phi1) ];
    
rotz = [ cos(phi2) -sin(phi2) 0
         sin(phi2)  cos(phi2) 0
             0          0     1 ];

x1 = (rotx*rotz)^n *[1 0 0]';

EDIT: Its a little wrong, see below. But StarTrek tought me not to mess up the timeline, so I'll leave it like that in this post.
« Last Edit: March 11, 2010, 09:37:09 PM by Mircode » Logged
Paolo Bonzini
Guest
« Reply #4 on: February 24, 2010, 03:45:01 PM »

@ Paolo Bonzini:
I took a quick look on your paper. It looks interesting and I think it includes my idea but I'm not sure yet. I will try to read it more carefully when I have some time.
Can I see the results somewhere?

The paper does not propose new fractals, just new math to work with them, so no fancy pictures. :-)  Thanks for looking at it!
Logged
Mircode
Alien
***
Posts: 37


« Reply #5 on: March 11, 2010, 11:18:11 PM »

Since noone seemed to do the work for me, I finally started to try it on my own. tongue stuck out Here is now the code I used. The code I posted before was wrong. (I thought the x-Axis goes through the poles of the spherical coordinate system in the standard bulb but z does)

Code:
rad  = norm(x0);
phiz = atan2(x0(2),x0(1));
phiy = atan2(x0(3),sqrt(x0(1)^2+x0(2)^2));

rotz = [  cos(phiz) -sin(phiz) 0
          sin(phiz)  cos(phiz) 0
              0          0     1 ];

roty = [  cos(phiy) 0 -sin(phiy)
              0     1      0
          sin(phiy) 0  cos(phiy) ];

x1 = (rotz*roty)^powr * [rad^powr 0 0]' + [cx cy cz]';

The only difference to the standard-bulb is the last line.
Code:
(rotz^powr*roty^powr)     % old
(rotz*roty)^powr     % new

I dont know how to render it properly, i created a 3D-Array in MATLAB and imported it in ParaView. But I think it gives a nice first impression.

The first pic shows the fractal with powr=2 and the second one with powr=8.

All in all I'm a little disappointed by the results. I like the shape of the power-2 fractal, but its creamy like quaternion julia fractals.
The thing is, that only 2 of 3 degrees of freedom for R are determined by a point to point rotation. (rotz*roty*rotx) always fullfills that condition with any angle for rotx. I played around with it a little, it twists the whole object in an interesting way but it destroys the classic 2D fractal in the x-y-plane. And it doesnt help against the creamyness.

But still, there are some interesting areas that the resolution I used doesnt... do justice to. If someone could... I mean if someone wanted to...


Still, it was worth the try.

Greetings,
  Mirko


* mandel3d.jpg (242.92 KB, 746x749 - viewed 387 times.)

* bulb8.jpg (218.16 KB, 658x623 - viewed 382 times.)
« Last Edit: March 12, 2010, 11:12:28 AM by Mircode » Logged
kram1032
Fractal Senior
******
Posts: 1863


« Reply #6 on: March 12, 2010, 12:04:41 AM »

The power 2 version looks great cheesy
Logged
KRAFTWERK
Global Moderator
Fractal Senior
******
Posts: 1439


Virtual Surreality


WWW
« Reply #7 on: March 12, 2010, 08:53:29 AM »

Yes it does look interesting zoom in zoom in!  afro
Logged

Mircode
Alien
***
Posts: 37


« Reply #8 on: March 12, 2010, 11:27:53 AM »

Well, I would like to zoom in. But actually I dont have time for any of this. And I am not familiar with any proper render tool. The way I did it took hours and looks ugly, compared to other 3D fractal pics. If I am right, there is no official program capable of rendering custom fractals and all the mandelbulb pics in here are created with self tinkered programs (Correct me if I'm wrong pls wink ). I could provide the c-code for my formula, thats no big whoop. Then someone could include it into his program.

Or if there actually is a good and usable! program I could try it with that.

Anyway, thanks for the positive feedback!

Greetings,
  Mirko
Logged
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #9 on: March 12, 2010, 01:01:49 PM »

Well, I would like to zoom in. But actually I dont have time for any of this. And I am not familiar with any proper render tool. The way I did it took hours and looks ugly, compared to other 3D fractal pics. If I am right, there is no official program capable of rendering custom fractals and all the mandelbulb pics in here are created with self tinkered programs (Correct me if I'm wrong pls wink ). I could provide the c-code for my formula, thats no big whoop. Then someone could include it into his program.

Or if there actually is a good and usable! program I could try it with that.

Anyway, thanks for the positive feedback!

Greetings,
  Mirko

*If* you're using Windows *and* you have Ultra Fractal *and* you can follow how the new class-based system for UF works you should be able to take a look at Ron Barnett's (aka reb in UF, aka fractalrebel here) 3D raytracing classes and write your own formula plug-ins for those.
Logged

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

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
Mircode
Alien
***
Posts: 37


« Reply #10 on: March 23, 2010, 02:07:33 PM »

Hi there!

I killed all the bugs in my ChaosPro script and here are the results. If someone wants to play around with it, here is the script. I'm still a little disappointed and moping tongue stuck out

Code:
Mandelbulb_MatRot(QUATERNION) {

parameter real bailout;
parameter quaternion juliac;
parameter int n;
parameter bool juliaMode;

real zx,zy,zz;
real zx_,zy_,zz_;
quaternion c;
real cx,cy,cz;

parameter real phix;
real r,phiy,phiz;
real cphix,sphix;
real cphiy,sphiy;
real cphiz,sphiz;
int i;

void init(void)
{
if (juliaMode) {
z=pixel;
c=juliac;
} else {
c=pixel;
z=c;
}
zx=part_r(z);
zy=part_i(z);
zz=part_j(z);

cx=part_r(c);
cy=part_i(c);
cz=part_j(c);
}

void loop(void)
{
r=sqrt(zx^2+zy^2+zz^2);
phiy=atan2(sqrt(zx^2+zy^2)+flip(zz));
phiz=atan2(zx+flip(zy));

cphix = cos(phix);
sphix = sin(phix);
cphiy = cos(phiy);
sphiy = sin(phiy);
cphiz = cos(phiz);
sphiz = sin(phiz);

for (i=1;i<n;i=i+1)
{
// Rotx
zx_= zx;
zy_= cphix*zy - sphix*zz;
zz_= sphix*zy + cphix*zz;

// Roty
zx = cphiy*zx_ - sphiy*zz_;
zy = zy_;
zz = sphiy*zx_ + cphiy*zz_;

// Rotz
zx_= cphiz*zx - sphiz*zy;
zy_= sphiz*zx + cphiz*zy;
zz_= zz;

zx=zx_*r;
zy=zy_*r;
zz=zz_*r;
}

zx=zx+cx;
zy=zy+cy;
zz=zz+cz;

z=quaternion(zx,zy,zz,0);
}
bool bailout(void)
{
return(zx*zx+zy*zy+zz*zz <bailout);
}

void description(void)
{
this.title = "Mandelbulb - Matrixrotation";

bailout.caption = "Bailout Value (^2)";
bailout.default = 4.0;
bailout.min = 1.0;
bailout.hint = "Defines the bailout radius²: As soon as a pixel falls outside a circle with this radius, the iteration stops.";

juliac.caption="c";
juliac.default=(0.3,-0.44,-0.57,0.3);
juliac.hint="Parameter for Julia fractal";

juliaMode.caption="Julia Mode";
juliaMode.default=false;
juliaMode.hint="If checked, Julia mode is enabled, otherwise Mandelbrot mode";

n.caption="Power";
n.default=3;
n.min=2;
n.hint="Power";

phix.caption="Modification rotx";
phix.default=0;
phix.hint="Defines the x-angle of the rotation matrix";

}
}

But I already have another idea smiley

Greetings,
  Mirko


* Mirkbulb120.jpg (99.28 KB, 795x837 - viewed 363 times.)

* Mirkbulb40_Heart.jpg (188.16 KB, 1680x1050 - viewed 368 times.)

* Mirkbulb40_Eye.jpg (194.07 KB, 1200x1050 - viewed 400 times.)
Logged
Mircode
Alien
***
Posts: 37


« Reply #11 on: March 23, 2010, 02:39:06 PM »

Here a Julia pic


* Julia.jpg (250.89 KB, 921x773 - viewed 383 times.)
Logged
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Two further spherical coordinate systems Theory « 1 2 » Mircode 25 7426 Last post March 27, 2010, 12:49:15 AM
by Timeroot
oblate coordinate Mset / Mbulb (new) Theories & Research kram1032 14 922 Last post February 01, 2012, 08:19:52 PM
by Alef
Tutorial #1 - Complex Multiplication is a rotation! chaosTube - Tutorials « 1 2 » cKleinhuis 16 11052 Last post October 15, 2013, 08:36:23 AM
by cKleinhuis
Toroidal Coordinate Mandy (my take) The 3D Mandelbulb laser blaster 2 7199 Last post June 30, 2014, 06:50:05 PM
by LMarkoya
coordinate arrows Feature Requests taurus 2 34027 Last post December 08, 2017, 09:58:34 PM
by taurus

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.158 seconds with 29 queries. (Pretty URLs adds 0.013s, 2q)