cKleinhuis
|
|
« on: April 08, 2012, 06:32:47 PM » |
|
hi there, i am right now for the tvshow preparing a tutorial about what a mandelbulb is, as example i want to develop the mandelbulb formula from standard ultrafractal 5 formula and i am now ready finished with the formula, but i am unsure if everything is implemented correctly, if somebody could extract slices of various z-values and compare them to my output ? i am using triplex definition as defined here http://www.fractalforums.com/theory/triplex-algebra/i am just unsure if everything is correct, for example i see large away isles when using exponent 8 and a zslice value of 0.6 but this does not seem to correspond to standard mandelbulb renderers, or am i just getting it wrong ? please check! class Tut_1_4_Standard_Mandelbrot(common.ulb:DivergentFormula) { ; ; Object version of Mandelbrot in Standard.ufm. ; Generic Mandelbrot set. ; public: complex func Init(complex pz) fPixelx = real(pz) fPixely = imag(pz) fPixelz = @zslice
x=real(@start) y=imag(@start) z=@start2 ;just return something return @start endfunc
complex func Iterate(complex pz) float newreal= exponentiateWithRealX(x,y,z,real(@p_power)) float newimag= exponentiateWithRealY(x,y,z,real(@p_power)) float newz= exponentiateWithRealZ(x,y,z,real(@p_power))
x=newreal+fPixelx y=newimag+fPixely z=newz+fPixelz ; just return something return pz;
endfunc
bool func IsBailedOut(complex pz) ; perform bailout test using our local variables... return sqrt(x*x+y*y+z*z) > @p_bailout endfunc float func exponentiateWithRealX(float x,float y,float z ,float exponent) ; Convert Complex Number z to polar form via: float length=sqrt(x*x+y*y+z*z) ; modulus, or simply the length of the number: hello phytagoras! if(length==0) length=0.000001 endif
float angle=atan2(x+flip(y)) ; nasty atan2 function that returns the angle of the point from coordinate origin...
float angle2=asin( z/length)
; exponentiate length, just like a normal real number ... when exponentiating it is stretched on x-axis, ; in polar coordinates it is stretched along its direction float newlength= length^exponent ; hence complex multiplication is a rotation, e.g. (0,1i)*(0,1i)=(-1,0) where a 90 degree rotation is performed ; we multiply the angle with the exponent ... float newangle= angle*exponent float newangle2= angle2*exponent
; now create the complex number from newlength and newangle ; using standard sin/cos multiplied by length float newreal= (cos(newangle2)*cos(newangle))*newlength ;float newimag= sin(newangle)*newlength
; create complex number and return, the flip serves as helper to convert the real number to imaginary.... ; seems to be some compiler problem in uf ... return (newreal,newimag) does an "operator needed" compiler error, dunno why.... return newreal
endfunc float func exponentiateWithRealY(float x,float y,float z ,float exponent) ; Convert Complex Number z to polar form via: float length=sqrt(x*x+y*y+z*z) ; modulus, or simply the length of the number: hello phytagoras! if(length==0) length=0.000001 endif
float angle=atan2(x+flip(y)) ; nasty atan2 function that returns the angle of the point from coordinate origin...
float angle2=asin( z/length)
; exponentiate length, just like a normal real number ... when exponentiating it is stretched on x-axis, ; in polar coordinates it is stretched along its direction float newlength= length^exponent ; hence complex multiplication is a rotation, e.g. (0,1i)*(0,1i)=(-1,0) where a 90 degree rotation is performed ; we multiply the angle with the exponent ... float newangle= angle*exponent float newangle2= angle2*exponent
; now create the complex number from newlength and newangle ; using standard sin/cos multiplied by length ;float newreal= cos(newangle)*newlength float newimag= (cos(newangle2)*sin(newangle))*newlength
; create complex number and return, the flip serves as helper to convert the real number to imaginary.... ; seems to be some compiler problem in uf ... return (newreal,newimag) does an "operator needed" compiler error, dunno why.... return newimag
endfunc
float func exponentiateWithRealZ(float x,float y,float z ,float exponent) ; Convert Complex Number z to polar form via: float length=sqrt(x*x+y*y+z*z) ; modulus, or simply the length of the number: hello phytagoras! if(length==0) length=0.000001 endif
float angle=atan2(x+flip(y)) ; nasty atan2 function that returns the angle of the point from coordinate origin...
float angle2=asin( z/length)
; exponentiate length, just like a normal real number ... when exponentiating it is stretched on x-axis, ; in polar coordinates it is stretched along its direction float newlength= length^exponent ; hence complex multiplication is a rotation, e.g. (0,1i)*(0,1i)=(-1,0) where a 90 degree rotation is performed ; we multiply the angle with the exponent ... ;float newangle= angle*exponent float newangle2= angle2*exponent
; now create the complex number from newlength and newangle ; using standard sin/cos multiplied by length ;float newreal= cos(newangle)*newlength float newz= sin(newangle2)*newlength
; create complex number and return, the flip serves as helper to convert the real number to imaginary.... ; seems to be some compiler problem in uf ... return (newreal,newimag) does an "operator needed" compiler error, dunno why.... return newz
endfunc
private: float fPixelx float fPixely float fPixelz
float x; float y; float z;
default: title = "Mandelbulb Tut 1_4 - Triplex Exponentiation" rating = recommended helpfile = "Uf*.chm" helptopic = "Html/formulas/standard/mandelbrot.html" param start caption = "Starting point X/Y" default = (0,0) hint = "The starting point parameter can be used to distort the Mandelbrot \ set. Use (0, 0) for the standard Mandelbrot set." endparam param start2 caption = "Starting point Z" default = 0.0 hint = "Z-Value Starting Point" endparam param zslice caption = "Z Slice" default = 0.0 hint = "Z-Value Starting Point" endparam param p_power ; Overrides p_power from Formula caption = "Power" default = (2.0,0) hint = "" endparam float param p_bailout ; Overrides p_bailout from DivergentFormula caption = "Bailout value" default = 4.0 min = 1.0 exponential = true hint = "This parameter defines how soon an orbit bails out while \ iterating. Larger values give smoother outlines; values around 4 \ give more interesting shapes around the set. Values less than 4 \ will distort the fractal." endparam }
|
|
« Last Edit: April 08, 2012, 06:58:04 PM by cKleinhuis »
|
Logged
|
---
divide and conquer - iterate and rule - chaos is No random!
|
|
|
cKleinhuis
|
|
« Reply #1 on: April 08, 2012, 06:34:13 PM » |
|
and additionally, how do you deal with length=0 special case ? as you can see i set length to 0.000001 but i think it would be better to just return 0 ? but 0^0 = 1 ?
|
|
|
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 #2 on: April 08, 2012, 09:03:42 PM » |
|
but 0^0 = 1 ?
In maths 0^0 is not determined... In a fractal 0 is almost never 0 so it depends on which value you choose
|
|
|
Logged
|
No sweat, guardian of wisdom!
|
|
|
cKleinhuis
|
|
« Reply #3 on: April 08, 2012, 09:28:41 PM » |
|
have you checked the formula ? btw, google says 0^0 = 1 link
|
|
|
Logged
|
---
divide and conquer - iterate and rule - chaos is No random!
|
|
|
cKleinhuis
|
|
« Reply #4 on: April 08, 2012, 09:29:45 PM » |
|
the problem is that uf5 breaks down if formula creates a division by zero....
|
|
|
Logged
|
---
divide and conquer - iterate and rule - chaos is No random!
|
|
|
asimes
|
|
« Reply #5 on: April 08, 2012, 09:30:36 PM » |
|
I don't have Ultrafractal, but if it helps pow(0, 0) is 1 for me in Processing.
|
|
|
Logged
|
|
|
|
Sockratease
|
|
« Reply #6 on: April 08, 2012, 09:56:27 PM » |
|
|
|
|
Logged
|
Life is complex - It has real and imaginary components. The All New Fractal Forums is now in Public Beta Testing! Visit FractalForums.org and check it out!
|
|
|
cKleinhuis
|
|
« Reply #7 on: April 08, 2012, 10:13:30 PM » |
|
|
|
|
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 #8 on: April 08, 2012, 10:43:35 PM » |
|
but try those calculations 0^t t^t Where t is a small value. The result is different ... 0 and 1 Btw... when Makin comes back he will help
|
|
|
Logged
|
No sweat, guardian of wisdom!
|
|
|
cKleinhuis
|
|
« Reply #9 on: April 08, 2012, 11:00:18 PM » |
|
yea, makin is easter mässig away ... but 0^0=1
|
|
|
Logged
|
---
divide and conquer - iterate and rule - chaos is No random!
|
|
|
cKleinhuis
|
|
« Reply #10 on: April 08, 2012, 11:01:29 PM » |
|
or has someone an mandelbulb3d sliced formula that i could use for comparing @darkbeam
|
|
« Last Edit: April 09, 2012, 03:56:21 AM by cKleinhuis »
|
Logged
|
---
divide and conquer - iterate and rule - chaos is No random!
|
|
|
cKleinhuis
|
|
« Reply #11 on: April 09, 2012, 03:50:16 AM » |
|
i have this slice for triplex z-slice=-0.648993
|
|
|
Logged
|
---
divide and conquer - iterate and rule - chaos is No random!
|
|
|
cKleinhuis
|
|
« Reply #12 on: April 09, 2012, 05:40:41 AM » |
|
but isles are valid i think it should be ok, although it isnt optimised in any ways
|
|
|
Logged
|
---
divide and conquer - iterate and rule - chaos is No random!
|
|
|
hobold
Fractal Bachius
Posts: 573
|
|
« Reply #13 on: April 09, 2012, 02:22:30 PM » |
|
There is no single consistent definition for 0^0. In my experience, mathematicians just choose 1 or 0 as a result, depending on what's more convenient for a particular line of thought. (I.e. not on a line by line basis. But, say, for the proof of a particular theorem, which would consistently use one of the alternatives.)
|
|
|
Logged
|
|
|
|
DarkBeam
Global Moderator
Fractal Senior
Posts: 2512
Fragments of the fractal -like the tip of it
|
|
« Reply #14 on: April 09, 2012, 06:14:55 PM » |
|
hi there, i am right now for the tvshow preparing a tutorial about what a mandelbulb is, as example i want to develop the mandelbulb formula from standard ultrafractal 5 formula and i am now ready finished with the formula, but i am unsure if everything is implemented correctly, if somebody could extract slices of various z-values and compare them to my output ? i am using triplex definition as defined here http://www.fractalforums.com/theory/triplex-algebra/i am just unsure if everything is correct, for example i see large away isles when using exponent 8 and a zslice value of 0.6 but this does not seem to correspond to standard mandelbulb renderers, or am i just getting it wrong ? please check! My holy Saint Spaghetti Codes!!! I tried your formula, I must say I would be very curious to see how it's rendered in 3D... I was able to run it only after creating an ulb. Another complication! But I can not understand a row of your damnedly complicated code! The "real" formula is far less complicated than that... 5/6 rows of code and no need of all that commentary. Please think simpler! Thanks!
|
|
|
Logged
|
No sweat, guardian of wisdom!
|
|
|
|