POV-Ray : Newsgroups : povray.general : The Eternal Student: Loop Problem : Re: The Eternal Student: Loop Problem Server Time: 22 Jul 2019 22:42:18 GMT
  Re: The Eternal Student: Loop Problem  
From: Thomas de Groot
Date: 29 Jan 2018 07:49:07
On 29-1-2018 2:24, Sven Littkowski wrote:
> For some reason, my loop doesn't produce many items as intended, only
> one. And I am sure, as usual I am not seeing the forest because of all
> the trees in front of my eyes!  :-D
> 
> 
> #declare MyRandom = seed (27053);
> #local MyLength   = int(20*rand(MyRandom));   // Anzahl der Glieder
> #local MyX        = rand(MyRandom)*45;
> #local MyY        = rand(MyRandom)*1;
> #local MyZ        = rand(MyRandom)*10;
> #local MyElement  = 0;
> 
> #while (MyElement<MyLength)
>   object { Element translate < 0.0, 0.0, 0.45 > rotate < MyX, MyY, MyZ > }
>   #local MyX        = rand(MyRandom)*45;
>   #local MyY        = rand(MyRandom)*1;
>   #local MyZ        = rand(MyRandom)*10;
>   #local MyElement  = MyElement+1;
> #end
> 

All the objects are at the same location :-)

You need to randomise the translate elements too.

-- 
Thomas


Post a reply to this message

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