Grasshopper

algorithmic modeling for Rhino

Hi,

I'm new to VB in GH. 

I got lots of perpendicular lines, some of them can be connected to closed polygons. I want to retrieve those lines and get the polygons.

What i've already done is sorting the lines into x-vector and y-vector, and testing the relations between each 2 lines, and i've taken the index Ix-Iy (2 lists of index)of those who can make a corner. I'm thinking about starting with one of the lines, using the index-x to find another possible index-y, then index-x, then index-y,...until(after at least 4 index) a index-x equals to the first one. But i don't know how should i write the loop, seems to me every time you need to find the next match and it can be endless.

I don't know if i've made myself clear...

Views: 579

Replies to This Discussion

Jennifer, 

This problem can be solved using graph theory. You are looking for cycles in an undirected graph. 

http://www.geeksforgeeks.org/detect-cycle-undirected-graph/

http://en.wikipedia.org/wiki/Cycle_detection_(graph_theory)#Cycle_d...

Start with a list of all the intersections, and consider them as graph nodes.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service