title: How can I order a list of Points so that no lines drawn intersect?
body: <p>I am getting a List of Points from the user clicking on the screen.</p>
  
  <p>And I want to draw a polygon based on this points. The problem is that the user might not be clicking in the right order (<em>no intersecting segments</em>) to form a correct polygon, therefor I'm looking for a code snippet which would sort that List and arrange the points in the right order to form a good polygon...</p>
  
  <p>Thanks!</p>
  
  <p>picture = BAD POLY!</p>
  
  <p><img src="https://i.stack.imgur.com/drqjI.jpg" alt="enter image description here"></p>
  
  <p>-</p>
  
  <p>picture = GOOD POLY!</p>
  
  <p><img src="https://i.stack.imgur.com/XrNRu.jpg" alt="enter image description here"></p>