# get Bisector for each point in a line

From a mesh which contains only vertices and edges, I need to find the bisector vector (or angle) between the two edges that collide in each vertex.

How can this be done using animation nodes?

EDIT

Following @Omar Ahmad answer I arrive to this point where I'm no getting the desired results.

Since your mesh only contains vertices and edges, we will have to find the angle or bisector between every possible combination of edges that share the same vertex. So, the first thing to do is to find the neighbours of each vertex. The fastest way to do that is to use the following expressions:

Then we are going to loop over the vertices and their neighbours and construct vectors going from the vertex to its neighbours:

Then, we loop over every combination of vectors computing the bisector vector, where the bisector vector $$\vec{c}$$ between the two vectors $$\vec{a}$$ and $$\vec{b}$$ using the following formula:

$$\vec{c} = \vert\vert\vec{b}\vert\vert\vec{a} + \vert\vert\vec{a}\vert\vert\vec{b}$$

Every combination of vectors can be computed using the expression:

list(zip(*combinations(vectors, 2)))


Where combinations is a function in the itertools module, so make sure to import it in the advanced node settings. So we can implement it as follows:

Constructing transformations based on those bisectors gives:

• I'm on it! but I want to share how I tried it myself and see why I couldn't do it. My approach was to create a vector spline from my mesh and use the handles from each point to create the necessary vectors to find the bisector, is that even possible? – Juan Manuel Lynch Jan 23 '19 at 10:52
• I'm getting strange results, when I instantiate a random object on each vertex of the mesh and apply the resulting bisectors as rotations to the objects. Can you verify if you are getting the same behaviour? – Juan Manuel Lynch Jan 23 '19 at 12:32
• @JuanManuelLynch hmmm, I don't think this approach will work. I am not getting those strange results, can you elaborate on what exactly are you getting? – Omar Emara Jan 23 '19 at 12:56
• check edit in answer – Juan Manuel Lynch Jan 23 '19 at 14:00
• @JuanManuelLynch I see. Sorry, my bad, will fix the answer in a moment. – Omar Emara Jan 23 '19 at 15:05

@Omar Ahmad solution works fine but is quite complex as it requires more nodes and uses python expressions. Even so his first approach was actually correct, it only missed normalizing the vectors before adding them in order to find the bisector. My approach feeds from his solution but simplifies the process by creating an spline from the mesh vertices. The spline offers handlers which are used to quickly get the two vectors from each vertex that will be used to calculate the bisector.