1: Define the six variables used to track the two circles.

5-10: Give them initial values.

17-20: Move the first circle to the mouse's position if a mouse button is pressed.

21-24: Move the second circle to the mouse's position if a keyboard key is pressed.

25-26: Draw the first circle.

27-28: Draw the second circle.

29-30: Define two similar vectors that point from the center of the first circle to the center of the second circle.

31: Limit the length of the first of these vectors to the radius of the first circle, so that, if placed at the center of the first circle, it ends at a point on the first circle that is between the two centers of the circles.

31: Limit the length of the second vector to it's own length, minus the radius of the second circle, so that, if placed at the center of the first circle, it ends at a point on the second circle that is between the two centers of the circles.

33-34: placing both vectors at the center of the first circle, draw a line between their two end points.

Now we just need to draw the two lines for the arrow head.

36: Recenter the coordinate system around the point on the second circle.

The vector p points from the first circle to the second, so -p points from the second to the first.

38: Limit p to a fixed length of 20 pixels.

39: Rotate the coordinate system a bits so that p now only sort of points from one circle to the other.

40: Use p to draw one of the arrow head lines.

41: Rotate the coordinate system a bits in the other direction so that p now only sort of points from one circle to the other, but in the other direction.

42: Use p to draw the other one of the arrow head lines.