# Network animation with faces / simplicial complex using animation nodes

I am looking for a way to quickly and automatically construct an animation of a type of network (called a simplicial complex) wherein sections of the network structure have material on the faces in between the vertices. I can construct the animation of a network using the 'animation nodes' package, here: https://animation-nodes.com/

This package allows the vertices to 'connect' or draw and edge between them whenever a certain criteria is met, such as the distance between them is below a threshold.

However, I have not figured out how to include a face on the triangle between nodes if the vertices are all connected to each other.

Here is an example of a snapshot in the animation of a simplicial complex (I would like for the vertices to move and faces to respond by appearing/disappearing with the edges in the animation): This gif describes the type of motion: Does anyone know how to achieve this?

This answer is based on Omar Emara's Answer , so be sure to read it before you move on as I won't explain everything that have been answered there. This is the loop to generate polygon However, this loop doesn't take the distances between vertex points into account so I modify the loop to use the Distances output from Find Nearest Points node. As per documentation

Distances - The distances between the output points and the input point.

Input point is the inputs Vector, this outputs give you a list of floating point (the distances) with length same as Amount input where the first element is always zero as it is the distance to itself. With that we can compare each value with distance threshold.

not any(set(p) == polygon for p in polygons) and all(d < radius for d in distances)


radius is the distance threshold. all(d < radius for d in distances) will make sure that every value is inside the radius or below the threshold. You can see where each node connecting to what node. Put that code on Expression node. By adding this new condition input in generator, we only add polygon indices that met certain distance threshold. You can ignore the Distances List output of the loop for now. Here is the comparison side-by-side on Material Preview mode. In this example I'm using Circle Mesh and scatter them using Vector Wiggle, however you can use particle system as well. The node setup is pretty much same as Omar's, use Combine Mesh to generate the polygons. To generate edges we can use Find Close Points node (Mesh > Operators > Find Close Points), use mode Amount or Distance whichever that suit your need.

Here's the final result rendered using Viewport Render. https://i.stack.imgur.com/ZaAT3.jpg . I use three Find Close Points nodes setup with different parameter and different material.