Logo by KRAFTWERK - 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 19, 2024, 04:26:42 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   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: Menger Sponge 45 Rotation  (Read 8212 times)
Description: Mathematical Structures
0 Members and 1 Guest are viewing this topic.
trafassel
Fractal Bachius
*
Posts: 531


trafassel
« on: November 24, 2016, 11:26:56 PM »

// Gestaltlupe 3.4

double _scale=4;
double _offsetX=1.5;
double _offsetY=1.5;
double _offsetZ=1.5;
double _bailout=2;
double _angleX=0;
double _angleY=0;
double _angleZ=0;


public override void Init()
{
  base.Init();
  // Plaese remove this after pressing 2 times the button above:
  // (This set fixed formula Parameters)
  if(GetString("intern.Formula.TempUpdateVal")!="021462bd1ab1887e87f23a9ace4f4e0a")
  {
    SetParameterBulk(@"Formula.Parameters: angleX=0 angleY=0 angleZ=45 bailout=2 offsetX=2.1 offsetY=1 offsetZ=1 scale=2 Formula.Static: Cycles=12 Julia=1 jx=0.9 jy=0 jz=0 Scene: CenterX=0.0965003528449048 CenterY=-1.34226795790199 CenterZ=0.160980835845237 Radius=0.349530254720366 Transformation.Camera: AngleX=-39.2596575417366 AngleY=74.1173281658452 AngleZ=-99.2265259659284 IsometricProjection=0 Position=1 intern.Formula: TempUpdateVal=021462bd1ab1887e87f23a9ace4f4e0a");
  }

// Load current Parameters:
  _scale=GetOrSetDouble("scale");
  _offsetX=GetOrSetDouble("offsetX");
  _offsetY=GetOrSetDouble("offsetY");
  _offsetZ=GetOrSetDouble("offsetZ");
  _bailout=GetOrSetDouble("bailout");
  _angleX=Math.PI/180.0*GetOrSetDouble("angleX");
  _angleY=Math.PI/180.0*GetOrSetDouble("angleY");
  _angleZ=Math.PI/180.0*GetOrSetDouble("angleZ");
}
// Menger Sponge


public override bool GetBool(double x,double y,double z)
{
  // Switch between mandel and julia mode:
  double jx,jy,jz;
  if (_isJulia)
  {
    jx=_jx;
    jy=_jy;
    jz=_jz;
  }
  else
  {
    jx=x;
    jy=y;
    jz=z;
    x=_jx;
    y=_jy;
    z=_jz;
  }

  for (int n=1;n < _cycles;  n++)
  {

    // Menger Sponge Formula:
    x=Math.Abs(x);
    y=Math.Abs(y);
    z=Math.Abs(z);
    if(x>_bailout)return false;
    if(y>_bailout)return false;
    if(z>_bailout)return false;
    if (x<y)
    {
      double a=x;
      x=y;
      y=a;
    }
    if (x< z)
    {
      double a=x;
      x=z;
      z=a;
    }
    if (y<z)
    {
      double a=y;
      y=z;
      z=a;
    }
    x=_scale*x-_offsetX*(_scale-1);
    y=_scale*y-_offsetY*(_scale-1);
    z=_scale*z-_offsetZ*(_scale-1);
    if(z<-0.5*_offsetZ*(_scale-1.0))z+=_offsetZ*(_scale-1.0);
    if(_angleX!=0)Rotate(_angleX,ref y,ref z);
    if(_angleY!=0)Rotate(_angleY,ref x,ref z);
    if(_angleZ!=0)Rotate(_angleZ,ref x,ref y);
    // Julia / Mandel iteration:
    x+=jx;
    y+=jy;
    z+=jz;
  }
  return true;
}


void Rotate(double angle,ref double x,ref double y)
{
  double re=Math.Cos(angle );
  double im=Math.Sin(angle );
  double a=re * x-im * y;
  y=re * y+im * x;
  x=a;
}


* Data110pic10075_256.jpg (246.62 KB, 1200x1200 - viewed 496 times.)
Logged
trafassel
Fractal Bachius
*
Posts: 531


trafassel
« Reply #1 on: November 24, 2016, 11:40:56 PM »

angleX=45 angleY=0 angleZ=0 bailout=230
offsetX=1 offsetY=0.666666666666667 offsetZ=0.5
scale=3
Formula.Static: Cycles=12 Julia=1 jx=0.833333333333333 jy=0 jz=0





* Data109pic10165_256.jpg (232.62 KB, 1200x1200 - viewed 458 times.)
Logged
trafassel
Fractal Bachius
*
Posts: 531


trafassel
« Reply #2 on: November 25, 2016, 09:32:20 PM »

angleX=0 angleY=0 angleZ=0
bailout=230 offsetX=1.05 offsetY=1 offsetZ=1
scale=2.2
Formula.Static: Cycles=16 Julia=1 jx=0.575 jy=0 jz=0


* Data138pic10052_256.jpg (250.92 KB, 1200x1200 - viewed 481 times.)
Logged
trafassel
Fractal Bachius
*
Posts: 531


trafassel
« Reply #3 on: November 25, 2016, 10:05:32 PM »

18 Iterations


* Data138pic10053_256.jpg (252.19 KB, 1200x1200 - viewed 504 times.)
Logged
trafassel
Fractal Bachius
*
Posts: 531


trafassel
« Reply #4 on: November 27, 2016, 02:05:45 PM »

Some parameter variations:

<a href="https://www.youtube.com/v/RjTGNUG-yGY&rel=1&fs=1&hd=1" target="_blank">https://www.youtube.com/v/RjTGNUG-yGY&rel=1&fs=1&hd=1</a>
Logged
trafassel
Fractal Bachius
*
Posts: 531


trafassel
« Reply #5 on: November 30, 2016, 07:53:37 AM »

Same formula, but the line:

    if( z<-0.5*_offsetZ*(_scale-1.0))  z+=_offsetZ*(_scale-1.0);

ist removed:


Fractal Parameters:
angleX=0 angleY=0 angleZ=45
bailout=2
offsetX=1.1 offsetY=1.2 offsetZ=1
scale=1.8
Cycles=100 Julia=1 jx=0.1 jy=0.1 jz=0.225

Scene Parameters:
CenterX=-0.825851928838657 CenterY=-0.137484062991961 CenterZ=-0.263178096264692 Radius=1.57641612156358E-05
AngleX=71.9789945332988 AngleY=28.6324642779303 AngleZ=-63.414564994788
IsometricProjection=0 Position=1


* Data158pic10015s256.jpg (249.92 KB, 1200x1200 - viewed 460 times.)
Logged
trafassel
Fractal Bachius
*
Posts: 531


trafassel
« Reply #6 on: November 30, 2016, 07:57:54 AM »

Here you see a cut in the same Menger Sponge spiral. The green surface belongs to the "inside" while the grey very regular looking structures is an "outside view".



* Data158pic10016s256.jpg (251.57 KB, 1200x1200 - viewed 490 times.)
Logged
mclarekin
Fractal Senior
******
Posts: 1739



« Reply #7 on: November 30, 2016, 09:27:23 AM »

The last to images are really cool, I have not seen that shape before afro afro afro

The attached transform works well with menger sponges ( less so for other fractals sad).

And I note that the coder seems to have forgotten to put in a linear DE adjustment for the scale ( hmmm??? that must have been me  embarrass)

I will go and fix that now, and it  should  work better. smiley


* iteration weight.jpg (57.01 KB, 655x455 - viewed 438 times.)
Logged
mclarekin
Fractal Senior
******
Posts: 1739



« Reply #8 on: November 30, 2016, 10:34:40 AM »

I found  a weird "i -1" in the code, how it got there I do not know. embarrass

This is what it should look like, (now I better go and fix the 4D version.)

Code:
/**
 * iteration weight. Influence fractal based on the weight of
 * Z values after different iterations
 */
void TransformIterationWeightIteration(CVector3 &z, int i, const cFractal *fractal, sExtendedAux &aux)
{
CVector3 zA, zB;

if (i == fractal->transformCommon.intA)
{
zA = z;
}
if (i == fractal->transformCommon.intB)
{
zB = z;
}
z = (z * fractal->transformCommon.scale) + (zA * fractal->transformCommon.offset)
+ (zB * fractal->transformCommon.offset0);
aux.DE *= fractal->transformCommon.scale;
aux.r_dz *= fractal->transformCommon.scale;
}
Logged
trafassel
Fractal Bachius
*
Posts: 531


trafassel
« Reply #9 on: December 01, 2016, 07:47:51 AM »

mclarekin wrote:
Quote
And I note that the coder seems to have forgotten to put in a linear DE adjustment for the scale ( hmmm??? that must have been me  )

There is a simple reason for this: I hardly ever use DE in my renderings. DE adds additional lines to the formula (i like simpleness) and it was not very helpful in finding the 3D mandelbrot fractal. At least for me.

Disadvantage of not using distance estimatation is longer rendering time and often noisy surface normals - especially for some grailish looking examples, like the following one (yes, there are fractal doughnuts in the box).

Quote
// Menger Sponge Tree
public override bool GetBool(double x,double y,double z)
{
  double sin45 = Math.Sqrt(0.5);
  double scale = 1.81;
  double offsetX = 1.15;
  double offsetY = 0.932;
  double offsetZ = 1.01;
  for (int n=1;n<100;n++)
  {
    x = Math.Abs(x);
    y = Math.Abs(y);
    z = Math.Abs(z);
    // Bailout Condition:
    if (x>2) return false;
    if (y>2) return false;
    if (z>2) return false;
    if (x<y) { double a=x; x=y; y=a; }
    if (x<z) { double a=x; x=z; z=a; }
    if (y<z) { double a=y; y=z; z=a; }
    x = scale*x - offsetX*(scale-1);
    y = scale*y - offsetY*(scale-1);
    z = scale*z - offsetZ*(scale-1);
    // Rotate x,y plane by 45 degree:
    double xtemp = sin45 * ( x - y );
    y = sin45 * ( y + x );
    x = xtemp;
  }
  return true;
}

 
Here the menger sponge tree lies in the center of the box (CenterX=-0.0945155196775858 CenterY=-0.130152813333983 CenterZ=-0.0796293685094792 Radius=0.261524932786483).



* Data158pic10018s256a.jpg (249.76 KB, 1200x1200 - viewed 441 times.)
Logged
trafassel
Fractal Bachius
*
Posts: 531


trafassel
« Reply #10 on: December 02, 2016, 12:30:11 PM »

A cut through one of the doughnuts.


* Data166pic10032s256.jpg (249.56 KB, 1200x1200 - viewed 464 times.)
Logged
trafassel
Fractal Bachius
*
Posts: 531


trafassel
« Reply #11 on: December 05, 2016, 07:58:07 PM »

Formula.Parameters:
angleX=0 angleY=0 angleZ=45 bailout=3 offsetX=1.2 offsetY=1.1 offsetZ=0.8 scale=1.6
Formula.Static: Cycles=75 Julia=1 jx=0 jy=0 jz=0
Scene: CenterX=-0.817698103133137 CenterY=1.2024566146392 CenterZ=0.484242312734027
Radius=0.0135254036224944





* Data173pic10002s256.jpg (247.81 KB, 1200x1200 - viewed 453 times.)
Logged
trafassel
Fractal Bachius
*
Posts: 531


trafassel
« Reply #12 on: December 06, 2016, 09:12:28 PM »

I do not notice that Krzysztof Marczak has made 2013 a better version of my video in reply #4 .At minute 3:00 you see the broken picture frame of my first image. <a href="https://www.youtube.com/v/NIWz3BuE4nE&rel=1&fs=1&hd=1" target="_blank">https://www.youtube.com/v/NIWz3BuE4nE&rel=1&fs=1&hd=1</a>

The only missing thing was a inner view of a menger sponge with 100 iterations, which seems to be unexplored.


Here is an outer view of the 45° menger sponge with a cut at z>0.

Formula.Parameters:
angleX=0 angleY=0 angleZ=45
bailout=6000000
offsetX=0.6 offsetY=2.8 offsetZ=0
scale=1.35
Formula.Static:
Cycles=75 Julia=1
jx=0.15 jy=0 jz=0



* Data177pic10107s256.jpg (242.08 KB, 1200x1200 - viewed 435 times.)
Logged
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #13 on: December 06, 2016, 10:33:37 PM »

This is REALLY interesting thanks A Beer Cup
Logged

No sweat, guardian of wisdom!
mclarekin
Fractal Senior
******
Posts: 1739



« Reply #14 on: December 07, 2016, 12:10:08 AM »

They are so good, so many different shapes (you can see where my last gallery post came from smiley  thanks)
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 5292 Last post April 02, 2007, 03:16:32 AM
by bradorpoints
Menger sponge fly-through 3D Fractal Generation twinbee 10 6868 Last post February 16, 2009, 05:43:21 AM
by twinbee
4D Menger sponge Sierpinski Gasket « 1 2 » makc 27 18033 Last post December 09, 2016, 04:01:39 PM
by knighty
3D menger sponge fly through Movies Showcase (Rate My Movie) DonWebber 0 2808 Last post September 14, 2010, 01:01:18 AM
by DonWebber
Menger Sponge, 45 Degree Rotation Gestaltlupe Gallery trafassel 0 1184 Last post November 24, 2016, 07:17:51 PM
by trafassel

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