compute_layout_for_edge = function(s, e) local cs = centroid(Nodes[s]) local ce = centroid(Nodes[e]) local s2 = intersect_with_centroid(Nodes[s], ce.sx,ce.sy) local e2 = intersect_with_centroid(Nodes[e], s2.sx,s2.sy) table.insert(Surface, {type='line', r=0,g=0,b=0, data={s2.sx,s2.sy, e2.sx,e2.sy}, keys={s,e}}) table.insert(Surface, {type='rectangle', r=0,g=0,b=0, x=e2.sx-2, y=e2.sy-2, w=4, h=4, keys={s,e}}) end