title: Algorithm to connect all points in a shape
body: <p>I'm trying to figure out how to connect all points in a shape, with the amount of points being dynamic.</p>
  
  <p>I'll use a square to demonstrate, there's four points:</p>
  
  <p>a - top left,
  b - top right,
  c - bottom right,
  d - bottom left</p>
  
  <p>So...</p>
  
  <pre><code>var connections = [
      new Connection(a, b),
      new Connection(a, c),
      new Connection(a, d),
      new Connection(b, c),
      new Connection(b, d),
      new Connection(c, d)
  ];
  </code></pre>
  
  <p>Connects all points in a square (or any four sided polygon), but I want to do this automatically by looping through an array of points (displayed as abcd here for simplicity's sake) so it will work for any polygon. I tried to work out a pattern and implement it in a couple of for-loops but that failed. I expect it's really simple...</p>
  
  <p>Any help is appreciated, thanks.</p>