kram1032


« Reply #15 on: January 16, 2010, 06:51:46 PM » 

No matter wether or not this includes an error: It looks very promising Now, it's a total brocoli



Logged




hobold
Fractal Bachius
Posts: 572


« Reply #16 on: January 16, 2010, 07:07:45 PM » 

Thanks, msltoe, for your quick efforts! That mushroom doesn't look nearly as boring as I had suspected.
Here is my attempt at an inverse coordinate transform. I don't have a closed formula, but the amount of computation is quite reasonable. From the arc lengths Ax and Az, first we compute Riemann projections onto the cartesian axes:
Rx = sin(Ax)/(1  cos(Ax)) Rz = sin(Az)/(1  cos(Az))
then we compute an auxiliary value, a common subexpression (really the free parameter of a ray starting in the pole and having a direction towards the projected point on the "floor")
temp = 2/(Rx*Rx + Rz*Rz + 1)
and finally the point on the unit sphere
Px = Rx*temp Py = 1  temp Pz = Rz*temp
These formulas are completely untested and may contain errors. Use at your own peril. :)



Logged




msltoe
Iterator
Posts: 187


« Reply #17 on: January 16, 2010, 11:20:06 PM » 

I've taken a few liberties on the algorithms suggested above, so here's the code I'm using for reference. There several variations I've tried, but this seems to be the best from an aesthetic point of view.
r = x*x+y*y+z*z; r1= sqrt(r); x /= r1; y /= r1; z /= r1; if ((x==0)&&(z==0)) { theta = 0; phi = 0; } else { rx = x/(y1); theta = 8*atan2(2*rx,rx*rx1); rz = z/(y1); phi = 8*atan2(2*rz,rz*rz1); }
rx = sin(theta)/(1+cos(theta)); rz = sin(phi)/(1+cos(phi));
d = 2/(rx*rx+rz*rz+1);
a1 = rx*d; b1 = (rx*rx+rz*rz1)*0.5*d; c1 = rz*d;
x = a+a1*r*r*r*r; y = b+b1*r*r*r*r; z = c+c1*r*r*r*r;



Logged




kram1032


« Reply #18 on: January 16, 2010, 11:23:04 PM » 

also a nice one I wonder, what's the *correct* version



Logged




hobold
Fractal Bachius
Posts: 572


« Reply #19 on: January 17, 2010, 12:50:57 AM » 

I wonder, what's the *correct* version There probably is no correct one. After all, there exists no "field of numbers" structure on top of a 3D vector space. The aesthetic point of view is not a bad criterion at all. Msltoe, as far as I can see you seem to have taken a mix of mine and Pablo's inverse transform, and are trying to emulate an eight power like the mandelbulb? I would find it instructive to see a second power, to better judge the amount of whipped cream ... I guess I will have to bite the bullet and learn about the algorithms needed to render these kinds of fractals. But first, I should test my forward and inverse transforms for correctness.



Logged




hobold
Fractal Bachius
Posts: 572


« Reply #20 on: January 17, 2010, 10:12:17 AM » 

I sanitychecked my coordinate transforms and found a mistake in the first, cartesian to monopolar, formula. I flipped the sign of the Y axis somewhere. Here are the corrected versions. The origin of the spherical coordinates is still at the pole in this version.
// inputs: point on unit sphere (Px, Py, Pz) // outputs: arc lengths Ax, Az // (origin at the pole) void cartesian2monopolar(double& Ax, double& Az, const double Px, const double Py, const double Pz) { if (Py >= 1.0) { // check for pole Ax = 0; Az = 0; } else { double Rx = Px/(1.0  Py); // Riemann projection Ax = atan2(2.0*Rx, Rx*Rx  1.0); // arc length double Rz = Pz/(1.0  Py); Az = atan2(2.0*Rz, Rz*Rz  1.0); } }
// inputs: arc lengths Ax, Az // outputs: point on unit sphere (Px, Py, Pz) // (origin at the pole) void monopolar2cartesian(double& Px, double& Py, double& Pz, const double Ax, const double Az) { if (Ax*Az == 0.0) { // if either Ax or Az equal zero Px = 0.0; Py = 1.0; Pz = 0.0; } else { double Rx = sin(Ax)/(1.0  cos(Ax)); // Riemann projection double Rz = sin(Az)/(1.0  cos(Az)); double temp = 2.0/(Rx*Rx + Rz*Rz + 1.0); // ray parameter Px = Rx*temp; Py = 1.0  temp; Pz = Rz*temp; } }


« Last Edit: January 17, 2010, 10:16:55 AM by hobold »

Logged




hobold
Fractal Bachius
Posts: 572


« Reply #21 on: January 17, 2010, 10:19:04 PM » 

Msltoe lent me a hand in doing a few renders of my own. I think I can now state with some confidence that his first picture (reply #14, on page 1) is "correct", albeit with the origin of the spherical coordinates opposite the pole. My first formulas had erroneously put the origin there, and consequently, Paolo's inverse transform did the same.
With the origin of the spherical coordinates at the pole, the image looks quite different. Still, this isn't the holy grail. Sorry.




kram1032


« Reply #22 on: January 17, 2010, 10:28:51 PM » 

I think, the holy grail already was found: A whole family of 3DMandelbrots Often there are multiple ways to generalize a simple principle and if you generalize the generalizations, you suddenly find a singe solution, including them all... Most likely, this is happening here



Logged




Paolo Bonzini
Guest


« Reply #23 on: January 18, 2010, 09:27:11 AM » 

Thanks, msltoe, for your quick efforts! That mushroom doesn't look nearly as boring as I had suspected.
Here is my attempt at an inverse coordinate transform. I don't have a closed formula, but the amount of computation is quite reasonable. From the arc lengths Ax and Az, first we compute Riemann projections onto the cartesian axes:
Rx = sin(Ax)/(1  cos(Ax)) Rz = sin(Az)/(1  cos(Az))
Your steps are the same as my computation except that in this step I have Rx = cot Ax + csc Ax = (cos(Ax) + 1)/sin(Ax) Rz = cot Az + csc Az = (cos(Az) + 1)/sin(Az) which is exactly the reciprocal. Have you checked that you can "roundtrip" a conversion? BTW if you fix the sign in the formulas for cartesian>riemannian coordinates, my formulas can be easily adjusted to cope with the change: just change the sign of Px and Pz so that the last step becomes the same as yours: Px = 2*Rx/(Rx^2+Rz^2+1) Py = (Rx^2+Rz^21)/(Rx^2+Rz^2+1) Pz = 2*Rz/(Rx^2+Rz^2+1) @msltoe: strictly speaking it is incorrect to use always the same sign in cot/csc (the reason you get two solutions is that taking the tangent reduces the period from 2pi to pi, and you have to choose the solution in the right half), you may give a try to using the right sign.



Logged




hobold
Fractal Bachius
Posts: 572


« Reply #24 on: January 18, 2010, 11:03:14 AM » 

Have you checked that you can "roundtrip" a conversion? That's what I meant with sanity check (in reply #20): take a random point on the unit sphere, transform it onto two arc lengths, then transform those back onto cartesian coordinates and subtract the result from the original random point. For a few million points, the transform was accurate within 15 to 16 decimals. My way of generating random points on the sphere was not optimal, but good enough for these purposes, I guess: create uniformly distributed random points in the (1, 1, 1) to (1, 1, 1) cube and normalize them to unit length. In my first attempt (reply #6), I had unintentionally placed the spherical origin opposed to the pole. Later (in reply #20) it is at the pole, because I "fixed" the forward transform to fit my intentions (while you accounted for my misplaced origin in your inverse transform). Msltoe's images, despite the uncertainty in sign, agree with my own experiments so far. I have tried both alternatives, with the spherical origin either at the pole or opposite to it, and msltoe's images look exactly like mine when the origin is opposite. BTW, here is a degree 8 version of the monopolar fractal. In contrast to msltoe's picture (in reply #17), I used coordinates with the origin at the pole. The general feel of the images is very similar, but they differ quite a bit in the distribution of detail. I am particularly intrigued by the structure that seems to be a four pronged star, apparently diagonal to the monopolar coordinate axes, a little below and left to the image center. I don't think this thing is visually as rich as the mandelbulb. But on the positive side, the minibulbs here seem to vary more strongly as you travel around the "planet". So there are flat, spiky, and squeezed minibulbs to be explored ... this certainly looks like an interesting alternative to the usual triplex coordinates, which finally brings us back to the topic. :)


« Last Edit: January 18, 2010, 11:19:25 AM by hobold »

Logged




hobold
Fractal Bachius
Posts: 572


« Reply #25 on: January 18, 2010, 07:09:20 PM » 

I set my mind on learning more about the nuts and bolts of fractal rendering algorithms. In terms of image quality, the distance estimators seem to be the best bet.
But for those, I need to get a better understanding of the monopolar coordinate transforms. Ideally, I should try to eliminate the trigonometric function calls, and find derivatives analytically. I have read that this has been done for the original triplex mandelbulb. Is there a standard approach to this kind of reformulation, or was it all hard work and divine inspiration?



Logged




Timeroot


« Reply #26 on: January 18, 2010, 08:45:56 PM » 

Well, it seems everyone is working with the monopolar system, but I'd still like to see what results from using a bidistance coordinate system. I first tried to work what exactly the mapping is in 2D so I could generalize it to 3D... That is, for polar coordinates, the mapping is (Theta,R)>(2*Theta,R^2), which can be generalized to (Theta,Phi,R)>(2*Theta,2*Phi,R^2). For Cartesian it's (x,y)>(x^2y^2,2xy), which can be generalized using quaternions. I tried to figure out the mapping of (Da,Db) _{S}, where Da is the distance from (0,1), Db is the distance from (0,1), and S is 1 or 1 based on the sign of the xcoordinate. Sadly, the mapping for the 2D mandelbrot is very complex; I can't see much pattern to it, making it hard to bring into 3D. First we map (Da,Db) to (x,y) using the correct formula, then (x,y) to (xNew,yNew) using regular complex squaring, and then from (xNew,yNew) back to (DaNew,DbNew). I've found that (xNew,Ynew), as a function of Da and Db, is Then, (DaNew,DbNew) = ( Sqrt(xNew^2 + (yNew1)^2) , Sqrt(xNew^2 + (yNew1)^2). I can't find any pattern to this polynomial for yNew, other than, in each group where Da and Db are raised to the same power overall, (that is, if it's Da^n * Db^m, the portion of the polynomial where n+m is constant) the signs alternate, and it's symmetric. Some of the coefficients remind me of the Boole's rule/Simpson's 3/8 rule, but they aren't the same. Any thoughts?



Logged

Someday, man will understand primary theory; how every aspect of our universe has come about. Then we will describe all of physics, build a complete understanding of genetic engineering, catalog all planets, and find intelligent life. And then we'll just puzzle over fractals for eternity.



hobold
Fractal Bachius
Posts: 572


« Reply #27 on: January 18, 2010, 10:48:53 PM » 

This is only a crazy idea, thrown into the debate without much advance thought: if the rotation is hard to do in bidistance coordinates, why not turn around? Do the squaring in the complex plane, but the addition in bidistance space.
Okay, so this does break the paradigm of generalizing the rotation, but so what? We are exploring without a sound theoretical foundation anyway (well, except Paolo's interesting paper on representing rotations with quaternions  but that theory was discovered after the mandelbulb, not before).



Logged




kram1032


« Reply #28 on: January 18, 2010, 11:42:07 PM » 

hobold: If you find a derivative of the first term for the set, anlytically, it's easy to get any further term as the chainrule applies then which gives



Logged




Timeroot


« Reply #29 on: January 19, 2010, 02:37:39 AM » 

This is only a crazy idea, thrown into the debate without much advance thought: if the rotation is hard to do in bidistance coordinates, why not turn around? Do the squaring in the complex plane, but the addition in bidistance space.
Okay, so this does break the paradigm of generalizing the rotation, but so what? We are exploring without a sound theoretical foundation anyway (well, except Paolo's interesting paper on representing rotations with quaternions  but that theory was discovered after the mandelbulb, not before).
Actually, I'd considered that. The problem is that not all coordinate pairs for bidistal (adjective form ?) coordinates are valid. For instance, (1 , 2.5) and (2 , 3) are both valid coordinates, but (3 , 5.5) isn't.



Logged

Someday, man will understand primary theory; how every aspect of our universe has come about. Then we will describe all of physics, build a complete understanding of genetic engineering, catalog all planets, and find intelligent life. And then we'll just puzzle over fractals for eternity.



