code: function(from, to, dim, swap, canvas){
      var ctx = canvas.getCtx();
      // invert edge direction
      if (swap) {
        var tmp = from;
        from = to;
        to = tmp;
      }
      var vect = new Complex(to.x - from.x, to.y - from.y);
      vect.$scale(dim / vect.norm());
      var intermediatePoint = new Complex(to.x - vect.x, to.y - vect.y),
          normal = new Complex(-vect.y / 2, vect.x / 2),
          v1 = intermediatePoint.add(normal), 
          v2 = intermediatePoint.$add(normal.$scale(-1));
      
      ctx.beginPath();
      ctx.moveTo(from.x, from.y);
      ctx.lineTo(to.x, to.y);
      ctx.stroke();
      ctx.beginPath();
      ctx.moveTo(v1.x, v1.y);
      ctx.lineTo(v2.x, v2.y);
      ctx.lineTo(to.x, to.y);
      ctx.closePath();
      ctx.fill();
    }
docs: /*
  Method: arrow
  
  Renders an arrow into the canvas.
  
  Parameters:
  
  from - (object) An *x*, *y* object with the starting position of the arrow.
  to - (object) An *x*, *y* object with the ending position of the arrow.
  dim - (number) The dimension of the arrow.
  swap - (boolean) Whether to set the arrow pointing to the starting position or the ending position.
  canvas - (object) A <Canvas> instance.
  
  Example:
  (start code js)
  EdgeHelper.arrow({ x: 10, y: 30 }, { x: 10, y: 50 }, 13, false, viz.canvas);
  (end code)