1
$\begingroup$

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. enter image description here

$\endgroup$
3
$\begingroup$

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:

Neighbours

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

Get Vectors

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:

Node Tree

Constructing transformations based on those bisectors gives:

Result

$\endgroup$
  • $\begingroup$ 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? $\endgroup$ – Juan Manuel Lynch Jan 23 '19 at 10:52
  • $\begingroup$ 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? $\endgroup$ – Juan Manuel Lynch Jan 23 '19 at 12:32
  • $\begingroup$ @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? $\endgroup$ – Omar Emara Jan 23 '19 at 12:56
  • $\begingroup$ check edit in answer $\endgroup$ – Juan Manuel Lynch Jan 23 '19 at 14:00
  • $\begingroup$ @JuanManuelLynch I see. Sorry, my bad, will fix the answer in a moment. $\endgroup$ – Omar Emara Jan 23 '19 at 15:05
0
$\begingroup$

@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.

graph result

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.