2D bounding box of a sector?
- Generate the following points:
- The circle's center
- The positions of the start and end angles of the sector
- Additionally, for the angles among 0, 90, 180, and 270 that are within the angle range of the sector, their respective points on the sector
- Calculate the min and max x and y from the above points. This is your bounding box
I'm going to rephrase yairchu's answer so that it is clearer (to me, anyway).
Ignore the center coordinates for now and draw the circle at the origin. Convince yourself of the following:
- Anywhere the arc intersects an axis will be a max or a min.
- If the arc doesn't intersect an axis, then the center will be one corner of the bounding rectangle, and this is the only case when it will be.
- The only other possible extreme points of the sector to consider are the endpoints of the radii.
You now have at most 4+1+2 points to find. Find the max and min of those coordinates to draw the rectangle.
The rectangle is easily translated to the original circle by adding the coordinates of the center of the original circle to the rectangle's coordinates.