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
-- arrow head
local angle = angle(e2.sx, e2.sy, s2.sx, s2.sy)
-- e2.sx + D*cos(angle) == s2.sx
-- D = (s2.sx - e2.sx)/cos(angle)
-- draw the arrow head with the same sign as D
local arrow_dir = sign((s2.sx-e2.sx)/(math.cos(angle)))
local arrow_len = 10*arrow_dir
local d = math.pi/10
table.insert(Surface, {type='line', r=0,g=0,b=0, keys={s,e}, data={
e2.sx, e2.sy,
e2.sx+arrow_len*math.cos(angle+d),
e2.sy+arrow_len*math.sin(angle+d),
}})
table.insert(Surface, {type='line', r=0,g=0,b=0, keys={s,e}, data={
e2.sx, e2.sy,
e2.sx+arrow_len*math.cos(angle-d),
e2.sy+arrow_len*math.sin(angle-d),
}})
end