POV-Ray : Newsgroups : povray.binaries.images : seven arms : Re: seven arms (57 Kb) Server Time
31 Jul 2024 20:21:11 EDT (-0400)
  Re: seven arms (57 Kb)  
From: Alain
Date: 19 Aug 2009 12:18:10
Message: <4a8c25c2$1@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
> // ------------------------------------------------------ 
> 
> 
> 
In the case "A", you start ON the X axis and your first rotation been 
around that axis does nothing. Well, it rotate a sphere on itself and 
don't have a visible result. Just redefine Tree as:
cone{-y,2,y,0}//a cone with the same bounding box,
And you'll see the effect of the first rotation. All the trees will lay 
flat on the sphere, ther axis tangent to it's "surface".

So, the first rotate is effectively a "throw away"
Net result: ONLY 2 effective rotations.

In the case "B", You start on the Y axis. Now, the first rotation DOES 
move the object, then, unless you rotated by exactly 0 or 180, the 
second rotation moves the object further. Then, you rotate around the Z 
axis.
Net result: 3 successive rotations.
The redefined trees will all point outside.

The same would appens if you started at z*60. All 3 rotations would 
affect your final position.



Alain


Post a reply to this message

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