Grasshopper

algorithmic modeling for Rhino

Hi,

I'd like to divide a circle into different part, each of those parts having a random length between a range of 2 values, 1 and 2 for example. As the curve is not divided into equal parts, there will very probably be a leftover part, smaller than one. I want this part to be removed. 

I tried to solve this simple problem using different ways, but couldn't succeed. 

Thanks for your help.

Views: 194

Reply to This

Replies to This Discussion

OK, forget what I posted earlier, it was wrong - I will delete those posts...

My mistake is a common one; I've made it before, based on the assumption that 't' (0.0 to 1.0) is proportional to length for a reparameterized curve.  It's not!  This is demonstrated by splitting the curve using the 't' values and measuring the lengths, which in the case below are either 2.0 or 3.0 (domain bounds and random integers).  As you can see, the actual lengths don't match those integer values:

I remembered doing this before and found my code in this thread from January, 2017:

divide curve by distance between points
http://www.grasshopper3d.com/forum/topics/divide-curve-by-distance-...

So I modified that code to use 'DivLength' (along the curve) instead of 'DivDist' (straight line between points) and combined it with the code I posted earlier in this thread.  Notice the results in the upper right yellow panel - exactly the lengths expected.  This requires Anemone and clicking the "Trigger" button to restart the looping:

P.S.  The points are available at the 'D1' output of 'Loop End'.

Attachments:

If you connect a wire between 'Num' and the 'T (Trigger)' input to 'Loop Start', in addition to the existing 'Trigger' button, then any change to the slider values will trigger the loop to restart - in addition to the 'Trigger' button.

Thank you so much for the answer Joseph.

The definition seems to work for open curves. I am trying to divide closed curves, and something that I couldn´t explain myself gets wrong with the division for this particular case.

However, in my case, an easy trick which consists in shattering the closed curve into 2 open curves, one of them being infinitely small. I can then use your definition for my "faked" open circle, and it´s more than enough for what I am doing.

Thanks again!

Oh yeah, I knew that and forgot about it.  Clever solution!

In this case though, the code can be easily fixed:

Attachments:

Fantastic!

RSS

About

Translate

Search Grasshopper

Photos

  • Add Photos
  • View All

© 2017   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service