anchor.diff:    return {'x': cx + dx, 'y': cy + dy};
   }
   
  -sameSign(r1, r2) {
  +bool sameSign(num r1, num r2) {
     return r1 * r2 > 0;
   }
   
   // Add point to the found intersections, but check first that it is unique.
  -addPoint(x, y, intersections) {
  -  if (!intersections.some((elm) { return elm[0] == x && elm[1] == y; })) {
  -    intersections.push([x, y]);
  -  }
  -}
  -
  -intersectLine(x1, y1, x2, y2, x3, y3, x4, y4, intersections) {
  +void addPoint(num x, num y, List intersections) {
  +  if (!intersections.any((elm) { return elm[0] == x && elm[1] == y; })) {
  +    intersections.add([x, y]);
  +  }
  +}
  +
  +void intersectLine(num x1, num y1, num x2, num y2, num x3, num y3, num x4, num y4, List intersections) {
     // Algorithm from J. Avro, (ed.) Graphics Gems, No 2, Morgan Kaufmann, 1994, p7 and p473.
   
  -  var a1, a2, b1, b2, c1, c2;
  -  var r1, r2 , r3, r4;
  -  var denom, offset, num;
  -  var x, y;
  +//  var a1, a2, b1, b2, c1, c2;
  +//  var r1, r2 , r3, r4;
  +//  var denom, offset, num;
  +//  var x, y;
   
     // Compute a1, b1, c1, where line joining points 1 and 2 is F(x,y) = a1 x + b1 y + c1 = 0.
  -  a1 = y2 - y1;
  -  b1 = x1 - x2;
  -  c1 = (x2 * y1) - (x1 * y2);
  +  final a1 = y2 - y1;
  +  final b1 = x1 - x2;
  +  final c1 = (x2 * y1) - (x1 * y2);
   
     // Compute r3 and r4.
  -  r3 = ((a1 * x3) + (b1 * y3) + c1);
  -  r4 = ((a1 * x4) + (b1 * y4) + c1);
  +  final r3 = ((a1 * x3) + (b1 * y3) + c1);
  +  final r4 = ((a1 * x4) + (b1 * y4) + c1);
   
     // Check signs of r3 and r4. If both point 3 and point 4 lie on
     // same side of line 1, the line segments do not intersect.
  
positive.code:   return {'x': x + sx, 'y': y + sy};
  }
  
  intersectEllipse(node, ellipseOrCircle, point) {
    // Formulae from: http://mathworld.wolfram.com/Ellipse-LineIntersection.html
  
    var cx = node.x;
    var cy = node.y;
    var rx, ry;
  
    if (isCircle(ellipseOrCircle)) {
      rx = ry = ellipseOrCircle.r.baseVal.value;
  
negative.code: 
    addLabel(Map node, d3.Selection root, bool addingNode, num marginX, num marginY) {
      // If the node has 'useDef' meta data, we rely on that
      if (node.containsKey('useDef')) {
        root.append('use').attr('xlink:href', '#${node['useDef']}');
        return;
      }
      // Add the rect first so that it appears behind the label
      var label = node['label'];
      d3.Selection rect = root.append('rect');
      if (node.containsKey('width')) {
        rect.attr('width', node['width']);
      }
  