Logo by yv3 - 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 23, 2024, 11:32:11 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: can someone confirm correctness of uf5 mandelbulb formula?  (Read 8080 times)
0 Members and 1 Guest are viewing this topic.
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« 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!  police alien
Code:

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
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« 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 evil
Logged

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


formerly known as 'Trifox'


WWW
« 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
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« 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
Fractal Lover
**
Posts: 212



asimes
WWW
« 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
Global Moderator
Fractal Senior
******
Posts: 3181



« Reply #6 on: April 08, 2012, 09:56:27 PM »

http://betterexplained.com/articles/understanding-exponents-why-does-00-1/

 nasty teeth
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
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #7 on: April 08, 2012, 10:13:30 PM »

dudes has anyone tried the formula?huh?huh?huh?
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 smiley
Logged

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


formerly known as 'Trifox'


WWW
« Reply #9 on: April 08, 2012, 11:00:18 PM »

yea, makin is easter mässig away ... cheesy
but 0^0=1
Logged

---

divide and conquer - iterate and rule - chaos is No random!
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #10 on: April 08, 2012, 11:01:29 PM »

or has someone an mandelbulb3d sliced formula that i could use for comparing huh?
@darkbeam  smooth....
« Last Edit: April 09, 2012, 03:56:21 AM by cKleinhuis » Logged

---

divide and conquer - iterate and rule - chaos is No random!
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #11 on: April 09, 2012, 03:50:16 AM »

i have this slice for triplex z-slice=-0.648993


* Clipboard02.jpg (44.93 KB, 629x476 - viewed 290 times.)
Logged

---

divide and conquer - iterate and rule - chaos is No random!
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #12 on: April 09, 2012, 05:40:41 AM »

but isles are valid wink
i think it should be ok, although it isnt optimised in any ways sad
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!  police alien

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! wink
But I can not understand a row of your damnedly complicated code! undecided shocked The "real" formula is far less complicated than that... 5/6 rows of code and no need of all that commentary.  wink Please think simpler! Thanks! wink
Logged

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

Related Topics
Subject Started by Replies Views Last post
Where does THE formula come from ? Mandelbrot & Julia Set bib 5 5272 Last post January 26, 2009, 07:12:10 PM
by cKleinhuis
THE formula for Mandelbulb? Theory ZsquaredplusC 6 10616 Last post November 22, 2009, 11:33:21 PM
by s31415
Mandelbulb complete formula 3D Fractal Generation GliderKite 11 6891 Last post November 14, 2010, 01:09:36 AM
by twinbee
Duplicate Subblue 3D Mandelbulb Ray Tracer Object in Mandelbulb 3d? Mandelbulb 3d Holtenwood 9 6013 Last post March 22, 2012, 09:07:26 AM
by DarkBeam
Extract mathematical formula from Mandelbulb feature request « 1 2 » grasshopper 19 11934 Last post February 28, 2013, 01:53:39 PM
by cKleinhuis

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