POV-Ray : Newsgroups : povray.binaries.images : seven arms : Re: seven arms (57 Kb) Server Time
31 Jul 2024 14:27:44 EDT (-0400)
  Re: seven arms (57 Kb)  
From: bgimeno
Date: 19 Aug 2009 01:18:27
Message: <4a8b8b23@news.povray.org>
This is not a thread about the disadvantages of the function rand () of 
pov-ray, but a comment on one of its peculiarities.
In my first post the objects are arranged in a spiral of seven arms through 
(or despite) the pseudorandom function. Now I used the same loop to 
distribute objects around a sphere.
Code A generates the image with pattern that would correspond to the spiral 
of the first post (Note seven leaves).

Interestingly, code B randomly distributed spheres of the whole area.

B. Gimeno

#include "colors.inc"
#include "math.inc"

camera {location <0,150,-150>
        look_at <0,0,0>
       }
light_source {<50,300,-100> colour White}
light_source {<-150,300,-100> colour White}

#declare Tree =  sphere {<0,0,0>2 pigment {White}} ;

#local Num_Tree = 0 ;
// ------------------------------------------------------
#while (Num_Tree<5000)
  #local rnd_tree = seed (Num_Tree);
  object {Tree
          translate x*60       // code A
          rotate <rand(rnd_tree),rand(rnd_tree),rand(rnd_tree)>*360
          }
  #local Num_Tree = Num_Tree +1 ;
#end
// ------------------------------------------------------
#while (Num_Tree<5000)
  #local rnd_tree = seed (Num_Tree);
  object {Tree
          translate y*60       // code B
          rotate <rand(rnd_tree),rand(rnd_tree),rand(rnd_tree)>*360
          }
  #local Num_Tree = Num_Tree +1 ;
#end
// ------------------------------------------------------


Post a reply to this message


Attachments:
Download 'random_test.jpg' (57 KB)

Preview of image 'random_test.jpg'
random_test.jpg


 

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