News: Visit the official fractalforums.com Youtube Channel

## The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!

Simple Menger
Previous Image | Next Image
Description: public override void Init(){base.Init();if(GetString("intern.Formula.TempUpdateVal")!="45ea375e46e1a8d8b84edded6f88e4c7"){SetParameterBulk("Formula.Parameters: anglex=0 angley=0 anglez=0 boxSize=2 holeSize=1 scalex=0.8 scaley=0.8 scalez=0.8 Formula.Static: Cycles=17 Julia=1 jx=0 jy=0 jz=0 Scene: CenterX=-0.101596203851992 CenterY=-0.503356209583339 CenterZ=-0.53093858838795 Radius=0.220365519803785 Transformation.Camera: AngleX=10.2074451858821 AngleY=-19.0315263881349 AngleZ=-53.2901631402185 IsometricProjection=0 Position=1 intern.Formula: TempUpdateVal=45ea375e46e1a8d8b84edded6f88e4c7");}if(GetString("intern.Formula.TempUpdateVal")!="3275c2a4ff5fcde853faa40e7ffaa9ca"){SetParameterBulk("Formula.Parameters: anglex=0 angley=0 anglez=0 boxSize=2 holeSize=1 scalex=0.8 scaley=0.8 scalez=0.8 Formula.Static: Cycles=17 Julia=1 jx=0 jy=0 jz=0 Scene: CenterX=-0.101596203851992 CenterY=-0.503356209583339 CenterZ=-0.53093858838795 Radius=0.220365519803785 Transformation.Camera: AngleX=10.2074451858821 AngleY=-19.0315263881349 AngleZ=-53.2901631402185 IsometricProjection=0 Position=1 intern.Formula: TempUpdateVal=3275c2a4ff5fcde853faa40e7ffaa9ca");}}public double boxSize;public double holeSize;public double scalex;public double scaley;public double scalez;public double anglex=0;public double angley=0;public double anglez=0;public override bool GetBool(double x,double y,double z){double cosAngleX=Math.Cos(Math.PI/180.0*anglex);double cosAngleY=Math.Cos(Math.PI/180.0*angley);double cosAngleZ=Math.Cos(Math.PI/180.0*anglez);double sinAngleX=Math.Cos(Math.PI/180.0*anglex);double sinAngleY=Math.Sin(Math.PI/180.0*angley);double sinAngleZ=Math.Sin(Math.PI/180.0*anglez);double boxSizeScalex=boxSize*scalex;double boxSizeScaley=boxSize*scaley;double boxSizeScalez=boxSize*scalez;double holeSize2=2*holeSize;x*=boxSize;y*=boxSize;z*=boxSize;if(x> boxSizeScalex)return false;if(y> boxSizeScaley)return false;if(z> boxSizeScalex)return false;if(x<-boxSizeScalex)return false;if(y<-boxSizeScaley)return false;if(z<-boxSizeScalez)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-=holeSize2;}else if(x<-holeSize){Red--;x+=holeSize2;}if(y> holeSize){Blue++;y-=holeSize2;}else if(y<-holeSize){Blue--;y+=holeSize2;}if(z> holeSize){Green++;z-=holeSize2;}else if(z<-holeSize){Green--;z+=holeSize2;}x*=boxSizeScalex;y*=boxSizeScaley;z*=boxSizeScalez;if(anglex!=0)Rotate(sinAngleX,cosAngleX,ref y,ref z);if(angley!=0)Rotate(sinAngleY,cosAngleY,ref x,ref z);if(anglez!=0)Rotate(sinAngleZ,cosAngleZ,ref x,ref y);}return true;}void Rotate(double sinAngle,double cosAngle,ref double x,ref double y){double a=cosAngle * x-sinAngle * y;y=cosAngle * y+sinAngle * x;x=a;}

Stats:
Total Favorities: 0 View Who Favorited
Filesize: 250.94kB
Height: 1200 Width: 1200
Discussion Topic: View Topic
Keywords: Menger Sponge Gestaltlupe
Posted by: trafassel February 19, 2017, 10:46:08 PM

Rating: Has not been rated yet.