Grasshopper

algorithmic modeling for Rhino

Morning guys...

If I have a collection of elements and I want to rotate them using a fix collection of angles. Let's say 30, 45, 90 or in rads 0.5, 0.8 and 1.57.

As you guys can see on the image, I've input a random rotation value from 0 to 360, but what I really want as an input rotation value is a list like this:

0.5

0.8

0.5

1.57

0.5

0.8

0.8

1.57

How can I create this kind of list? Any ideas??

Thank you very much in advance

Have a nice day

Eduardo

Views: 2510

Attachments:

Replies to This Discussion

you can define the angles that you want to select as a list (like a bag of numbers)

then connect this to the L input of a component to a Sets>listItem component

Then connect the random component to I of the listItem component.

Then to generate the number of random angles you need, input that to the N of the random component.

And you'll want the domain of the random select to be 0 To List length (3)...(with Wrap on on the List item component, this takes care of the chance of picking the first or last item as being the same as all in between elements)

You can think of this method as a lucky dip bag with replacement.

Hi Julian, thanks for the reply.

I must have something in the wrong place, because if I do this, what I get is a tree list of a 100 elements with 3 inside them.

What I'm looking for is a random list of this 100 elements being the 3 diferent numbers on a random disposition.

Let me upload the file and see if you can spot what I' am doing wrong.

cheers

Attachments:

you were almost there... you just needed a second list length and to ensure you feed it a list of items from the panel by making it multiline.

and for greater accuracy, perhaps use the convert to radians component before the list you select from.

see attached.... the white list is the output... the bit after is just proof that you'll get a uniform distribution because of the wrap=true

i.e

0 To 0.49999 will produce an index of 0, 

0.5 To 1.49999 will produce an index of 1, 

1.5 To 2.49999 will produce an index of 2,

2.5 To 3.0 will produce an index of 3 which transforms to 0, giving 0 a similar likelihood of selection as 1 and 2. (it will have marginally more chance of likelihood) because ideally you want the range to produce the closest number to 3.0 (2.999999999...) and not actually 3

Attachments:

Central Limit Theorem proof of the average for large sample sizes shows uniformity.

Thank you very much for this Julian , really helpfull stuff.

Now I get How this works

HAVE A LOVELY DAY

Attachments:

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service