title: Programmatically link all points
body: <p>REWRITE: I wasn't getting much feedback on this question, I assume I did not write it properly and am attempting to clarify.</p>
  
  <p>I am making a program that lets people created countries. The thick red lines in the picture below are the borders to said countries. I am trying to figure out how to generate a polygon that will fill the entire area inside of the "border" lines. I have the triangulation code that accepts the polygons working - I tested that out with a polygon I entered manually - now I'm trying to figure out how to generate the polygon from the lines/linked point.</p>
  
  <p><img src="https://i.stack.imgur.com/z4KaC.png" alt="enter image description here"></p>
  
  <p><img src="https://i.stack.imgur.com/9YYeu.png" alt="enter image description here"></p>
  
  <p>For more info - all the red lines are how the yellow dots are linked together. The users drag the yellow dots together to link the lines. It is possible for the polygon to have a hole inside and be open - what I am trying to do is make code that handles open polygons and polygons with holes inside it and generates an output of all the yellow dot's locations (vector3's with x and z as it lies at 0 on the y plane) for my triangulation code.</p>
  
  <p>I'm still looking up way to figure this out but I haven't come up with even where to start looking for solutions. Thanks for all the help.</p>
  
  <p>OLD QUESTION BELOW</p>
  
  <p>I'm trying to find a way to link points together to form an internal polygon. Basically, I'm creating a program that lets people link lines together. After a closed polygon is made, it is supposed to generate a new polygon object inside the lines.</p>
  
  <p>I'm not too sure how to do this - I have made it so they can generate the lines and link them together, but how to do a closed polygon escapes me. I looked at convex hulls but this isn't the same, and tried looking or thinking up a few different things that don't seem to work. I'm curious if anyone can point me in the write direction/a tutorial or idea on how to continue on my creation. </p>
  
  <p>I have two pictures uploaded to help show my point.</p>
  
  <p><img src="https://i.stack.imgur.com/z4KaC.png" alt="enter image description here"></p>
  
  <p><img src="https://i.stack.imgur.com/9YYeu.png" alt="enter image description here"></p>
  
  <p>Above is what I am trying to do but not too sure how - basically, when the user finished a closed polygon (all the yellow dots are the polygon's external points), I want it to generate an internal polygon (marked by the black 1, 2 and 3).</p>