Skip to main content
1 of 4
House
  • 73.5k
  • 17
  • 188
  • 276

After the first triangle is placed, when placing a new vertex, you will always generate two new edges. The third edge for the new triangle will always be a shared edge with a previous triangle. If you could find a way to determine the shared edge, you'd know which vertices to connect to, but that's the hard part. I believe you can do this by drawing a line from your new vertex to the center of each of the last three edges generated.

enter image description here

If the line from your vertex to the center of the edge does not overlap any of the other edges, you have your shared edge. The shared edge will tell you which two vertices to connect your new vertex to.

Could be way off, but it seems to work at least for this case :)

Neat question BTW.

House
  • 73.5k
  • 17
  • 188
  • 276