How do I generate edges using multiple points?

I want to connect these 8 points to form edges automatically.

image

i want this:
image

What kind of approach would I go for it to correctly connect all the points? for example how do I avoid it generating extra lines at diagonals?

I want how it would work, not pure code. I want to learn how I could do it myself, any nudge in the right direction helps, thanks!

1 Like

You would want to check on each point where the closest point is on each axis. Then if the connecter part hasn’t been created create a part that’s position is the middle of the two points and the length is the distance between the two points. It should be some very simple code to achieve what you want although more complex shapes will require much more complex code.

2 Likes