Problem with date container for LOOP component

Hi, All.
I am learning how to use loop component and read a script showing below
image


I try to undertand it by copying batteries onto grasshopper panel, while when come to input data for loop, it indicate some step should be wrong.
image
I think I have made some mistakes in red circle, but because I can not read all button’s full name, I cannot clarify which button need to correct. image , I think it is the last panel, which should contain only one data ‘true’.
Am I wrong to use panels as data container for the algorithem? Are they panels?
image
Could anyone help me with my problem?
Many thanks
p309 loop component.gh (20.4 KB)

I have solved this problem already.
It seems I need to right click on the panel and select multiline, then write both , ie, ‘move’ and ‘Rnd’ as two seperate date.
And for the ‘eval’ ‘Rnd’ panel, I should change ‘eval’ for ‘evalsrf’
Though simple for expert, really cost me some time to solve it :rofl:!
Hope my post will help someone who happen to meet the same problem~p309 loop component.gh (20.8 KB)

2 Likes

Instead of using these obscure, old components, you could try to recreate it with something like Anemone instead. Congrats, on solving it! :slight_smile:

Here’s a similar solution using Anemone, if you’re interested.

Instead of using expensive surface evaluations, I look for a random point inside a “cone” that sits with its apex (i.e. tip) on the previous point and has a height corresponding to a random radius. The cone is only a mathematical construct not real geometry.

This method has the benefit that you can easily avoid intersecting spheres by dialing down the maximum apex angle. A small angle produces straighter figures, whereas bigger ones yield more squiggly overall paths. It’s not absolutely foolproof, however using for instance intersection checking would be much more costly.

loop.gh (18.7 KB)

3 Likes

Hi, Diff.
Thanks! I am surely need updates of new components such as ANEMONE :slight_smile:
I will study this new one tomorrow.
Thanks for your time and answer :handshake:

1 Like

Hi, Diff
I read through your script. I can understand 90% of them now, and will read more times the following days.
There are 2 questions I am not able to fully understand, if you happen to see this post , I hope you could be willing to share a bit more info on the following ques :pray:
1 why it need to rotate twice? just for more random rotate or some other purpose? ( circle 1)
2 why the seed for button ‘random’ needs to be specified by so large number? (circle 2) it seems I need to research on ‘seed’ to clarify its use. :sweat_smile:

Here the first two inputs of the first Random component are left at their default values, which means the a single random number between 0.0 and 1.0 gets returned. It’s Seed input is driven by the loop iteration count, which means that each iteration the loop runs we are guaranteed to get a distinct random number.
Multiplying by 1000 might or might not be necessary. I just prefer to have a large seed, which probably doesn’t change anything. :wink:
Now, we use this scaled random number as the seed of another Random component that again returns a random number that later participates in defining the random rotation angle in radians.
We only need the second Random component to get another, distinct random number, since the one from the first component is already used for another operation, but we still can use it as the seed for the next Random component, if that makes sense?

There is no true randomness at least for computers! You can imagine that if you request a random number nonetheless, the computer produces a large set of numbers and then picks one for you. Now, it needs a parameter to even know, which one to pick and that’s where the random seed comes into play. It determines which number gets picked, which means that you can fix results with the seed, since it guarantees that you always get the same random number.
If you don’t define a seed and relaunch Rhino or recompute the Grasshopper canvas, you’ll get a different result each time, and that’s because the random seed is then driven by for instance the computers internal clock, which kinda produces unique values each second, if the date is included. Each year only happens once. :slight_smile:

OK, since Anemone doesn’t seem to recompute the entire Grasshopper canvas, you’ll always end up with the exact same result, not a randomized one, since the seed is only set once.

Now, we change the seed inside the loop ourselves and make it dependant on the loop iteration count, which changes each time.
Still this isn’t enough, since the loop count is always the same (i.e. 0, 1, 2, 3, …), which would produce the same overall result, and this is why we also generate an x-amount of random radii outside of the loop. This guarantees that each iteration gets some extra spice and you can change the Seed of this Random component manually with a slider if you want a different result, or even write down the seeds of nice results to explore further, nonetheless being able to reinstate them later. :smiley:

Here you have to understand that we start with a point “on an already existing sphere” (i.e. D0) and a directional vector (i.e. D1) that defines the central axis and direction of a “cone” that sits with its apex (i.e. tip) on the sphere point.
From there we “copy” this directional vector by normalizing it to length one and then scaling it to a random radius - the radius of the next sphere - and using it as the z-axis of a new plane. This plane gives us an x- and y-axis to rotate around. It doesn’t matter which one we chose. The rotation is driven by a random angle which defines the apex angle and thus radius of the base of the cone. We now have a vector that now corresponds to a line on the surface of a cone (not the base surface), starting at its apex and of a random length that is equal to the random radius of the next sphere. We rotate again, this time around the original directional vector or central axis of the cone with an angle between 0 and 360° (2*Pi) to find a random next point on the cone surface that lies on a circle which is produced by cutting the cone and the end of the current vector horizontally with a plane. This point becomes the next point “on a sphere” and the randomized vector the next directional vector and so fourth.
We rotate twice to basically find a random point at a random distance on an imaginary cone. :slight_smile:

Hi, Diff.
I can understand the motivation of this scripts now with your detailed explanation !

Now I understand: 1 seeds can help to control which change step should be selected for original geometry within given iteration count
2 the rotation action can also be implimented by any times we want to get a more obvious change in the generation of next sphere (image below)

The process is very clear with your description. :slight_smile:
You are really helpful .Thanks a million !
I hope I can also help others like you after I master GH well in the near future

1 Like

Sounds right.

Exactly, that is what the first vector rotation you asked about is for. You can control it with the angle slider.