Deviation Actions

Aexion's avatar

The Golden Donnut

Published:
By
5 Comments
625 Views
Like the Golden Apple.. but with more calories

The equation is:

bool GoldenDonnut(float x, float y, float z,int Iter)
{

int ic;
const float delta=0;
const float angle=atan2(ny,nx)*3;
const float radius=sqrt(nx*nx+ny*ny);
const float t_radius=radius-3.5;
const float ctx =sinf(angle)*radius-delta;
const float cty =cosf(angle)*radius-delta;
const float ctz =nz-delta;
const float ctw =t_radius*t_radius+nz*nz-delta;
float w=ctw;
x=ctx;
y=cty;
z=ctz;
for(ic=0;ic<Iter;ic++){
if(x>1)x=2-x;
else
if(x<-1)x=-2-x;
if(y>1)y=2-y;
else
if(y<-1)y=-2-y;
if(z>1)z=2-z;
else
if(z<-1)z=-2-z;
if(w>1)w=2-w;
else
if(w<-1)w=-2-w;

const float vm=sqrt(x*x+y*y+z*z+w*w);
if(vm<0.5){
x*=4;
y*=4;
z*=4;
w*=4;
} else
if(vm<1){
const float vsq=vm*vm;
x/=vsq;
y/=vsq;
z/=vsq;
w/=vsq;
}
x=x*2+ctx;
y=y*2+cty;
z=z*2+ctz;
w=w*2+ctw;
if ((x*x+y*y+z*z+w*w)>3600) break;
}
if(ic<Iter)return false;else return true;

}


Hope that Spring ends soon!! :sneeze:
I really want to breathe again!! :blownose:
Image details
Image size
1024x1024px 1.1 MB
© 2011 - 2021 Aexion
Comments5
Join the community to add your comment. Already a deviant? Log In
NigNag's avatar
Aexion's avatar
thunder7's avatar
WOW Ur just keep Blowing my Mind!
dark-beam's avatar
Arg, really awesome! Too bad my pc is not working fine those days and too few time; link sent to Jesse!

God bless you friend :hug: sorry for the laaaaaaate reply :shrug:
dmaland's avatar
High calorie fractal treats! Woo! :D