POV-Ray : Newsgroups : povray.general : Placing objects on spheres... : Re: Placing objects on spheres... Server Time
5 Aug 2024 16:11:00 EDT (-0400)
  Re: Placing objects on spheres...  
From: TinCanMan
Date: 27 Aug 2002 14:54:53
Message: <3d6bcafd$1@news.povray.org>
Try dissecting this macro I wrote a couple of years ago.  It basically
triangulates a sphere to 'n' iterations (like a geodesic sphere).  The
limitation here is that you are restricted to the number of points related
to the iteration level 'n' (I don't know the formula off the top of my
head).  I did this a long time ago and my brain isn't functioning properly
at the moment to be of any further help...

-tgq


#macro Geodesic(n,R,Obj)
  union{
    #if (n=0)
      object{Obj}
    #else
      #local nL=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<nS)
            object{Obj translate<0,0,-R> rotate x*i*90/nL rotate y*j*360/nS}
            #local j=j+1;
          #end
        #end
        #local i=i+1;
      #end
    #end
  }
#end


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.