Logo by Tglad - 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. November 30, 2025, 10:34:24 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: Beginner's problems with the Mandelbox formula  (Read 7460 times)
0 Members and 1 Guest are viewing this topic.
smooo
Guest
« on: January 24, 2011, 12:47:08 AM »

Hey guys,

I'm totally new to fractals but always was impressed by these great images. In university my friend and I have this project to implement a version of Mandelbox with zoom and stuff. As I never worked with fractals I'm not that sure about my interpretation of the formula. I used the formula described in Wikipedia (http://en.wikipedia.org/wiki/Mandelbox).

We are programming in C and use the OpenGL library to draw each point which is stored in an array (with x and y value).

My current code looks like this:
Code:
float mandel_array[100][100];
...

function mandelbox() {
  for (each vector v of the mandel_array) {
    do (iteration times) {
      // Formula from Wikipedia
       for (each axis)
         if (v[axis]>1) v[axis] = 2-v[axis];
         else if (v[axis]<-1) v[axis] = -2-v[axis];
       if (v.magnitude() < 0.5) v *= 4;
       else if (v.magnitude() < 1) v /= square(v.magnitude());
       v = scale*v + c;

       if (v.magnitude() > 2) break;
    }
  }
}

First question:
Is it right to do a break if the magnitude is higher than 2? And why?

Second problem:
After using this function I get points that are "randomly" somewhere in space. Do you normalize the points to a certain range (like -1.0 to +1.0)?

Third question:
What is this c value in "v = scale*v + c" standing for?

I'm really hoping some of you can help me!

Thanks a lot!
smooo
Logged
Tglad
Fractal Molossus
**
Posts: 703


WWW
« Reply #1 on: January 24, 2011, 12:59:39 AM »

"Is it right to do a break if the magnitude is higher than 2? And why"
Not right, if scale is negative then the box radius is 2, but you should exit when the magnitude is > 4, to allow for the corners. For scale=2 the box radius is 6.

"After using this function I get points that are "randomly" somewhere in space. Do you normalize the points to a certain range (like -1.0 to +1.0)?"
You plot the first value of v, not the final one... and should only find inside points between -2,-2,-2 and 2,2,2 in -ve scale.

"What is this c value in "v = scale*v + c" standing for?"
c is the initial value of v, so there'll be a unique c for each point in your array, but for each point c will not vary during the iterations.

Hope that helps smooo
Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #2 on: January 24, 2011, 10:35:24 AM »

the reason because you leave the iteration loop after the "bailout" is, because after a certain magnitude, the follow up values will always be larger then the one before, so the point "diverges" escape time formulas like the mandelbrot show points that "do not diverge"

regards
Logged

---

divide and conquer - iterate and rule - chaos is No random!
smooo
Guest
« Reply #3 on: January 24, 2011, 11:07:17 PM »

Thanks very very much for your help!

I did a few changes in my code and now it looks like the image below (scale = 2.0, radius = 6.0). At least a little bit like a Mandelbox. smiley


Plus another question: What's exactly the dependency (formula) between scale and radius?

If you have any tips for the OpenGL rendering just post it. Right now I'm drawing single gl_points so it still has many holes. wink

smooo
« Last Edit: January 24, 2011, 11:46:37 PM by smooo » Logged
Tglad
Fractal Molossus
**
Posts: 703


WWW
« Reply #4 on: January 25, 2011, 12:18:38 AM »

That actually looks about right... only, its a picture of scale -2.
-ve scale all have radius 2, +ve scale have larger radius closer to scale 1, and smaller the larger the scale is.
Logged
smooo
Guest
« Reply #5 on: February 08, 2011, 04:43:13 PM »

Hey again,

finally I wanted to thank you for helping me. smiley

The last days we went on fixing some bugs and parallelizing the mandelbox calculation in CUDA.
Of course you were mentioned in our presentation. wink

Byebye,
smooo
Logged
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Understanding the Mandelbox formula (for 2D) Programming jwm-art 6 9311 Last post November 23, 2010, 05:48:17 AM
by Tglad
The tetrahedral Mandelbox, formula and some parameters (new) Theories & Research DarkBeam 5 1694 Last post April 17, 2013, 02:33:14 PM
by Alef
(Beginner) Escape conditions for mandelbox 3D Fractal Generation barkeg 14 6698 Last post August 26, 2011, 01:50:09 AM
by knighty
Is there a formula for M3d simular to mandelbulber's mandelbox vary scale 4d? Mandelbulb 3d wolfwing1 3 5863 Last post August 03, 2011, 09:36:34 AM
by taurus
Mandelbox DE formula 3D Fractal Generation khyperia 5 6973 Last post April 04, 2012, 01:48:32 PM
by DarkBeam

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.318 seconds with 27 queries. (Pretty URLs adds 0.016s, 2q)