Logo by stereoman - 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 the official fractalforums.com Youtube Channel
 
*
Welcome, Guest. Please login or register. April 20, 2024, 02:57:49 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: Repeat an object finitely  (Read 1298 times)
0 Members and 1 Guest are viewing this topic.
tryptophan
Safarist
******
Posts: 86


« on: April 12, 2013, 05:48:46 AM »

I'm trying to repeat an object just a certain number of times and transform it arbitrarily. I know of a simple way to do it by just repeating it's calculation and using the min function but then I would need to cycle through its loop every time it repeated the object. For example:

Quote
float DE(vec3 z)
{
   float r;
   z += Position;

   if (Tile.w == 1) z = abs(-Tile.zyx-mod(z,2.0* -Tile.zyx));
   else if (Tile.w == 2) z = abs(2.0*Tile.zyx-mod(z-Tile.zyx,Tile.zyx*4.0))-Tile.zyx;

   z = z * fullRotate;
         
   // Iterate to compute the distance estimator.
   int n = 0;
   while (n < Iterations) {
      z *= fracRotation1;
      
      if (z.x+z.y<0.0) z.xy = -z.yx;
      if (z.x-z.y<0.0) z.xy = z.yx;
      if (z.x-z.z<0.0) z.xz = z.zx;
      
      z = ((z+Julia*.25)*Scale - offset*(Scale-1.0)) * (Fold.xyz * .2 + 1);
      z *= fracRotation2;
      
      r = dot(z, z);
        if (n< ColorIterations)  orbitTrap = min(orbitTrap, abs(vec4(z,r)));
          n++;
   }
   orbitTrap*=ColorScale+ColorOffset;
   return length(z)  * pow(Scale, -float(n));
}

if I replace the return statement with : return min(length(z),length(z+offset) * pow(Scale, -float(n));
I do not get the desired result (a second pyramid offset from the first), in fact it seems to create a small offset within the iteration. But then I can't find a way to repeat the pyramid before the iteration, all the info I've found on mixing DEs works on the float output not on the position input. As I said earlier I'm sure if I pack the DE into a function and call it more than once then use the min operator it will work but I think this will increase the render time much more than finding a way to repeat its output?

Any suggestions or ideas?

Also if someone has a better method for a Sierpinski pyramid I'd be stoked to hear what you have to say. The above code is just the modified Octahedron code from Fragmentarium and I seem to have a problem with it not cutting holes out of the bottom. I've done some reading on folding on the Syntopia blog but I'm still not 100% there yet.

thanks
Keith
Logged
eiffie
Guest
« Reply #1 on: April 12, 2013, 05:46:14 PM »

You have to replicate z before the fractal iterations - as you found out.
You already have the tiling code to replicate infinitely - others are...
abs = 2 per dimension
clamp = 3 per dimension
If you want some multiple like 6 then do both.
For larger but finite numbers you can use tiling and then "throw out" tiles you don't want.
Check out how Inigo Quilez did the piano keys in one of his latest shadertoy scripts.
Logged
Syntopia
Fractal Molossus
**
Posts: 681



syntopiadk
WWW
« Reply #2 on: April 12, 2013, 07:09:24 PM »

Also if someone has a better method for a Sierpinski pyramid I'd be stoked to hear what you have to say. The above code is just the modified Octahedron code from Fragmentarium and I seem to have a problem with it not cutting holes out of the bottom. I've done some reading on folding on the Syntopia blog but I'm still not 100% there yet.

Isn't a Sierpinski pyramid the same as the Tetrahedron KIFS? It should be included with Fragmentarium.
Logged
tryptophan
Safarist
******
Posts: 86


« Reply #3 on: April 15, 2013, 01:57:11 AM »

Thanks guys for the tips. I tried your suggestions Effie and they both worked.
Quote
Isn't a Sierpinski pyramid the same as the Tetrahedron KIFS? It should be included with Fragmentarium.

Thanks Syntopia actually they are different in the sense that the Tetrahedron has three sides while the pyramid I was thinking of has four sides and a square bottom (I guess I forgot to mention that). The version I'm using for now seems to be working alright.

Thanks for the help. 
Logged
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Crazy Object C Images Showcase (Rate My Fractal) Xantipa2 4 1915 Last post September 05, 2010, 07:06:33 PM
by kram1032
t-repeat Mandelbulb3D Gallery bib 0 734 Last post January 13, 2011, 09:45:53 PM
by bib
Anomalous object? Fractal Humor Pangaea 4 2138 Last post February 13, 2012, 11:29:17 AM
by cKleinhuis
Repeat along axis formula Mandelbulb 3d Erisian 8 2277 Last post February 18, 2012, 05:27:38 PM
by Erisian
Is there something inside this spot or will I repeat zooms forever? Mandelbrot & Julia Set BlackHoleyWhale 1 4445 Last post December 31, 2016, 12:17:17 AM
by quaz0r

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