# Mesh Node

Attached is the demo for another new node: mesh.

Mesh creates a list of line segments connecting a set of neighboring points. It takes four parameters:

**Points or shapes**. A list of points and/or shapes. Any shapes are replaced by their centroids.**Radius**. Limits the area around each point when searching for neighbors. The tighter the radius, the faster this node runs.**Neighbors**. N, the maximum number of neighbors to connect to each point.**Mutual**. If checked, only mutual neighbors will be connected.

For each point or centroid in the input list, mesh connects that point with the closest N other points found within the specified radius. If a line connects point A with point B it means at least one is a neighbor to the other. If "Mutual" is not checked, it means that B is one of the N closest points to A **OR** A is one of the N closest points to B. If "Mutual" IS checked then a line means that BOTH are true: A is a neighbor of B AND B is a neighbor of A.

Finding neighbors is computationally expensive because you have to measure the distance between each point and every other point, so the number of comparisons grows exponentially with the number of points. Mesh can usually handle a few hundred points, but may bog down if given a thousand points. To avoid freezes, start with a small radius and gradually increase it. Just be aware that if you make the radius too small, some valid neighbors may not be close enough to be found.

You can use the mesh node to quickly create a wide variety of networks, fishnets, cobwebs, etc. Frankly, I'm not sure how useful this node will be, but I suspect that, with some experimentation, we might be able to create some truly surprising effects.

Please try playing with this thing and report back if you come up with anything interesting!

John

- mesh_screenshot.png 494 KB
- mesh_demo.ndbx.zip 3.05 KB

# Keyboard shortcuts

### Generic

? | Show this help |
---|---|

ESC | Blurs the current field |

### Comment Form

r | Focus the comment reply box |
---|---|

^ + ↩ | Submit the comment |

You can use `Command ⌘`

instead of `Control ^`

on Mac

1 Posted by

aderogon 25 Aug, 2023 08:52 PMtried to flex your haiku a bit ↓ attached.

... yet another depresh sesh averted, thanks to you, John! the sheer amount of work you're doing here means a LOT to me, dearly.

looking forward for your next node.

maximum respect,

a.

Support Staff 2 Posted by

johnon 30 Aug, 2023 03:16 AMAderog,

My apologies. Your post somehow ended up in the forum spam folder and I only just now noticed it. This keeps happening - which makes me sad.

Thanks much for your kind words and for actually playing with my mesh node. Your idea of having some points float around like motes of dust and simply mesh them together in each frame is simple but brilliant. I might try some variations on this idea myself!

I look forward to hearing from you again. I just posted another node - quadtree - which you may find worthy of playing with. Happy to help you avert depress seshes whenever I can.

John

P.S. If you get a chance, please reply to this note so I know you saw it and are free from the spam monster.