Logo by Fractal Ken - 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. August 11, 2020, 08:46:26 PM


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: Revenge of the (half-eaten) menger sponge  (Read 34162 times)
Description: Depth 7 no less!
0 Members and 1 Guest are viewing this topic.
twinbee
Fractal Fertilizer
*****
Posts: 383



WWW
« on: October 31, 2009, 03:38:45 PM »

Looked around the net - only depth 6 menger sponges seem to exist at most, so I couldn't resist creating a level 7 with over 1.2 billion cubes!

I added a couple of twists too. Here is the full 4 megabyte version (near 4000x4000 !). Below are a couple of previews. I'll be adding some tasty perspective next time.



« Last Edit: November 25, 2009, 11:40:45 AM by twinbee » Logged
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #1 on: November 01, 2009, 12:03:14 AM »

Granted this isn't as high-resolution and you only get to see part of the sponge in detail, but it does go somewhat more than 6 levels deep:

http://www.youtube.com/user/MakinMagicFractals#p/u/5/YYlpkqPk0i8
Logged

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

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
twinbee
Fractal Fertilizer
*****
Posts: 383



WWW
« Reply #2 on: November 01, 2009, 01:53:11 AM »

Heh, that is cool - think I saw it before. Gotta be around 20 depth levels I think!

At the moment, rather than using an iterated 'chopping' or 'building' approach to create the object for my menger sponge, it's done entirely through a function. In other words, the function inputs an x,y,z and outputs whether that point is in the set. Not sure how much quicker or slower it is than usual. In theory it should be much slower, because it has to calculate for every pixel. I wonder how much more optimzed the function can be though - could be some shortcuts here and there.

The advantage of course is that the memory used is virtually nil no matter how many iterations are used.

Code:
bool mengerSponge(double x, double y, double z) {

if(x<0 || x>1 || y<0 || y>1 || z<0 || z>1 )     { return 0; } // point is not part of menger sponge

int iterations=8;

double depth=3;

for(int iter=0; iter<iterations; iter++) {
int holex=1;
while(holex<depth) {
int holey=1;
while(holey<depth) {
if(
((x > holex/depth && x< (holex+1) /depth) && (y > holey/depth && y< (holey+1) /depth)) ||
((y > holex/depth && y< (holex+1) /depth) && (z > holey/depth && z< (holey+1) /depth)) ||
((x > holex/depth && x< (holex+1) /depth) && (z > holey/depth && z< (holey+1) /depth))
) { return 0; } // point is not part of menger sponge
holey+=3;
}
holex+=3;
}
depth*=3;
}

return 1; // point is part of menger sponge
}
« Last Edit: November 01, 2009, 02:08:53 AM by twinbee » Logged
twinbee
Fractal Fertilizer
*****
Posts: 383



WWW
« Reply #3 on: November 03, 2009, 10:40:52 PM »

Okay it turns out my above function is hopelessly inefficient (it's a miracle I coaxed a giant iteration 7 image out of it). The worst case time complexity is around O( n(9^n) ). Compare that to the one I created below which is O(n). Yep, just a tiny bit faster (!).

The great thing is now, any amount of iterations (even thousands) are trivial to do, and very fast, and eat up next to no memory. I'm in the middle of some giant 3D brot images, but I can't resist a couple more menger sponge renders:

Code:
bool MengerSponge(double x, double y, double z) {
int iterations=7;
if(x<0.0 || x>1 || y<0 || y>1 || z<0 || z>1 )     { return 0; } // Not part of menger sponge
double p=3.0;
for(int m=1; m<iterations; m++) {
double xa = floatmod(x*p, 3);
double ya = floatmod(y*p, 3);
double za = floatmod(z*p, 3);
if(
(xa > 1.0 && xa < 2.0   &&   ya > 1.0 && ya < 2.0) ||
(ya > 1.0 && ya < 2.0   &&   za > 1.0 && za < 2.0) ||
(xa > 1.0 && xa < 2.0   &&   za > 1.0 && za < 2.0)

) {return 0;}  // Not part of menger sponge
p*=3;
}
return 1;  // Is part of menger sponge
}

Full sizes are available here and here (8000x5000 pixels!). The first one is 9 iterations. No more are needed because the resolution would need to be even larger to contain the tiny holes.


« Last Edit: November 25, 2009, 11:35:26 AM by twinbee » Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #4 on: November 03, 2009, 11:42:06 PM »

yeah, a menger castle cheesy

great one!  cheesy
Logged

---

divide and conquer - iterate and rule - chaos is No random!
Dinkydau
Fractal Senior
******
Posts: 1616



WWW
« Reply #5 on: November 06, 2009, 02:15:48 PM »

Beautiful fractals!
Logged

twinbee
Fractal Fertilizer
*****
Posts: 383



WWW
« Reply #6 on: November 06, 2009, 11:44:32 PM »

Thanks both! I'll see if I can work on some stranger variations of the menger with a specially mapped colour surface. Perhaps translucent may look cool.
Logged
Buddhi
Fractal Iambus
***
Posts: 895



WWW
« Reply #7 on: November 21, 2009, 03:55:57 PM »

Hi

Daniel White inspired me to render something with logical iteration formula. I made some trials and found some interesting (and very simple) formula:
Code:
for (L = 0; L < N; L++)
{
  double xx = fmod(a * k, 2.0)-1.0;
  double yy = fmod(b * k, 2.0)-1.0;
  double zz = fmod(c * k, 2.0)-1.0;
  if ((xx*xx + yy*yy + zz*zz < 1.03))
  {
     result = 0;
     break;
   }
   k *= 4.0;
   result = 1;
}



full size (3200x3200): http://krzysztofmarczak.deviantart.com/art/Fractal-cheese-144292130

Logged

cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #8 on: November 21, 2009, 04:00:19 PM »

simply awesome !

 Repeating Zooming Self-Silimilar Thumb Up, by Craig Repeating Zooming Self-Silimilar Thumb Up, by Craig
Logged

---

divide and conquer - iterate and rule - chaos is No random!
kram1032
Fractal Senior
******
Posts: 1863


« Reply #9 on: November 21, 2009, 04:09:10 PM »

buddhi:
yay it's a menger sphere cheesy

Really nice stuff smiley

twinbee: What ever link I try, all are 404 - not found.... sad
Logged
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #10 on: November 21, 2009, 04:14:41 PM »

@Buddhi

That's the most awesome and original fractal I've seen in years !
Now...how to get a distance estimate for it....
Logged

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

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
Buddhi
Fractal Iambus
***
Posts: 895



WWW
« Reply #11 on: November 21, 2009, 04:42:25 PM »

I haven't used distance estimate. Only binary searching. But I think there is possible to find estimation for this. In formula there is condition:
if ((xx*xx + yy*yy + zz*zz < 1.03))
and I think after last iteration this is distance to nearest spherical surface. I have to try with this.
Logged

Buddhi
Fractal Iambus
***
Posts: 895



WWW
« Reply #12 on: November 21, 2009, 07:27:46 PM »

Another view of "menger sphere"


http://www.fractalforums.com/gallery/?sa=view;id=1078
Logged

kram1032
Fractal Senior
******
Posts: 1863


« Reply #13 on: November 21, 2009, 07:49:33 PM »

now I wonder, how effective that would be as a fractal antenna xD
It's great cheesy

Is it enclosed from outside or can you see inward? (in the first image, I can see a hole which seems to lead outside..)

Any idea of the fractal dimension? Is it just like for the Mengersponge?
Logged
Buddhi
Fractal Iambus
***
Posts: 895



WWW
« Reply #14 on: November 21, 2009, 07:59:34 PM »

There is no outside. It is an infinite construction. Last picture it's a view from front of some big sphere into smaller spheres. Camera is inside this sphere.

Is it just like for the Mengersponge?
Yes, it is something like Menger Sponge. Algorithm is nearly the same but for limits I used spheres instead of cubes.
Logged

Pages: [1] 2   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
A Menger Sponge Images Showcase (Rate My Fractal) David Makin 5 3459 Last post April 02, 2007, 03:16:32 AM
by bradorpoints
Menger sponge fly-through 3D Fractal Generation twinbee 10 4616 Last post February 16, 2009, 05:43:21 AM
by twinbee
Menger Sponge (Magnification 1e14) IFS - Iterated Function Systems David Makin 0 3051 Last post July 28, 2009, 12:48:02 AM
by David Makin
4D Menger sponge Sierpinski Gasket « 1 2 » makc 27 8176 Last post December 09, 2016, 04:01:39 PM
by knighty
3D menger sponge fly through Movies Showcase (Rate My Movie) DonWebber 0 1743 Last post September 14, 2010, 01:01:18 AM
by DonWebber

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.219 seconds with 28 queries. (Pretty URLs adds 0.015s, 2q)