# Find degrees of circle line from its bounding box

I have a circle line, where I know two things:

1. The diameter of the full circle
2. The height and width of the bounding box around the circle line

Using that, I want to find the angle of the circle line. (At least up to 270 degrees. After that, both the bounding box width and height will, of course, be equal to the diameter.)

Up to 180° (Figure A) we can use the bounding box height to calculate the angle (0 to diameter).

From 180-270° (Figure B) we can use the width (the range from radius to diameter) to figure out how much of those 90°s are spent.

But since I don't know how circles and curves work, I'm stuck, sad and kind of scared.

Is anyone out there able to explain how, as if I'm five years old? (Because when it comes to maths, I practically am.)

• What is your definition of a "bounding box" ? Is it in relationship with pre-established coordinate axes, the borders of the bounding box being parallel to these axes, or is it the rectangle with the smallest area in which the arc can be inscribed ? – Jean Marie Oct 24 '17 at 17:04
• @JeanMarie The latter. (The rectangle with the smallest area in which the arc can be inscribed) – solarcore Oct 24 '17 at 17:18

For every length of $AB$ you can use the cosine of the angle $Ø$. The dotted line in your picture has length $r$, and is the hypotenuse of a right triangle with one leg having length $W-r$. Thus the angle opposite this leg is $\sin^{-1} \frac{W-r}{r}$. Adding this angle to $180^\circ$ will give you what you want.