Grasshopper

algorithmic modeling for Rhino

# Smallest Angle Between closest neighbors?

Hi All,

I'm a bit stuck on this definition. Basically I'd like to find the smallest of the two angles between each strut(line) and it's two adjacent neighbors as they exist coming from each common node or base point. Having this angle would then ideally drive a distance parameter for each line - i.e. if a strut coming from index node (3) had neighboring struts at 20 degrees and 75 degrees to it's vector, then the 20 degree measurement would be associated with/drive a parameter for that specific strut (line). This would need to happen for each line as they come from each node. I used the Sandbox line topology component to get started, but I'm stuck on isolating for each specific strut and it's neighbors.

Views: 2350

Attachments:

### Replies to This Discussion

Hello Matt

this creates a a data tree with branches that contain all neighboring lines. i believe that is what you are after. problem is i cant think how to measure angles for each group lines.

if you figure it out please post it here.

cheers

alex

*edit these groups are based on the nodes.

Thanks Alex, this definitely helps get the individual lines from Sandbox. I'll try to distill this further.....until then, anyone else?

needs further examination.

brb

that last image you posted gets close! I recreated it (several components I haven't used before!) but it seems some of the angles are on the large side (most should be smaller than 90) I think this is happening because not all the lines 'start' at the node/vertice - they might be starting at the neighboring point and ending at the node.

here it is. confirmed.

gives neighbor angles. the tree structure 0;0;0, 0;0;1,0;0;2, 0;0;3, 1;0;0, etc matches the structure of the L from the Line filter component ( {0} for the list of 4 lines, {1} for the list of 8 lines etc .

cheers

alex

Alex (or anyone else for that matter)

I'm afraid this last solution is giving some mixed results. I'm not sure how to tweak it to get the desired results. I think that:

(A) that the lines coming from the nodes are not necessarily oriented in consistent directions - i.e. some point towards the common node while others point away.

and

(B) the index order of some of the lines coming from some of the nodes isn't necessarily ideal. For node (0) each line  0;0;0, 0;0;1,0;0;2, 0;0;3 is in order relative to it's neighbor, BUT if you go to node (1) the order of lines skips around. I've put in some reference angles within Rhino at some of the simpler intersections to check against the resulting GH angles and I think the previous reasons are causing the errors........

These two factors seem to be making it difficult, if not impossible to get the correct angle between each line and its neighbor. Is there another approach?

Attachments:

i believe now its sorted

the curves have been sorted radially and for each list of lines the start point is the same

cheers

alex

Attachments:

WOW! I think think this should do the trick Alex! Thank you again!

You are welcome!

cheers

alex

ps if this is for a project i would love to see it when finished.

Yes, nice work guys!

Matt, what direction are you thinking of taking this?

yes in that case i think  the reflex angle is needed.

Thanks for the help Alex - greatly appreciated! I'll give this a try later tonight or tomorrow (working on something else right now!) Hopefully I can get this to drive the right parameters in a productive way!!

by June Lee

• View All