Logo by mjk1093 - 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: Follow us on Twitter
 
*
Welcome, Guest. Please login or register. July 30, 2021, 12:50:16 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 3184 times)
Description: Mathematical Structures
0 Members and 1 Guest are viewing this topic.
trafassel
Fractal Bachius
*
Posts: 531


trafassel
« Reply #15 on: December 07, 2016, 07:24:10 AM »

Formula.Parameters: angleX=0 angleY=0 angleZ=45 bailout=6000000000 offsetX=0.88 offsetY=1.272 offsetZ=1.4 scale=1.5 zUpperBound=12 Formula.Static: Cycles=75 Julia=1 jx=0.05 jy=0 jz=0 Scene: CenterX=0.641905372680213 CenterY=0.339207258021939 CenterZ=-0.262591944640448 Radius=0.249229000878406 Transformation.Camera: AngleX=175.668590010273 AngleY=-27.0356750479037 AngleZ=-171.080170533749 IsometricProjection=0 Position=1



* Data187pic10047s256.jpg (249.8 KB, 1200x1200 - viewed 317 times.)
Logged
trafassel
Fractal Bachius
*
Posts: 531


trafassel
« Reply #16 on: December 09, 2016, 07:22:06 PM »

Formula.Parameters: angleX=0 angleY=0 angleZ=45 bailout=3 offsetX=2 offsetY=2.5 offsetZ=2.5 scale=1.56 Formula.Static: Cycles=75 Julia=1 jx=0.05 jy=0 jz=0
Scene: CenterX=-1.33456370239741 CenterY=0.263163682905943 CenterZ=0.216002920489848 Radius=0.672939928707691 Transformation.Camera: AngleX=-44.373124365217 AngleY=63.4414563477275 AngleZ=-96.3279863410774 IsometricProjection=0 Position=1





* Data4pic10003s256.jpg (249.93 KB, 1200x1200 - viewed 312 times.)
Logged
trafassel
Fractal Bachius
*
Posts: 531


trafassel
« Reply #17 on: December 12, 2016, 11:45:58 PM »

Here I remove the coordinate swap and add some additional conditions. The result fractal ist the same Menger Sponge, but the rotation only applies to one plane.


double _scale=3;
double _offsetX=2;
double _offsetY=2;
double _offsetZ=2;
double _bailout=3;
double _angleX=0;
double _angleY=45;
double _angleZ=0;
// _cycles=8

public override bool GetBool(double x,double y,double z)
{
  for (int n=1;n < _cycles;  n++)
  {
    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;
    x=_scale*x-_offsetX*(_scale-1);
    y=_scale*y-_offsetY*(_scale-1);
    z=_scale*z-_offsetZ*(_scale-1);
    if(x<y && x<z && x<-0.5*_offsetX*(_scale-1.0))x+=_offsetX*(_scale-1.0);
    else if(y<x && y<z && y<-0.5*_offsetY*(_scale-1.0))y+=_offsetY*(_scale-1.0);
    else if(z<x && z<y && 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);
    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;
}


* Data20pic10074s256.jpg (251.1 KB, 1200x1200 - viewed 309 times.)
Logged
mclarekin
Fractal Senior
******
Posts: 1739



« Reply #18 on: December 13, 2016, 05:09:53 AM »



I must try out the conditional rotate. With some fractals I can only  choose to rotate one of the three axis (otherwise too distorted), this might make those formula faster  smiley

     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);


I have been exploring  mixing conditional and non-conditional Menger iterations in 4D but have not tried it in 3D, but it would look like this at the end of a standard 3D Menger..

   z = fabs( z  + preAdd );
   
   if (z.x - z.y < 0.0f){temp = z.y; z.y = z.x; z.x = temp;}
   if (z.x - z.z < 0.0f){temp = z.z; z.z = z.x; z.x = temp;}   
   if (z.y - z.z < 0.0f){temp = z.z; z.z = z.y; z.y = temp;}
   z *= 3.0f;
   z.x -= 2.0f;
   z.y -= 2.0f;

   if (i >= startIter && i < stopIter)
   {
      if (z.z > 1.0f) z.z -= 2.0f;
   }
   else
   {
      z.z-=2.0f;
   }


Those additional conditions you have added look interesting
Logged
trafassel
Fractal Bachius
*
Posts: 531


trafassel
« Reply #19 on: December 13, 2016, 08:27:09 PM »

The additional conditions I have only added, because I skipped the coordinate swap. The coordinates are now not sorted to x<y<z.

Also equivalent to the original formula ist my following naive approach. This is not optimized code, but its simple and is perhaps more stable to additional transformations.


Code:
  double boxSize=3;
  double holeSize=1;
  int iterations=6;
  x*=boxSize;
  y*=boxSize;
  z*=boxSize;
  if(x> boxSize)return false;
  if(y> boxSize)return false;
  if(z> boxSize)return false;
  if(x<-boxSize)return false;
  if(y<-boxSize)return false;
  if(z<-boxSize)return false;
  for (int n = 1;n < iterations;  n++)
  {
    double xa=Math.Abs(x);
    double ya=Math.Abs(y);
    double za=Math.Abs(z);
    int holeCount=0;
    if(xa<holeSize) holeCount++;
    if(ya<holeSize) holeCount++;
    if(za<holeSize) holeCount++;
    if(holeCount>=2) return false;
    if(x> holeSize) x-=2*holeSize;
    if(x<-holeSize) x+=2*holeSize;
    if(y> holeSize) y-=2*holeSize;
    if(y<-holeSize) y+=2*holeSize;
    if(z> holeSize) z-=2*holeSize;
    if(z<-holeSize) z+=2*holeSize;
    x*=boxSize;
    y*=boxSize;
    z*=boxSize;
  }
  return true;
Logged
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #20 on: December 13, 2016, 08:33:50 PM »

 Spiral Thingy Repeating Zooming Self-Silimilar Thumb Up, by Craig
Logged

No sweat, guardian of wisdom!
trafassel
Fractal Bachius
*
Posts: 531


trafassel
« Reply #21 on: December 14, 2016, 12:17:50 AM »

The 45 degree variant.


* Data28pic10081s256.jpg (249.71 KB, 1200x1200 - viewed 306 times.)
Logged
trafassel
Fractal Bachius
*
Posts: 531


trafassel
« Reply #22 on: December 16, 2016, 01:08:20 AM »

Coloring the surface according to the direction of the translation gives a nice surface coloring.

(Scene: CenterX=-0.932873944699854 CenterY=0.899375847775146 CenterZ=1.16693107216321 Radius=0.18692775797436 Transformation.Camera: AngleX=-171.967389672199 AngleY=-47.8088737441608 AngleZ=73.6703503820553 IsometricProjection=0 Position=1 )
 
Code:
public override bool GetBool(double x,double y,double z)
{

double boxSize=3;
double holeSize=1.2;
double scalex=1.1;
double scaley=1.1;
double scalez=0.9;

  x*=boxSize;
  y*=boxSize;
  z*=boxSize;
  if(x> boxSize*scalex)return false;
  if(y> boxSize*scalex)return false;
  if(z> boxSize*scaley)return false;
  if(x<-boxSize*scaley)return false;
  if(y<-boxSize*scalez)return false;
  if(z<-boxSize*scalez)return false;
  for (int n=1;n < _cycles;  n++)
  {
    double xa=Math.Abs(x);
    double ya=Math.Abs(y);
    double za=Math.Abs(z);
    int holeCount=0;
    if(xa<holeSize)holeCount++;
    if(ya<holeSize)holeCount++;
    if(za<holeSize)holeCount++;
    if(holeCount>=2)return false;
    if(x> holeSize)
    {
      Red++;
      x-=2*holeSize;
    }
    if(x<-holeSize)
    {
      Red--;
      x+=2*holeSize;
    }
    if(y> holeSize)
    {
      Blue++;
      y-=2*holeSize;
    }
    if(y<-holeSize)
    {
      Blue--;
      y+=2*holeSize;
    }
    if(z> holeSize)
    {
      Green++;
      z-=2*holeSize;
    }
    if(z<-holeSize)
    {
      Green--;
      z+=2*holeSize;
    }
    x*=boxSize*scalex;
    y*=boxSize*scaley;
    z*=boxSize*scalez;
  }
  return true;
}


* Data39pic10021s256.jpg (252.03 KB, 1200x1200 - viewed 314 times.)
Logged
mclarekin
Fractal Senior
******
Posts: 1739



« Reply #23 on: December 17, 2016, 10:03:50 AM »

The surface coloring looks great. I am going to try it out smiley
Logged
trafassel
Fractal Bachius
*
Posts: 531


trafassel
« Reply #24 on: December 17, 2016, 12:04:27 PM »

Quote
The surface coloring looks great. I am going to try it out.

This would be cool. Some areas are grey because I implemented in my renderer a "color threshold". Without this threshold the corresponding surface would be drawn in pastel colors.


Logged
trafassel
Fractal Bachius
*
Posts: 531


trafassel
« Reply #25 on: December 17, 2016, 01:17:32 PM »

I like simple formulas. Here is another one. I removed the box boundary restriction and change the "hole indicator".

The scene is located at:

CenterX=0.0537731690329398 CenterY=0.986837787113877 CenterZ=0.993711945778967 Radius=0.0175530009711978
Transformation.Camera: AngleX=-104.327115785263 AngleY=-20.6946703978129 AngleZ=-132.683623253497 IsometricProjection=0 Position=1

Code:
public override bool GetBool(double x,double y,double z)
{
  double boxSize=1.8;
  double holeSize=0.62;
  for (int n=1;n < 17;  n++)
  {
    if(Math.Abs(x)>=holeSize &&
       Math.Abs(y)>=holeSize &&
       Math.Abs(z)>=holeSize) return false;
    if(x> holeSize) x-=2*holeSize;
    if(x<-holeSize) x+=2*holeSize;
    if(y> holeSize) y-=2*holeSize;
    if(y<-holeSize) y+=2*holeSize;
    if(z> holeSize) z-=2*holeSize;
    if(z<-holeSize) z+=2*holeSize;
    x*=boxSize;
    y*=boxSize;
    z*=boxSize;
  }
  return true;
}




* Data48pic10039s256.jpg (252.38 KB, 1200x1200 - viewed 303 times.)
Logged
Pages: 1 [2]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Menger sponge fly-through 3D Fractal Generation twinbee 10 4824 Last post February 16, 2009, 05:43:21 AM
by twinbee
4D Menger sponge Sierpinski Gasket « 1 2 » makc 27 8737 Last post December 09, 2016, 04:01:39 PM
by knighty
3D menger sponge fly through Movies Showcase (Rate My Movie) DonWebber 0 1805 Last post September 14, 2010, 01:01:18 AM
by DonWebber
Through the Menger Sponge Movies Showcase (Rate My Movie) Michael Scharrer 0 465 Last post October 17, 2015, 05:55:43 PM
by Michael Scharrer
Menger Sponge, 45 Degree Rotation Gestaltlupe Gallery trafassel 0 541 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.1 seconds with 25 queries. (Pretty URLs adds 0.008s, 2q)