I’m trying to programmatically make an image of triangles all stuck together. The way I thought I’d approach this problem is by randomly choosing some number of points, then “connecting” them to make triangles. The problem is that I’m not able to come up with a good way of connecting them.
One thing I though about doing was choosing a random point to start with (point 1), then finding the nearest point (point 2) and then “connecting” them. Then, I’d find a nearest third point by choosing the one whose combined distances from point 1 and point 2 is the lowest. This will give me one triangle. I can repeat this until I have a bunch of triangles. The problem here is that the triangles will be separate (they won’t be connected).
Am I stupidly over-thinking this? Is there a simpler way of doing this?
What you are looking for is Delaunay triangulation!
What it basically does, is to group three points in a triangle, if the circle that passes through them doesn’t contain any other point, and it does it efficiently. There would be special cases with points on one line, or more than 3 points on the same circle.