|
|
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
|
|