Grasshopper

algorithmic modeling for Rhino

Hey guys,

I have an area populated with points.  The points have been manipulated, some have been sorted out, so on and so on.  Regardless of the manipulations I apply, I'd like to connect the points with a polyline but I'd like the polyline to travel based on the distance between the points.  I'd like it to go to the closest point in any direction, then the next closest, and so on.

Suggestions?

Thanks again,

EddieW

Views: 3471

Replies to This Discussion

Starting from which point? The two closest ones? Starting in which direction?

Hi David,

Hadnt considered.  In the situation I am in, it doesnt matter too much where it starts.  And after a beginning point is decided, just as long as it goes to the closest point from there, in any direction.

Thanks

It's an iterative process where the state of the problem changes every iteration (basically the pool of points to search gets smaller). This property means that it's very difficult and probably even impossible to do it using regular Grasshopper logic.

Using a small VB script it can be achieved quite easily:

If the spacing between points differs significantly though, it may get confused at the start, going back and forth a few times, 'eating' up points near the start of the search.

Attachments:

thanks david,

this will get the job done. really appreciate it.

ew

Eddi, You can give this user object a try
http://neoarchaic.net/2010/05/sort-points-by-distance/
It follows the same logic as David's component above, and has a second output which provider a map of the initial point's indices so other parallel lists can be sorted with it.

Hey David,

I'm fairly new to grasshopper.  The hardest thing for me to grasp as of now, is the way in which data is stored, sorted, and accessed in grasshopper.  How to use lists, manipulate them, and so on.

Can you elaborate on what a potential use for the 2nd output you mentioned might be?  Just something I can visualize to help me understand what this list could be used for.

Thanks

Ew

One use might be if you were sorting a series of text tags from rhino and wanted to keep the text, layers, or other properties sorted along with the points.

This is similar to the "sort" text component in grasshopper.

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