POV-Ray : Newsgroups : povray.advanced-users : The Menger Sponge Conundrum Server Time
21 Jun 2024 16:25:47 EDT (-0400)
  The Menger Sponge Conundrum (Message 1 to 6 of 6)  
From: stbenge
Subject: The Menger Sponge Conundrum
Date: 9 Dec 2010 13:39:45
Message: <4d012271@news.povray.org>
Hello,

I'm trying to get the Menger Sponge working with my Kaleidoscopic IFS 
setup, but the geometry is doubled along the Z-axis.

I'm replacing

KIFS_0(
  x*Scale-CX*(Scale-1),
  y*Scale-CY*(Scale-1),
  z*Scale-CZ*(Scale-1))
)

with

KIFS_0(
  x*Scale-CX*(Scale-1),
  y*Scale-CY*(Scale-1),
  select( -(z*Scale-.5*CZ*(Scale-1)), (z*Scale-CZ*(Scale-1)),
)

which should work the same as the "if" statement in the last example of 
the first post in this thread: 
http://www.fractalforums.com/3d-fractal-generation/kaleidoscopic-%28escape-time-ifs%29/?PHPSESSID=47d4a7c03e14fe8cb7b5e50f56dcb0dd

I have battled with translation issues during the entire creation 
process. Doing things in POV-Ray is quite a bit different than other 
methods, but am not complaining since other things are made easier. But 
I'm pretty sure that is why it doesn't work as expected...

Any thoughts on this matter are appreciated!

Sam


Post a reply to this message

From: stbenge
Subject: Re: The Menger Sponge Conundrum
Date: 13 Dec 2010 17:16:19
Message: <4d069b33@news.povray.org>
On 12/9/2010 10:39 AM, stbenge wrote:
>...

Perhaps my question is better asked elsewhere, or nowhere. I can't 
possibly expect someone to look through my code base... but I was hoping 
for a little insight. I've tried all the obvious things already :/


Post a reply to this message

From: Christian Froeschlin
Subject: Re: The Menger Sponge Conundrum
Date: 14 Dec 2010 15:36:12
Message: <4d07d53c@news.povray.org>
Are you sure you posted the entire select statement?

Unless the KIFS macro is even more advanced (or convoluted?)
than it appears, the commas and parantheses don't quite seem
to match up.

Under the assumption that

   y=scale*y-CY*(scale-1);

corresponds to

   y*Scale-CY*(Scale-1),

I'd expect

   z=scale*z;
   if(z>0.5*CZ*(scale-1)) z-=CZ*(scale-1);

to correspond to something like

   select(0.5*CZ*(Scale-1)-Scale*z,Scale*z-CZ*(Scale-1),Scale*z)

which seems indeed to be identical to what you posted
except for the excluded last Scale*z part. There is of
course also the possiblity that the OP accidentally
posted a wrong version of the source code.

> Perhaps my question is better asked elsewhere, or nowhere. I can't 
> possibly expect someone to look through my code base... but I was hoping 
> for a little insight. I've tried all the obvious things already :/

well ... although you sometimes deprecate your own technical
knowledge you are actually one of the masters and I don't think
there are that many people here who can actually understand your
code without investing a significant amount of time to read up
on all the theory first (I played around with your code for a
while and am still not quite sure what it does, although I
allegedly should have a math degree lying around somewhere).


Post a reply to this message

From: stbenge
Subject: Re: The Menger Sponge Conundrum
Date: 16 Dec 2010 18:25:55
Message: <4d0aa003@news.povray.org>
On 12/14/2010 12:36 PM, Christian Froeschlin wrote:
> Are you sure you posted the entire select statement?
>
> Unless the KIFS macro is even more advanced (or convoluted?)
> than it appears, the commas and parantheses don't quite seem
> to match up.

Convoluted, it wouldn't be the first time ;) I somehow managed to botch 
the copy/paste; I meant to post something like this:

select(-(z*Scale-.5*CZ*(Scale-1)), z*Scale-CZ*(Scale-1), z*Scale)

...which is essentially the same as what you suggested, and has the same 
effect as well: a doubled Menger Sponge. I'll have to go over all the 
reasons of why my implementation is different from what other people 
were doing. One of the big differences is that my reflections are called 
in a different order. When I tried to directly copy the folding steps 
from other sources, I got nothing but incorrect results every time. 
Maybe I should be carrying over a second set of axis variables like 
you'd do for the M-Set... but I'm converting the pure function to a 
patterned function, so trying that out would not be a trivial task.

> well ... although you sometimes deprecate your own technical
> knowledge you are actually one of the masters and I don't think
> there are that many people here who can actually understand your
> code without investing a significant amount of time to read up
> on all the theory first (I played around with your code for a
> while and am still not quite sure what it does, although I
> allegedly should have a math degree lying around somewhere).

It's actually not that different from computing the Mandelbrot fractal 
with functions. The initial function works as the basin (practically 
irrelevant for KIFS, though it might be utilized as a coloring method), 
the first part of the main select statement is used for the bailout, the 
second for the actual work, and the third for the exterior 
coloring/distance evaluation (intimately tied to bailout). When 
experimenting with the M-Set, I was amazed at how quickly these elements 
stratified into their respective parts.

At any rate, I thank you for your reply. I'll either figure it out, or I 
won't :)

Sam


Post a reply to this message

From: SharkD
Subject: Re: The Menger Sponge Conundrum
Date: 14 Jan 2011 13:20:00
Message: <web.4d30938be8b9e73cd70fe6f50@news.povray.org>
There is a Menger Sponge script in the POVray Object Collection. Maybe you can
take a look at that.


Post a reply to this message

From: stbenge
Subject: Re: The Menger Sponge Conundrum
Date: 19 Jan 2011 14:25:16
Message: <4d373a9c$1@news.povray.org>
On 1/14/2011 10:18 AM, SharkD wrote:
> There is a Menger Sponge script in the POVray Object Collection. Maybe you can
> take a look at that.

Thanks for the idea, but I know about Menger Sponges. The Kaleidoscopic 
IFS version works on a different principle than recursive object calls.

I'll return to the problem again someday :/

Sam


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.