Logo by slon_ru - 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: Visit us on facebook
 
*
Welcome, Guest. Please login or register. April 18, 2024, 02:05:47 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: Distance Estimated Menger Sponge Normal Calculation  (Read 10179 times)
0 Members and 1 Guest are viewing this topic.
makc
Strange Attractor
***
Posts: 272



« Reply #15 on: April 02, 2013, 11:23:14 PM »

Like that is something hard to do smiley

Using code from original thread:
Code:
bool mengerSponge(double x2d, double y2d) {
/*
 * 1) cutting plane goes through 0.5,0.5,0.5
 * 2) plane normal is 1/√3,1/√3,1/√3, therefore vectors 1,-1,0 and 0,1,-1 are good 2D basis
 */
double x = 0.5 + x2d;
double y = 0.5 + y2d - x2d;
double z = 0.5 - y2d;

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
}

p.s. I happened to have this swf that renders random menger sponge cuts as you move your mouse around:
<a href="http://swf.wonderfl.net/swf/usercode/5/53/536d/536dfb5d15b061017191a4ec6bdcb2f40512deff.swf" target="_blank">http://swf.wonderfl.net/swf/usercode/5/53/536d/536dfb5d15b061017191a4ec6bdcb2f40512deff.swf</a>
« Last Edit: April 02, 2013, 11:36:01 PM by makc, Reason: p.s. » Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #16 on: April 03, 2013, 01:11:44 AM »

try this, in 3d view you can rotate the axis, it is from jesse the formula combination, i changed it to menger3, can be useful for other (fractal) cuttings for sure

 Azn
Code:

Mandelbulb3Dv18{
f.....S....O/...w....2....EKakjwGSH/.zhCqh4vvQ1Ew95Ldb3wOznIZrAY9mNazgiF6yJP9zuj
................................nmSHqnHisz1........Y./..................y.2...wD
...Uz./....0..../M.0/......T....n/....E3.....g873aGCHSqD/..........m/dkpXmH....U
z.....kD12../..........wz.................................U0.....y1...sD...../..
.z1...sDu9tznVdl5wf45nb/8QPLz25PQTOsA7qjpHkC9E7ZowvnE66HjfWMzEiwry.eOqpD3uwfwraP
bx1Kxs7KrRRAzwLG4yE4QJmDU.....Y/..............sD.6....sD.6E.....................
.............oAnAt1...sD....zw1.........................................A....k1.
.....m7lkz1.......kz.wzzz1.U..6.P....U5...EB....m....c3....F....6/...I1.....SF52
...U.qFG9yzb2zzzRYoWzz7lz16.pc..zXCc..kvrEtMc7xD6ocyFE0ujz1..........2.28.kFrA0.
.Ub96aAIVz9.1se7Umvxz0........../EU0.wzzz1...........s/...................E.2c..
zzzz.............0...................2./8.kzzzD............8....................
/EU0.wzzz1...................................2CcN/UvNPcveeWCNq0.yRiibHJJUk1f..XR
SvBmx3CcN/UvNPcvQsLsUa3.ibhVi1bTV1OK.sSq4uCly3CcN/UvNPcvMwLsUa3.ibhVinqTV1OK.sSq
4uCkz3CcN/UvNPcv..EsUa3feeWCNqGQIJ36wk8EwyLsUa3f................................
E....AU6V2E.....I....A....kLGx4RVFLN..kPrJaQ.........................MU/4.U/4M..
..................nO./......UV4E.......U4/2.....................................
................................................................................
.....................2.....3....0....wJRkFKMoJqE................................
..............................zD................................................
................................................................................
................................/....E/...U0....BJaPbJaQn..IjRLNm/..............
................4MU/4MU/................6.2........wz.........zD........kz1.....
................................................................................
............................................}
{Titel: Mandelbulb 3DckJRotate}



* Mengercuting.jpg (121.05 KB, 480x360 - viewed 811 times.)
« Last Edit: April 03, 2013, 01:13:21 AM by cKleinhuis » Logged

---

divide and conquer - iterate and rule - chaos is No random!
makc
Strange Attractor
***
Posts: 272



« Reply #17 on: April 03, 2013, 03:36:58 AM »

Wait
Code:
plane normal is 1/√3,1/√3,1/√3, therefore vectors 1,-1,0 and 0,1,-1 are good 2D basis

It's not, vectors are at right angle to normal but not to each other sad So let's keep 1,-1,0 then 2nd vector must be cross with normal = -1,-1,2. Now we have vectors of different length, √2 and √6, so we also need to scale one: 1,-1,0 now turns into √3,-√3,0. In the end it gives
x = 0.5 + 1.732 x2d - y2d
y = 0.5 - 1.732 x2d - y2d
z = 0.5 + 2 y2d

I am sleepy, so I could still mess it up, but you get the idea, right?
Logged
kram1032
Fractal Senior
******
Posts: 1863


« Reply #18 on: April 03, 2013, 10:36:02 PM »

makc, that's really nice, but you're still using a 3D Menger sponge that you then cut with a plane.
I was wondering about a formulation that never even builds a 3D Version.
Logged
makc
Strange Attractor
***
Posts: 272



« Reply #19 on: April 03, 2013, 10:43:47 PM »

I don't get it.

Suppose there is (squared) length of 3D vector, L1 = x*x+y*y+z*z. It's 3D, no problem here.

Suppose there is (squared) length of 2D vector, L2 = a*a+b*b. It's 2D, no problem here.

Now, I want to calculate L1, where x = a, y = b and z = 0. Is it 3D or 2D?

From my perspective, there is no difference, I mean I just substitute variables in some expression. What could be a problem with that?
Logged
tit_toinou
Iterator
*
Posts: 192


« Reply #20 on: April 04, 2013, 04:36:48 PM »

There is two fractals hiding in this image.
The first one is an hexagon that divides into 6 hexagons and 6 equilateral triangles.
The second one is an equilateral triangle that divides into 9 hexagons and 15 equilateral triangles (see my "Triangle de Menger" preview image).
Logged

Geometrian
Forums Freshman
**
Posts: 19


« Reply #21 on: April 17, 2013, 03:52:30 AM »

So, I've gotten a new render (direct link) (Fractal Forums art thread), but it still has a few problems.

In particular, it is using the distance estimator to calculate shadows, which mostly works. However, there's still some nasty banding artifacts in some places that I'm pretty sure are erroneous. Ideas as to what these might be caused by?
Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #22 on: April 17, 2013, 09:31:51 AM »

Hey kram i think the pure 2d version should not be too hard to implement
i have made a 2d version of the kifs in ultrafractal

but for this cut i think it should be extended to a 3d cut slice with 3d rotation possibility right now i am busy with other stuff but i plan to make a review of the kifs soon

you can find my kifs 2d variant in the uf formula database
Logged

---

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


« Reply #23 on: April 17, 2013, 12:41:03 PM »

makc, well, the 2D-sierpinsky carpet is built from squares. The 3D-menger sponge is built from cubes.
This cut-plane seems to be built from triangles with 6-pointed star shapes (that is, 12 smaller triangles in a certain configuration) being taken out of them.
I'm wondering about having a way to build it without using cubes that you then cut through at all.
Logged
makc
Strange Attractor
***
Posts: 272



« Reply #24 on: April 17, 2013, 07:11:51 PM »

kram, well:



the whole thing is just a triangle without corners
Logged
tit_toinou
Iterator
*
Posts: 192


« Reply #25 on: April 18, 2013, 10:43:17 AM »

Quote from: me
There is two fractals hiding in this image.
The first one is an hexagon that divides into 6 hexagons and 6 equilateral triangles.
The second one is an equilateral triangle that divides into 9 hexagons and 15 equilateral triangles (see my "Triangle de Menger" preview image).
Oops I was wrong (too complicated), an equilateral triangle divides into 1 hexagon and 3 little equilateral triangles, thx makc Grin with closed eyes for the image.
@kram1032: I think my description is enough to create the fractal..
Logged

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


formerly known as 'Trifox'


WWW
« Reply #26 on: April 18, 2013, 10:49:42 AM »

the triangle is split into 1 hexagon and 3 triangles, but into what is the hexagon split huh?
i mean, it would be nice to have a nice formulation of this for the hexagon as well, right now i do not see it easily  hurt
the rule seems to only rely on the star shape,

- start with a hexagon
- cutout the big star shape in the middle
- repeat with the six remaining hexagons

.... but i thing it is missing the "triangle sections ... sad there must be a 2 way rule... sad
« Last Edit: April 18, 2013, 10:57:45 AM by cKleinhuis » Logged

---

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


« Reply #27 on: April 18, 2013, 11:54:08 AM »

Well, you essentially fill a hexagon with smaller hexagons that touch each other and are alligned with the starting hexagon's corners.
However, alongside each edge, there will be a missing triangle that you need to fill in too.
Repeat as before for the hexagons but
note that the edge-triangles also has a new hexagon inside them, that you need to repeat the process with too, however
you again need to fill the new holes around the triangles in that iteration.

It's a bit more complicated than your typical Sierpinsky-type fractal because it needs some extra filling. I wonder if that's actually necessary though.

Equivalently you could probably also start from a triangle of which you cut away the corners to form a hexagon.
In either case, it seems to be a two-step iteration loop, rather than a single-step one. In that sense, it's more complicated than a typical 2D sierpinsky-type fractal...
Unless there is some way (other than going 3D and just cutting out the final result from an arbitrarily iterated menger sponge) to merge the two steps into one.
(Even cutting the final form out of an iterated 3D object seems like an additional step)

If you don't fill the missing triangles, you'll instead end up with something that looks like a Koch-flake- with Kock-flake-holes inside each Koch-flake-part:


On a different note:
Would anything change if you tried this with a menger-hypercube? Are there other interesting special cut-planes in that case?
What about interesting cut 3-planes, e.g. 3D cut-outs from 4D-structures?
Notably, that problem would be related to Quasicrystal-structures: If you cut a 3D space from an n-D periodic structure (n>3), you'll get all possible crystal structures if the 3D space is rotated with rational angles.
quasi-crystals happen if the angle is irrational (for instance the golden angle, which corresponds to a Penrose-tiling)
In case of a high-dimensional menger-cube it would obviously be a regular n-cube-lattice, cut in arbitrary angles. But other regular 4D structures might be tried just as well.
« Last Edit: April 18, 2013, 12:25:35 PM by kram1032 » 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 5284 Last post April 02, 2007, 03:16:32 AM
by bradorpoints
Menger sponge fly-through 3D Fractal Generation twinbee 10 6864 Last post February 16, 2009, 05:43:21 AM
by twinbee
3D menger sponge fly through Movies Showcase (Rate My Movie) DonWebber 0 2801 Last post September 14, 2010, 01:01:18 AM
by DonWebber
3D Julia Set Cross Section Distance Estimated Algorithm 3D Fractal Generation Geometrian 0 2356 Last post May 01, 2013, 11:16:39 PM
by Geometrian
Distance Estimated Soft Shadow Banding Artifact Programming Geometrian 1 2097 Last post May 05, 2013, 06:21:59 PM
by elphinstone

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