POV-Ray : Newsgroups : povray.advanced-users : <sighs> Cornflower rows : <sighs> Cornflower rows Server Time
29 Jul 2024 04:18:48 EDT (-0400)
  <sighs> Cornflower rows  
From: Greg M  Johnson
Date: 10 Feb 2003 10:11:19
Message: <3e47c117@news.povray.org>
There's an algorithm for uniformly placing objects on a sphere.  I've pasted
it below with apologies as I don't know from whom I originally got it.  The
question is:

Does anyone know of an algorithmic way to determine which are the nearest
neighbors to any particular point?
Does anyone know of another, close-enough algorithm that would have a more
straightforward way of determining this?




#declare Gball = union{
        //sphere { 0, 1 }
        #declare N = 150;               //arbitrary 150422;
        #declare nn = 0;               //arbitrary 150422;
        #declare R = 1/sqrt(N); //also arbitrary
        #declare Theta = 0;
//        #declare H = (N-1)/N;   //I dunno which of these makes a
betterpattern.
      #declare H = 1;                 //There's a logical argument
foreither.
        #while (H >= -1)
                #declare Phi = degrees(acos(H));

                sphere { <0,1,0>, R*2
                        rotate <Phi, Theta, 0>
                        inverse
                pigment{color rgb nn/150}
                finish{reflection 0.0 specular 100000}
                        }
                #declare H = H - 2/N;
                #declare Theta = mod (Theta + 137.5077641, 360);
                #declare nn=nn+1;
        #end
        //texture {Tex_2 }
        }


Post a reply to this message

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