def draw
background(200)
fill(0)
x1 = 10
y1 = 90
x2 = mouseX
y2 = mouseY
line(x1, y1, x2, y2)
ellipse(x1, y1, 7, 7)
ellipse(x2, y2, 7, 7)
# d is the length of the line
# the distance from point 1 to point 2.
d = dist(x1, y1, x2, y2)
push do
translate((x1 + x2) / 2, (y1 + y2) / 2)
rotate(atan2(y2 - y1, x2 - x1))
text(format("%.1f", d), 0, -5)
end
end