int numSeg=1000; float x,y,z,xx,yy,zz,mu,r,theta,phi,beta,dr,dg,db,ra,ga,ba; float distx=0; float disty=0; float m=8; int choice=1; color bg=color(0); void setup(){ size(400,400,P3D); background(bg); initColor(); } void initColor(){ dr=random(.02); dg=random(.02); db=random(.02); ra=random(TWO_PI); ga=random(TWO_PI); ba=random(TWO_PI); } void draw(){ float this_ra=ra; float this_ga=ga; float this_ba=ba; background(bg); translate(width/2,height/2); rotateY(distx); rotateX(disty); for(int i=1;i<=numSeg;i++){ xx=x; yy=y; zz=z; mu=TWO_PI*i/numSeg; if(choice==1){ x = 10 * (cos(mu) + cos(3*mu)) + cos(2*mu) + cos(4*mu); y = 6 * sin(mu) + 10 * sin(3*mu); z = 4 * sin(3*mu) * sin(5*mu/2) + 4*sin(4*mu) - 2 * sin(6*mu); }else if(choice==2){ x = (4 * cos(mu + PI)) / 3 + 2 * cos(3 * mu); y = 4 * sin(mu) / 3 + 2 * sin(3 * mu); z = sin(4 * mu) + sin(2 * mu) / 2; }else if(choice==3){ beta=PI*i/numSeg; r= 0.8 + 1.6 * sin(6 * beta); theta= 2 * beta; phi= 0.6 * PI * sin(12 * beta); x = r * cos(phi) * cos(theta); y = r * cos(phi) * sin(theta); z = r * sin(phi); }else if(choice==4){ beta=PI*i/numSeg; r = 1.2 * 0.6 * sin(0.5 * PI + 6 * beta); theta = 4 * beta; phi = 0.2 * PI * sin(6 * beta); x = r * cos(phi) * cos(theta); y = r * cos(phi) * sin(theta); z = r * sin(phi); }else if(choice==5){ x = -22* cos(mu) - 128* sin(mu) - 44* cos(3* mu) - 78* sin(3 *mu); y = -10* cos(2 *mu) - 27* sin(2 *mu) + 38* cos(4 *mu) + 46* sin(4* mu); z = 70* cos(3 *mu) - 40* sin(3* mu); }else if(choice==6){ x=41*cos(mu)-18*sin(mu)-83*cos(2*mu)-83*sin(2*mu)-11*cos(3*mu)+27*sin(3*mu); y=36*cos(mu)+27*sin(mu)-113*cos(2*mu)+30*sin(2*mu)+11*cos(3*mu)-27*sin(3*mu); z=45*sin(mu)-30*cos(2*mu)+113*sin(2*mu)-11*cos(3*mu)+27*sin(3*mu); } if(i==1){xx=x;yy=y;zz=z;} stroke(155+100*sin(this_ra+=dr),155+100*sin(this_ga+=dg),155+10*sin(this_ba+=db)); drawLine(xx*m,yy*m,zz*m,x*m,y*m,z*m,4); } noLoop(); } void drawLine(float a, float b, float c, float d, float e, float f, int weight){ float density=0.35; for(int i=0;i