Grasshopper

algorithmic modeling for Rhino

simple point population with range of distance between points

Hi All,

My question/ problem is a pretty simple one.

Essentially, what I need to do is populate a line of variable length with points that are randomly placed with specific range of distances apart, to start between 1/8" to 5/32" apart, no more/ no less.

I feel like this requires some recursion, which I'm rusty with.

Please help!

Thanks.

Views: 1733

Replies to This Discussion

Take a look at this thread from last month:

Randomly divide a closed curve
http://www.grasshopper3d.com/forum/topics/randomly-divide-a-closed-...

The code I posted, using Anemone, works with curves, open or closed, including lines.

There might be a more elegant solution to this than recursion.

We generate random values between your two ranges,and then use the consecutive domains function to extract an increasingly larger distance with all our increments, (included a safe-guard to always calculate enough values by dividing the curve length by the smaller value of your fixed range, and then cull all units greater than the curve length), and then evaluate the curve at the given length parameters.

The purple grouped part is only there to prove that all our distances fall within the given range.

Attachments:

Looping and recursion are two different things...  But you are right that a loop isn't needed.  I had forgotten all about 'Evaluate Length'.

I would simplify your code further though:

Just one little problem that I haven't got the patience to solve at the moment; using a circle (closed curve), the first interval appears to be doubled...?

Attachments:

This is great, Thank you all for your help. 

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service