[Math] How to calculate a bounding box of a circle

circlesgeometry

I'm writing a program in C++ to calculate the boundary box of a circle. The user provides me with a coordinate point (10, -5) and a radius of 23.
I'm not very good at geometry and I need help in calculating the bounding box of this circle. How would I calculate this?

Best Answer

By bounding box I'm assuming you mean the box (square) in which the circle is inscribed, like in this picture:

enter image description here

Notice that the radius of the circle is exactly half the length of a side of the square.

So if the center of the circle is $(10,-5)$ and the radius of the circle is $23$, and if we're assuming a standard coordinate system ($y$-values increase in the up direction and $x$-values increase in the right direction), then the corners of the box are located at the following points:

\begin{align*} \text{upper left corner} &= (10-23, -5+23)\\ &= (-13, 18)\\[0.3cm] \text{upper right corner} &= (10+23, -5+23)\\ &= (33, 18)\\[0.3cm] \text{lower right corner} &= (10+23, -5-23)\\ &= (33, -28)\\[0.3cm] \text{lower left corner} &= (10-23, -5-23)\\ &= (-13, -28) \end{align*}