I'm trying to find an algorithm that computes the coordinates of the center and the radius of the smallest circle that covers two smaller circles. I know the radius and x, y coordinates of the center of the 2 smaller circles. 

I tried this algorithm below, it works even when the two circles overlap or far apart, but that's only if circle1 and circle2 are on the same x or y axis.

Let c1, c2 be circle1 and circle 2;
r be radius:

```
    if c1x >= c2x:
        if c1y >= c2y:
            c = ((c1x + c1r) + (c2x - c2r))/2, ((c1y + c1r) + (c2y - c2r))/2
            r = max(((c1x + c1r) - (c2x - c2r))/2, 
                     ((c1y + c1r) - (c2y - c2r))/2)
        elif c1y < c2y:
            c = ((c1x + c1r) + (c2x - c2r))/2, ((c2y + c2r) + (c1y - c1r))/2
            r = max(((c1x + c1r) - (c2x - c2r))/2, 
                     ((c2y + c2r) - (c1y - c1r))/2)
    elif if c1x < c2x:
        if c1y >= c2y:
            c = ((c2x + c2r) + (c1x - c1r))/2, ((c1y + c1r) + (c2y - c2r))/2
            r = max(((c2x + c2r) - (c1x - c1r))/2, 
                     ((c1y + c1r) - (c2y - c2r))/2)
        elif c1y < c2y:
            c = ((c2x + c2r) + (c1x - c1r))/2, ((c2y + c2r) + (c1y - c1r))/2
            r = max(((c2x + c2r) - (c1x - c1r))/2, 
                     ((c2y + c2r) - (c1y - c1r))/2)

```