As usual, min (dist(P1, P2)), where point P1 lies on the 1st circle, and point P2 lies on the 2nd circle

i.e. the difference of the distance between centers of these circles and the sum of their radiuses.

D=sqrt((c1.x-c2.x)^2+(c1.y-c2.y)^2) - r1 - r2.