Welcome to Fractal Forums

Fractal Math, Chaos Theory & Research => (new) Theories & Research => Topic started by: trafassel on June 19, 2015, 08:54:06 PM




Title: The Search for the 3D Mandelbrot Set Continues
Post by: trafassel on June 19, 2015, 08:54:06 PM
// Gestaltlupe Formula
public override void Init() {
  base.Init();
  additionalPointInfo=new AdditionalPointInfo();
  if(GetString("intern.Formula.TempUpdateVal")!="3d6be9ad4f2001fbd5b92d751ac8a6b9")
{SetParameterBulk(@"<Entry Key='Border.Max.x' Value='1.23114390555897' />
<Entry Key='Border.Max.y' Value='-0.240455052613624' />
<Entry Key='Border.Max.z' Value='0.00389757765689654' />
<Entry Key='Border.Min.x' Value='1.2215255559828' />
<Entry Key='Border.Min.y' Value='-0.250073402189787' />
<Entry Key='Border.Min.z' Value='-0.00572077191926846' />
<Entry Key='Formula.Fix.Height' Value='1' />
<Entry Key='Formula.Mandelbulb.Pow1' Value='' />
<Entry Key='Formula.Static.Cycles' Value='22' />
<Entry Key='Formula.Static.Formula' Value='-1' />
<Entry Key='Formula.Static.jx' Value='0' />
<Entry Key='Formula.Static.jy' Value='0' />
<Entry Key='Formula.Static.jz' Value='0' />
<Entry Key='Formula.Static.jzz' Value='0' />
<Entry Key='Formula.Static.MinCycle' Value='0' />
<Entry Key='Transformation.Camera.AngleX' Value='160' />
<Entry Key='Transformation.Camera.AngleY' Value='40' />
<Entry Key='Transformation.Camera.AngleZ' Value='70' />
<Entry Key='Transformation.Perspective.Cameraposition' Value='1' />
<Entry Key='View.Perspective' Value='1' />
<Entry Key='View.Height' Value='1200' />
<Entry Key='View.Width' Value='1200' />
<Entry Key='intern.Formula.TempUpdateVal' Value='3d6be9ad4f2001fbd5b92d751ac8a6b9' />");}
}

public override long InSet(double x, double y, double z, 
                                   double x0, double y0, double z0, double bk,
                                   long maxiter, bool inverse) {

  int tw=0,n=0;
  double r=0;
  double gr=10;
  double xx=0,yy=0,zz=0;
  double x1=0,y1=0,z1=0;

  double minR=1000; // used for coloring
  Fractrace.Geometry.VecRotation vecRot = new Fractrace.Geometry.VecRotation();

  for (n = 1; n < maxiter; n++) {

     xx=x*x;yy=y*y;zz=z*z;
     r=xx+yy+zz;
     if (r > gr) { tw = n; break; }

     double theta = Math.Atan2(Math.Sqrt(xx + yy), z);
     double phi = Math.Atan2(y, x);

     double ystart=y;
     double xstart=x;


     vecRot.x = 0;
     vecRot.y = 0;
     vecRot.z =1;
     vecRot.angle = 2.0*phi;
     vecRot.Normalize();
     Fractrace.Geometry.Vec3 pos=new Fractrace.Geometry.Vec3(x,y,z);
     Fractrace.Geometry.Vec3 newPos= vecRot.getTransform(pos);
     x = newPos.X;
     y = newPos.Y;
     z = newPos.Z;



if(x!=0 && y!=0)
{
     vecRot.x = -y;
     vecRot.y = x;     
     vecRot.z = 0;
     vecRot.angle = 2.0*theta ;
     vecRot.Normalize();
     Fractrace.Geometry.Vec3 pos2=new Fractrace.Geometry.Vec3(x,y,z);
     Fractrace.Geometry.Vec3 newPos2= vecRot.getTransform(pos2);
     x = newPos2.X;
     y = newPos2.Y;
     z = newPos2.Z;
}

     //r=Math.Sqrt(r);
     x=r*x+x0;
     y=r*y+y0;
     z=r*z+z0;

     if(minR>r) minR=r; //  used for coloring

  }

// coloring:
additionalPointInfo.red=0.01;
additionalPointInfo.green=0.01;
additionalPointInfo.blue=minR;

if (inverse) { if (tw == 0) tw = 1; else tw = 0; }
   return (tw);
}