Grasshopper

algorithmic modeling for Rhino

 

Dear all,

As I know we could divide a curve by distance, number and length.

By divide-distance using GH or GH Paneling-tool we always get the last 'segment' shorter than other.

I am curiously if it is theoretically possible to obtain a division which fulfills at least conditions below:

1. Equal distance between points and

2. All nude locate exactly on the given curve.

3. Number of division at least 3.

Views: 3363

Replies to This Discussion

It's not necessarily possible. Distances measured along the curve are continuous and you can therefore always choose to divide a curve into N segments of equal length. However when you measure distance in Euclidean space then the distance metric can be discontinuous:

Discontinuous means that a tiny change in input may result in a large change in output. Observe the image above, we start measuring euclidean distances from point A. At first the process appears to be continuous. We measure at distance b and we get point B. We increase the distance slightly to c and we get point C, which is very close to point B. We increase the distance slightly again to d, but now suddenly we're in a completely different location. This jumping behaviour can mean that certain questions (such as: "how do I divide this curve into 4 points, all equally far apart?") do not have an answer. It could be possible for 3 and 5, but not 4.

Another problem is that there may be multiple solutions. In the image above the point D isn't the only point that is d units away from A and coincident with the curve. There may be any number of those points depending on the shape of the curve, the location of A and the value of d. And of course once you have two (or more) solutions, you can have two (or more) answers. Then each of those solutions may yet again have more than one outcome for the next point in the chain and before you know it the question you asked has 35295 different answers and good luck trying to find one you like.

Now of course sometimes it is possible to answer your question unambiguously. I made a solution that uses Galapagos. It's pretty slow, and it'll get slower the more segments you want:

--

David Rutten

david@mcneel.com

Tirol, Austria

Attachments:

hi david,

 

thx for clearly explanation! galapago works fine, but just (as u said) take time...

i am trying another approach with hoopsnake, once i got any result will share here.

 

 

Though this is an old conversation, I though I might add a solution:

1) Find all points the desired distance from current position

2) Determine the corresponding curve parameters

3) Sort parameters and select the next highest from the current position

4) Return corresponding point

C# implementation attached

Cheers, Ben

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