|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
Post a reply to this message
|
|
| |
| |
|
|
From: Sven Littkowski
Subject: Re: The Eternal Student: Loop Problem
Date: 29 Jan 2018 03:38:51
Message: <5a6edd9b@news.povray.org>
|
|
|
| |
| |
|
|
Problem solved, thanks a lot! :-D
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Le 18-01-28 à 20:24, Sven Littkowski a écrit :
> 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
>
If "Element" is at the origin, the rotation don't make it move. So, each
object are at the same location. If there is no obvious way to
distinguish one rotated object from another object with a different
rotation, like several spheres, you'll only see what look like a single
object.
Your rotates are:
0 to 45° around the X axis.
0 to 1° around the Y axis = negligeable.
0 to 10° around the Z axis = small rotation.
It's possible that int(20*rand(MyRandom)) could return 1 at the first
iteration, resulting in only a single object been placed. Try adding
something like +2 or +3 to that value.
Possible solutions :
1) Create "Element" at some distance from the origin, or increase the
distance that you translate it now.
2) Instead of only rotating your object, start by also randomly
translating some distance.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 29.01.2018 02:49, Thomas de Groot wrote:
> 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.
>
Thanks everyone, that initial problem seems to have been solved now. :-D
---
Diese E-Mail wurde von AVG auf Viren geprüft.
http://www.avg.com
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|