POV-Ray : Newsgroups : povray.general : The Eternal Student: Loop Problem : Re: The Eternal Student: Loop Problem Server Time
25 Apr 2024 03:18:21 EDT (-0400)
  Re: The Eternal Student: Loop Problem  
From: Kontemplator
Date: 29 Jan 2018 07:05:00
Message: <web.5a6f0cede85d5c0eb414b8600@news.povray.org>
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));


Post a reply to this message

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