Grasshopper

algorithmic modeling for Rhino

I'm trying to close a myriad of small gaps in a file with height-curves. I'm using Danny's method as shown, which would work fine if the height-curves were complete, but I'm working with a small section. 

question: How do I filter which lines are joined, so that only gaps under a certain size (and on the same y-coordinate) are closed?

tanks!

Views: 1117

Replies to This Discussion

Hi,

That's never gonna work with your file. I have a file somewhere that works within some tolerances. I will try top fetch it.

The logic is the following.

-1. Make sure you have no duplicates

0. Omit the closed curves

1.explode all the curves into single segments

2. find the ones with only one neighbour

2.pick one of them, find its closest neighbour and join

3. if there is no neighbour find the one with the closest proximity (define a threshold to look around -usually the text font size that creates the breaks) 

4. check the angle between your current segment's direction vector and its end point projection on to the closest segment from step 3. if this more than a threshold (I usually use pi/4) then this is an open polyline, if it is smaller that create a segment in between the two.

5.continue until the curve is closed of open or no more segments can be found

6. remove the used segments from the list

6.repeat for all the end segments.

You need an iterative method. My old code is in C#, but you can do in in GH with Anemone and possibly a graph theory add-on like spiderweb or ivy to find the valence one segments.

warning!!!! this is not a bullet proof solution but will solve most the cases

Hope this helps

M. 

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service