// NET / Sphere Face of Winding Triangle Net '00.11 // By Tsutomu HIGO E-mail: nj2t-hg@asahi-net.or.jp #version 3.1; global_settings { max_trace_level 5 assumed_gamma 2.2 } light_source {<0, 0, -16> color <1,1,1>} camera { location <-25,-10,-45> angle 77 look_at <40, 17, 0> } #declare Rndm = seed(12); #declare Rdg=16; //radius of arranging beads #declare Rsize=0.15; #declare Ratio=1.5; //initialize the coordinates of beads (X=Cp[I][0] Y=Cp[I][1]) #declare Imax=788; #declare Cp=array[Imax][2] #declare I=0; #while (I} finish { reflection 1 phong 2 brilliance 1 ambient 0.3 } } #macro Spdr (Center) //reduction ratio from plane to arranging shape at point P #declare Ai=sqrt(Cp[Center][0]*Cp[Center][0]+Cp[Center][1]*Cp[Center][1])/2/Rdg; #declare Ri=sin(Ai)*cos(Ai)/Ai; //arranging beads sphere { Rsize texture { Tecs } no_shadow } #end #macro Cydr (Cptp, Cpbt) //reduction ratio from plane to arranging shape at point P #declare Aitp=sqrt(Cp[Cptp][0]*Cp[Cptp][0]+Cp[Cptp][1]*Cp[Cptp][1])/2/Rdg; #declare Ritp=sin(Aitp)*cos(Aitp)/Aitp; #declare Aibt=sqrt(Cp[Cpbt][0]*Cp[Cpbt][0]+Cp[Cpbt][1]*Cp[Cpbt][1])/2/Rdg; #declare Ribt=sin(Aibt)*cos(Aibt)/Aibt; //arranging beads cylinder { Rsize texture { Tecs } no_shadow } #end #macro Cydr0 (Cptp) //reduction ratio from plane to arranging shape at point P #declare Aitp=sqrt(Cp[Cptp][0]*Cp[Cptp][0]+Cp[Cptp][1]*Cp[Cptp][1])/2/Rdg; #declare Ritp=sin(Aitp)*cos(Aitp)/Aitp; //arranging beads cylinder { Rsize texture { Tecs } no_shadow } #end //from cos to angle (0-2*pi) #macro Acosc (Rc,Dy,Ac) #declare Ac=acos(Rc); #if (Dy<0) #declare Ac=2*pi-Ac; #end #if (Ac=0) #declare Ac=2*pi; #end #end //rotate coordinates Nrot at angle Arot #macro Rota (Nrot,Arot) #declare Cpx=Cp[Nrot][0]; #declare Cpy=Cp[Nrot][1]; #declare Cp[Nrot][0]=Cpx*cos(Arot)-Cpy*sin(Arot); #declare Cp[Nrot][1]=Cpx*sin(Arot)+Cpy*cos(Arot); #end //coordinates of starting 7 beads (arranged bead radius = 1) #declare I=0; #while (I<6) #declare Pe=1+I; #declare Cp[Pe][0]=Cp[0][0]+2*cos(pi/3*I); #declare Cp[Pe][1]=Cp[0][1]+2*sin(pi/3*I); Spdr (Pe) Cydr0 (Pe) #if(I>0) Cydr (Pe,Pe-1) #end #declare I=I+1; #end Cydr (6,1) //initial declarement #declare Ap=0; #declare As=0; #declare Al=0; #declare Ae=0; #declare An=0; #declare Ad=0; #macro Spculc (N,P,Pe) //reduction ratio from plane to arranging shape at point P #declare Ao=(sqrt(Cp[P][0]*Cp[P][0]+Cp[P][1]*Cp[P][1]))/2/Rdg; #declare Ro=sin(Ao)*cos(Ao)/Ao; //rotate to X axis Acosc(Cp[N][0]/sqrt(Cp[N][0]*Cp[N][0]+Cp[N][1]*Cp[N][1]),Cp[N][1],An) Rota (N,-An) Rota (N+1,-An) #declare Cp[N+1][1]=Cp[N+1][1]*Ro; Rota (P,-An) #declare Cp[P][1]=Cp[P][1]*Ro; #declare Rs=sqrt(pow(Cp[P][0]-Cp[N][0],2)+pow(Cp[P][1]-Cp[N][1],2))/4; Acosc((Cp[P][0]-Cp[N][0])/4/Rs,Cp[P][1]-Cp[N][1],Ap) #declare Re=sqrt(pow(Cp[N+1][0]-Cp[N][0],2)+pow(Cp[N+1][1]-Cp[N][1],2))/4; Acosc((Cp[N+1][0]-Cp[N][0])/4/Re,Cp[N+1][1]-Cp[N][1],Ae) Acosc(Rs,1,As) Acosc(Re,1,Al) #if (rand(Rndm)>0.3) #declare Ad=0.5*rand(Rndm); #end //confuse the arrangement #if (Ae-Ap<0) #declare Ap=Ap-2*pi; #end #declare Bo=acos(1/Rdg/tan(pi-2*Ao)); #if (Ao>pi/4) #declare Rb=2*Bo/pi; #else #declare Rb=1; #end #if (Ae-Ap-As-Al-Ad>0) #declare I=0; #while (I0) #declare I=0; #while (Ipi/2-1/Rdg) #declare Jd=Jdl; #end #declare Jd=Jd+1; #end