How to jitter these lists separately within a defined domain

Hi guys,

So im trying to write a script for what is essentially a data representation chart, type thing. But im currently struggling with this part of it.

Diagram Script V1.gh (55.1 KB)

So essentially what i have at the moment is a grid with a circle in it. All cells outside of the circle are excluded. Then the cells are divided into groups based on their distance from the centre. Each group is then extruded to a set height.

Now the issue is, I would like to set a jitter to each group (within a set domain) but depending on the way i add the jitter component, the results are either everything is jittered completely to the point that the defined heights of each group is gone

Or the jitter just doesnt work at all



I’m still pretty new to actually writing my own scripts in grasshopper. Can anyone give me a hand on where I’m going wrong please?

Diagram Script V2.gh (79.5 KB)

Hi, I do not think jitter works as the way you are intending it to work. Jitter takes a list of values and randomises their order. Whereas you want some random variations to each individual value in a list, right?

If so, there are many ways to do so, including the one attached in the revised gh script. This takes the number of values you have in your list (list length), and generates an equal number of random values, within a range you set. Each of these random numbers are added to their corresponding value from your list of heights.

There are two separate scripts, pick the one that works best for your purpose.
The first script, randomises the heights by a range that is a fraction of the original height of each value. In this case larger values may get very larger absolute changes in heights, while smaller values can only get smaller absolute changes in height.
The second script randomises the heights by a the same range of heights, regardless of the original length of value, such that a small value and a large value may get the same change in height.

2 Likes

You Beauty!

yes you are absolutely right, i was completely mistaken on how jitter works. But the way you explained it makes far more sense then what i assumed.

It is your first script that works the way i am after. And thankyou for taking the time to explain it to me! as my mistake now seems a bit more obvious to me.

Thanks again for your help on this!

1 Like