POV-Ray : Newsgroups : povray.general : The Eternal Student: Loop Problem : Re: The Eternal Student: Loop Problem Server Time: 23 Jul 2019 12:26:33 GMT
 Re: The Eternal Student: Loop Problem
 From: Kontemplator Date: 29 Jan 2018 12:05:00
```Sven Littkowski <I### [at] SvenLittkowskiname> wrote:
> I am doing that now: I declared an initial position, and inside the loop
> move that position forward at a fixed amount. Aim is to create something
> like a chain-alike structure. However, I still have the same problem:
> only one item is visible. I don't even see any more items in different
> angles, not even at the same position.
>
>
> #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 MyPosition = 0.00;
> #local MyElement  = 0;
>
> #while (MyElement<MyLength)
>  object { Element translate < 0.0, 0.0, MyPosition > rotate < MyX, MyY,
> MyZ > }
>  #declare MyRandom = seed (27053);
>  #local MyX        = rand(MyRandom)*45;
>  #local MyY        = rand(MyRandom)*1;
>  #local MyZ        = rand(MyRandom)*10;
>  #local MyPosition = MyPosition+0.45;
>  #local MyElement  = MyElement+1;
> #end

Thats a nice trap for the average brain. :)

#warning concat(str(MyLength,1,1)) shows that your initial myLengt is 1. Try
another seed value or change your random to MyLength = Min +
Int(Max*rand(MyRandom));
```