Logo by rathinagiri - 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 26, 2024, 05:42:47 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 3   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: 3D Koch cube (escape time) + formula  (Read 24150 times)
0 Members and 1 Guest are viewing this topic.
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« on: March 29, 2011, 08:38:29 PM »

Anyone knows if this formula is convertible to escape-time ifs for MB3d or something... undecided I'm not good at this, plus I'm trying to do a formula by scratch without success. Please help me sad cry

http://bernhardhaeussner.de/blog/65_Processing%3A_3D-Koch-Kurve_mit_Sierpinski-Dreieck

Source code;

fraqTriang trs[]=new fraqTriang[4];

void setup(){
  size(640, 480, P3D);
  noStroke();
  fill(150,150,150,20);
  int bigrad=200;
  int req=6;
  
  PVector A=new PVector(-bigrad,0,0);
  PVector B=new PVector(bigrad/2,0,-173.21);
  PVector C=new PVector(bigrad/2,0,173.21);
  PVector D=new PVector(0,-bigrad*(sqrt(6)/3),0);
  
  trs[0]=new fraqTriang(A,B,C,req);
  trs[1]=new fraqTriang(A,D,B,req);
  trs[2]=new fraqTriang(A,C,D,req);
  trs[3]=new fraqTriang(B,D,C,req);
}


void draw(){
  background(255);
  lights();
  
  float winkel=(mouseX/float(width))*TWO_PI;
  float xpos=cos(winkel);
  float ypos=sin(winkel);
  float radius=300.000;
  camera(xpos*radius, mouseY, ypos*radius, // eyeX, eyeY, eyeZ
         0.0, -50.0, 0.0, // centerX, centerY, centerZ
         0.0, -1.0, 0.0); // upX, upY, upZ
      
  for (int i=0;i<trs.length;i++) {
    trs[i).display();
  }
  //saveFrame("frames/koch3d-####.png"); //uncomment to record
}

class fraqTriang{
  PVector PointA;
  PVector PointB;
  PVector PointC;
  fraqTriang recTris[]=new fraqTriang[6];
  int rec;
  float scaling;
  
  fraqTriang(PVector A,PVector B,PVector C, int recursion){
    scaling=0.7;
    PointA=A;
    PointB=B;
    PointC=C;
    rec=recursion;
    applyRecursion ();
  }
    
 void applyRecursion () {
    if (rec!=0) {
      PVector PointAB2=PVector.add(PointA,PointB);
      PointAB2.div(2);
      PVector PointAC2=PVector.add(PointA,PointC);
      PointAC2.div(2);
      PVector PointBC2=PVector.add(PointB,PointC);
      PointBC2.div(2);
      
      PVector PointZ=PVector.add(PointA,PointB);
      PointZ.add(PointC);
      PointZ.div(3);
      PVector PointAB=PVector.sub(PointA,PointB);
      PVector PointAC=PVector.sub(PointA,PointC);
      PVector PointH=PointAB.cross(PointAC);
      PointH.normalize();
      PVector PointAAB2=PVector.sub(PointA,PointAB2);
      float a=PointAAB2.mag();
      float pheight=a*(sqrt(6)/3)*scaling;
      PointH.mult(-pheight);
      PVector PointZH=PVector.add(PointZ,PointH);
      
      recTris[0]=new fraqTriang(PointA,PointAB2,PointAC2,rec-1);
      recTris[1]=new fraqTriang(PointB,PointBC2,PointAB2,rec-1);
      recTris[2]=new fraqTriang(PointC,PointAC2,PointBC2,rec-1);
      
      recTris[3]=new fraqTriang(PointZH,PointAC2,PointAB2,rec-1);
      recTris[4]=new fraqTriang(PointZH,PointAB2,PointBC2,rec-1);
      recTris[5]=new fraqTriang(PointZH,PointBC2,PointAC2,rec-1);
    }
  }  

  
  void display () {
    if (rec==0) {
      beginShape();
      vertex(PointA.x, PointA.y ,PointA.z);
      vertex(PointB.x, PointB.y ,PointB.z);
      vertex(PointC.x, PointC.y ,PointC.z);
      endShape(CLOSE);
    } else {
      for (int i=0; i<recTris.length;i++) {
        recTris.display();
      }
    }
  }
  
}

The interesting part is highlighted... wink
« Last Edit: May 09, 2011, 01:40:38 PM by DarkBeam » Logged

No sweat, guardian of wisdom!
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #1 on: March 29, 2011, 08:43:22 PM »

Obviously, I don't ask for the MB formula, only a C-style clean source code will be enough... wink

IN = x,y,z (3d current point) + size
OUT = x,y,z

Like this

http://www.fractalforums.com/3d-fractal-generation/kaleidoscopic-(escape-time-ifs)/
« Last Edit: March 29, 2011, 08:47:35 PM by DarkBeam » Logged

No sweat, guardian of wisdom!
msltoe
Iterator
*
Posts: 187


« Reply #2 on: April 15, 2011, 02:31:48 PM »

DarkBeam: I've been thinking recently about how to make arbitrary IFS fractals using escape time. It's a little tricky to do, but well worth it when we figure it out.
The problem is that escape time works by taking functions of functions of functions, etc. Each time a function is applied it skews the entire 3-D space. If the function isn't conformal then after a few iterations space gets drawn out into spikes.

Meanwhile, recursive IFS's don't transform the entire space over each iteration, just a few registration points (i.e., A, B, C). The child object has essentially a fresh new Euclidean (orthogonal) space to be generated in.

So, I've concluded that for escape time, if the function has non-uniform scaling, it must be re-scaled on the next few iterations to restore uniform space. E.g. , if a matrix specifies the function, then some variant of the matrix inverse must be used on the next step to restore the space to conformal.

-mike
Logged
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #3 on: April 15, 2011, 06:04:10 PM »

DarkBeam: I've been thinking recently about how to make arbitrary IFS fractals using escape time. It's a little tricky to do, but well worth it when we figure it out.
The problem is that escape time works by taking functions of functions of functions, etc. Each time a function is applied it skews the entire 3-D space. If the function isn't conformal then after a few iterations space gets drawn out into spikes.

Meanwhile, recursive IFS's don't transform the entire space over each iteration, just a few registration points (i.e., A, B, C). The child object has essentially a fresh new Euclidean (orthogonal) space to be generated in.

So, I've concluded that for escape time, if the function has non-uniform scaling, it must be re-scaled on the next few iterations to restore uniform space. E.g. , if a matrix specifies the function, then some variant of the matrix inverse must be used on the next step to restore the space to conformal.

-mike
smiley

That is true! I use a particular trick for those IFS, I do all calculations in a single formula that must be executed once and finds which is the "index" of the point and then does the transform. The depth must be previously specified, unlike other transforms. smiley

The problem here is that I can't find those "inclined axis" (and the formula has many bifurcations), so can you help me on the algorithm?
Logged

No sweat, guardian of wisdom!
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #4 on: April 15, 2011, 06:24:49 PM »

This is a scheme of the transform, but it's hard to write it, I get lost... sad



At first we need to bring all 3D space to the "red area", with a 3D rotation (it's already hard!)

Then, we must do a translate+scaling for regions 1 and 3 and an additional rotation for 2 and 4.

What I miss is the exact values for all vectors and angles! cry
Logged

No sweat, guardian of wisdom!
msltoe
Iterator
*
Posts: 187


« Reply #5 on: April 16, 2011, 12:24:26 AM »

DarkBeam,

 Start with something simpler like an escape time IFS for the 2D snowflake.
 
 Also, remember that escape time algorithms always carve out density from the previous iteration. So you want something big in early iterations that gets smaller and smaller.

-mike

 
Logged
knighty
Fractal Iambus
***
Posts: 819


« Reply #6 on: April 30, 2011, 09:31:17 PM »

I'm afraid this is not possible with KIFS. It's not symmetric enought. I've tried the symetric 3D Koch based on a tetrahedra but the result is a simple cube... Maybe I'm wrong. In fact, I hope so.
Logged
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #7 on: May 01, 2011, 09:52:07 AM »

I'm afraid this is not possible with KIFS. It's not symmetric enought. I've tried the symetric 3D Koch based on a tetrahedra but the result is a simple cube... Maybe I'm wrong. In fact, I hope so.

No, it is actually exact! (too bad! sad ) http://www.math.hmc.edu/funfacts/ffiles/30002.2.shtml

But this formula is different, so it works smiley

Any idea for the squarry koch? http://en.wikipedia.org/wiki/File:Quadratic_Koch_3D_(type1_stage2).png

nicer picture http://www.flickr.com/photos/step26/3404694703/in/photostream grin
« Last Edit: May 01, 2011, 09:55:23 AM by DarkBeam » Logged

No sweat, guardian of wisdom!
knighty
Fractal Iambus
***
Posts: 819


« Reply #8 on: May 01, 2011, 06:33:34 PM »

But this formula is different, so it works smiley
Well you can do it with regular IFS. It is possible to do IFS as escape time fractal but you would need a stack (see this paper.). You could also do it with some sort of combination between IFS ans KIFS by using the symmetries of that object.
With KIFS it is possible to reproduce only a subset of regular IFS: Those whose Transformation set is symmetric, that is, there is a set of folding planes that transform (the order is important because of the non commutativity of linear operator algebra) any of the IFS transformation to any other. In fact this condition is not sufficient apparently: I coudn't obtain the squarry Koch but the squarry koch + something...Humm... I'm talking like a mathematician. afro Hope that it makes sens angel.

Kind of! Here is attached a fragmentarium shader. There are some interresting variations by changing offset, rotation, scale and the order of foldings...

* koch01.zip (0.75 KB - downloaded 197 times.)
Logged
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #9 on: May 01, 2011, 07:24:05 PM »

If it will work I will give you a millon dollars! afro
Logged

No sweat, guardian of wisdom!
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #10 on: May 01, 2011, 09:06:32 PM »

Ok, I have translated to Mandelbulb, but it is discontinue in some points,  undecided and discontinue figures have a kinda weird look, but it is nice.

Very similar to my Menger Koch. smiley I will see if it's worth to add to my DB!
Logged

No sweat, guardian of wisdom!
knighty
Fractal Iambus
***
Posts: 819


« Reply #11 on: May 01, 2011, 09:19:19 PM »

If it will work I will give you a millon dollars! afro
Hehe... deal? evil rolling on floor laughing
Logged
knighty
Fractal Iambus
***
Posts: 819


« Reply #12 on: May 01, 2011, 09:20:42 PM »

Ok, I have translated to Mandelbulb, but it is discontinue in some points,  undecided and discontinue figures have a kinda weird look, but it is nice.

Very similar to my Menger Koch. smiley I will see if it's worth to add to my DB!
A picture?
Logged
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #13 on: May 02, 2011, 12:38:01 AM »

Too bad they are all weird, due to a branch cut...
I will work on it, and sorry if I havent said THANK YOU! for your precious help friend!
Logged

No sweat, guardian of wisdom!
msltoe
Iterator
*
Posts: 187


« Reply #14 on: May 02, 2011, 03:59:50 AM »

Something similar to the "squarey" Koch using escape time. It's in Tglad's table, too, I think.
The algorithm is you keep clipping off the corners of 3x3 cubes.


* squary_koch.jpg (78.44 KB, 600x600 - viewed 586 times.)
« Last Edit: May 02, 2011, 04:02:47 AM by msltoe » Logged
Pages: [1] 2 3   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Escape-time LRIFS Programming David Makin 11 9217 Last post March 22, 2010, 04:05:57 PM
by kram1032
Escape time versions of IFS IFS - Iterated Function Systems msltoe 2 13085 Last post April 18, 2011, 02:54:48 PM
by msltoe
Generic escape-time fractals Programming David Makin 3 4502 Last post September 26, 2011, 12:40:02 AM
by David Makin
Koch Cube bred with Mag Mandy Movies Showcase (Rate My Movie) M Benesi 3 1204 Last post December 01, 2012, 01:33:44 AM
by M Benesi
Improving over the escape time map (new) Theories & Research megafiddle 1 1252 Last post November 22, 2013, 03:38:37 AM
by megafiddle

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