//Written by: Stephen Lavedas //Creates a sphere (roughly) of connected points //Center is the center point of the sphere //MRadius is the radius of the sphere //mRadius is the radius of the cylinders and spherical points //Levels determines the sophistication of the Major sphere //(how many points used to define it) #macro TBall(Center, MRadius, mRadius, Levels, Tex) #declare BPoint = <0,1,0>; #declare NPoint = <0,-1,0>; //This is what determines the number of points in the sphere, if you divide a //triangle into smaller triangles, the number of triangles going down the side //is determined by 2^Level #declare Theta = 90/(pow(2,Levels)); #declare Angle = 90; #declare Num = 0; #declare Ring = torus {mRadius, mRadius/15} union { #while (Angle >= 0) object { Ring translate BPoint * MRadius rotate translate Center texture{Tex} } object { Ring translate NPoint * MRadius rotate translate Center texture{Tex} } #declare I = 0; #if (Num > 0) #if (Num > 1) #declare Phi = 90/(Num); #else #declare Phi = 90; #end //Now create the rest of the points around the hemisphere #while (I < Num * 4 - 1) object { Ring translate BPoint * MRadius rotate rotate <0,0,Phi*(I + 1)> translate Center texture{Tex} } object { Ring translate NPoint * MRadius rotate rotate <0,0,Phi*(I + 1)> translate Center texture{Tex} } #declare I = I + 1; #end #end #declare Angle = Angle - Theta; #declare Num = Num + 1; #end } #end