Find nearest line by angle in line group

Hello Guys

please help with the following

there are lines, let’s say 10 pieces, which converge to one point.
the angles between them are completely different, arbitrary/random.
it is necessary for each line to find a pair in the form of the nearest line according to the minimum angle?

I tried to solve this problem through the sphere at the point of convergence of the lines. But I think this is not entirely correct. The definition is given below.

nearest line.3dm (37.2 KB)
nearest (13.8 KB)

Is this what you’re looking for?

nearest (19.3 KB)

1 Like

HS_Kim thank you very much for the answer
I needed to clarify that the lines on the layers could be reduced to one list

is your script applicable with such a delivery?

Why did you distinguish the two sets of lines and referenced each line group (red and white) individually into GH?

If you don’t have to compare between the two groups, then you can measure every other angle except oneself by usingMerge.

1 Like

they are actually in the same group, I combine them with a merge team.

I understand that in this setting your script will also work, thank you very much :+1:

I can ask another question :innocent: if I want to do a search in groups of lines that lie in groups on different layers.
and c within each group find pairs of nearest lines?
each group of lines on its own branch of the data tree, as shown below.
if you check the pairs of the nearest ones using the loft, then he found pairs from different groups of lines.

nearest (22.6 KB)
nearest line1.3dm (43.1 KB)