How can I find the smallest enclosing circle for a rectangle?

I have the four vertices of a rectangle. I need to find it's smallest enclosing circle. For example:

enter image description here

I need to find the radius of the circle.


Solution 1:

There is only one such circle for a rectangle. If your rectangle has sidelengths $a$ and $b$, then the length of the diagonal (by the Pythagorean theorem) is $\sqrt{a^2+b^2}$. Since the diagonal is a diameter, the radius is just $\dfrac{\sqrt{a^2+b^2}}{2}$.

Solution 2:

Take half of the distance between the endpoints of a diagonal of the rectangle.