Originally Posted by

**Skadojan** __Given__ the two points (0,0) and (xg,yg) [the things in red].

The lower circle's origin is on the x-axis and it is tangent to the y-axis at 180 deg (it's left-most point).

The upper circle's origin is on y=yg and it is tangent to (xg,yg) at 0 deg (it's right-most point).

The two circles must have a tangent point (xt,yt) such that:

0 < xt < xg and 0 < yt < yg

(that is, the tangent point must be within the rectangle in the picture).

__Solving__ for an equation with which to calculate the radii of the two circles and their tangent point [the things in blue].