Home

/*
Geodesic(n,R,Obj)
n=subdivision level
R=radius of geodesic shpere
Obj=object to place geodesically
*/

#macro Geodesic(n,R,Obj)
  union{
    #if (n=0)
      object{Obj}
    #else
      #local nL=pow(2,(n-1));
      #local i=-nL;
      #while (i<=nL)
        #local nS=4*(nL-abs(i));
        #if (nS=0)
            object{Obj translate<0,0,-R> rotate x*i*90/nL}
        #else

          #local j=0;
          #while (j rotate x*i*90/nL rotate y*j*360/nS}
            #local j=j+1;
          #end

        #end
        #local i=i+1;
      #end
    #end
  }
#end

#declare SP=sphere{0,6 pigment{rgb 1}}
object{Geodesic(5,100,SP)}

camera{
  up y
  right x*image_width/image_height
  angle 30
  location <0,0,-1000>
  look_at  0
}
light_source{ <0,1000,-1000> rgb 1 }

Hosted by www.Geocities.ws

1