2D bounding box of a sector?
algorithm, geometry
Solution
- 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
Problem
I've googled till I'm blue in the face, and unless I'm missing something really obvious, I can't find any algorithms for calculating the bounding box of a 2D sector. Given the centre point of the enclosing circle, the radius, and the angles of the extent of the sector, what's the best algorithm to calculate the axis-aligned bounding rectangle of that sector?