// POLAR / Beads '00.02 // 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 {<2000, 10000, -5000> color <1,1,1>} light_source {<-60000, -30000, -40000> color <0,1,0>} camera { location <-30,-100,-100> angle 4.7 look_at <0.2, 0.1, 0> } #declare Rndm = seed(59); #declare Rdg=5; //radius of arranging sphere //initialize the coordinates of beads (X=Cp[I][0] Y=Cp[I][1]) #declare Imax=100; #declare Cd=array[Imax][3] #declare I=0; #while (I0.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 #declare I=0; #while (I0) #declare Ai=sqrt(Cd[I][0]*Cd[I][0]+Cd[I][1]*Cd[I][1])/2/Rdg; #declare Ri=sin(Ai)*cos(Ai)/Ai; #else #declare Ai=0; #declare Ri=1; #end //arranging beads and calculating the coordinates of the holes position #declare Cd[I][0]=Ri*Cd[I][0]; #declare Cd[I][1]=Ri*Cd[I][1]; #declare Cd[I][2]=Rdg-2*Rdg*sin(Ai)*sin(Ai); #declare I=I+1; #end //initialize the coordinates for mesh Cp(x,y,z,r) #declare Vmax=72; // #declare Hmax=2*Vmax; #declare Cp=array[Hmax][Vmax+2][4] #declare V=0; #while (V, , } triangle { , , } #end //normal vector of the plar coordinates point #macro Vd (Ph,Pv) <(Cp[mod(Ph-1+Hmax,Hmax)][Pv][1]-Cp[Ph][Pv][1])*(Cp[Ph][Pv-1][2]-Cp[Ph][Pv][2])-(Cp[Ph][Pv-1][1]-Cp[Ph][Pv][1])*(Cp[mod(Ph-1+Hmax,Hmax)][Pv][2]-Cp[Ph][Pv][2]), (Cp[Ph][Pv-1][0]-Cp[Ph][Pv][0])*(Cp[mod(Ph-1+Hmax,Hmax)][Pv][2]-Cp[Ph][Pv][2])-(Cp[mod(Ph-1+Hmax,Hmax)][Pv][0]-Cp[Ph][Pv][0])*(Cp[Ph][Pv-1][2]-Cp[Ph][Pv][2]), (Cp[mod(Ph-1+Hmax,Hmax)][Pv][0]-Cp[Ph][Pv][0])*(Cp[Ph][Pv-1][1]-Cp[Ph][Pv][1])-(Cp[Ph][Pv-1][0]-Cp[Ph][Pv][0])*(Cp[mod(Ph-1+Hmax,Hmax)][Pv][1]-Cp[Ph][Pv][1])> #end //smooth_triangle of the surface #macro Trisd (Ph,Pv) #declare Ph1=mod(Ph-1+Hmax,Hmax); smooth_triangle { Vd(Ph,Pv) Vd(Ph1,Pv-1) Vd(Ph,Pv-1) } smooth_triangle { Vd(Ph1,Pv) Vd(Ph1,Pv-1) Vd (Ph,Pv) } #end //radius caliculation and the translation from polar to xyz coordinsates #declare V=0; #while (V 0.15 } #declare P=P+1; #end texture { pigment { color rgbt <1,0.2,0.1,0.5>} finish { reflection 1 ambient 0.2 phong 1 brilliance 1 diffuse 1 } } rotate <70,140,260> no_shadow } background {color rgbt <0.01,0,0.2>}