Grasshopper

algorithmic modeling for Rhino

Divide Curve into Random Length with min and max bounds

I'm trying to divide a curve into random lengths (got that thanks to Danny), but I want those lengths between a min. and max length.  In the below example, I would like to have 10 lengths no shorter than 1.0 and no longer than 3.0. 

 

 

Views: 17388

Replies to This Discussion

Geeez, I got it.  Never said I was fast. :)

 

Nice.  Thnx for posting that.

 

Chris

Chris,

I'm only showing the curve shattered into 4 segments.  I want the number of curve segments to be an input also.  Thats easy.  I'm just going to generate a large data set with the random number generator and then cull out how many segments I want. 

Fun stuff.

 

 

Well, thought it was working.  The inputs into the Eval are in the range of 0.100 and 3.000, but the last yellow panel on the right shows values (0.0825) out of bounds (not counting the last value of 11.xxx). 

 

 

This seems to work more or less (ie. it's not recursive). You have to look at the last segment to make sure it's in the max-min range.  If not choose a different randomization seed.

 

Chris

Attachments:

Thanks Chris,

 

I'll study your definition over the weekend.

 

I'm writing a recursive script that will have input control over the min. length, and max. length (and still remain random) that will be inputs for the length factor of the shatter command.

 

It seems you have interest in this same problem. I'll keep you posted when I get the script written. Give me a couple of days.   

I finally figured out what the "eval length" command was doing with the length factor input.  So I added a simple VB script to have control over the min. and max. lenth that the shatter command works on. 

 

Everything works great with one curve. 

 

Now I want to offset the base curve and shatter the offset curves with random lengths. The offset works fine, but the shatter is not random.  It is copying the same "random pattern" from the first base curve.

 

The eval and shatter (orange in below image) just uses the same set of random numbers on all curves.  I've generated enough random numbers for the total length of all 4 curves.

 

How can I use the first 18 random numbers on the first curve, random numbers 19 thru 37 on the second curve, and so on ...

 

 

It looks like you have to separate the two curves you want coming out of the trim component and then shatter them individually using two random lists that you can get by splitting the list coming out of the vb component.

 

Chris

Thanks Chris,

Since I'll have 100's of seperate curves (each with it's own random shatter) a manual process won't work.

I'll figure something out.  "If it was easy, everyone would be doing it, and I wouldn't".  :)

Greg-

I couldn't get the script to work properly.  All in all though an interesting problem.  Here's another look at it without the script.

 

Chris

Attachments:

Chris,

All the script is doing is taking a list of random numbers (1,2,3,4,...) and adding the first with the second (1+2=sum), then (sum+3=sum), then (sum+4=sum), etc.  When the sum reaches the curves total length, the while loop exits.

 

The difference between the numbers (the spread ?) are my random numbers that are between the min. and max. range. Thats what the eval length component wants. 

 

Its interesting you added components to clean up the "tree".  One of our difinitions should work, but last night I could tell the "tree" wasn't correct. I tried everything to clean it up. 

 

Anyways, I'll look at your def. and work on the problem today.

 

It is an interesting problem.  If it wasn't for GH, I wouldn't have gotten this far.

 

Greg 

Could you help me,

I would like to do something similar,

I want to divide curve with range of numbers 30,40,50,60,70,80,90

So i would like to divide lenghts with these numbers, in random way.

Tnx

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