The Four Turtles Puzzle

Time to explain what this is!

Imagine four turtles on the corners of a square. Each turtle now heads towards its nearest neighbour (clockwise) - what paths will they end up following until they meet in the centre?

You'll need one more function before you can work on this puzzle:

// set t1's heading towards t2
function towards(t1,t2) {
  var x1=t1.x; var y1=t1.y;
  var x2=t2.x; var y2=t2.y;
  var dx=x2-x1; var dy=y1-y2;
  if (dy==0) {
    var h=90*Math.sign(dx);
  } else {
    var rad=Math.atan(dx/dy);
    var h=rad*180/Math.PI;
    if (dy<0) h=180+h;
    if (dx<0 && dy>0) h=360+h;
  }
  t1.h=h;
}

My solution is on the next page but you have enough tools to solve it yourself!