About the coordinates of an axis-aligned bounding box of an ellipse.

817 Views Asked by At

I have an ellipse whose center is $(c_{x},c_{y})$ and whose orientation with respect to the positive x-axis is $\theta$. Its semi-major and semi-minor axes are $a$ and $b$.

My problem is that, how do I find the coordinates of the four corners of the best bounding box to the ellipse, which is something like this.

enter image description here

2

There are 2 best solutions below

0
On BEST ANSWER

It is rather easy if $c_x=c_y=\theta=0$.(The coordinates are $\frac{(\pm a,\pm b)}{2}$) Now, from that result, maybe you could try to rotate by $\theta$ then translate by $(c_x,c_y)$ the ellipse and its bounding box in order to fit every situation?

0
On

Here's my approach:

Start with ignoring the center coordinates and assume that the coordinate system you are working in is placed in the center. The original coordinates from the bounding box were (a/2,b/2 ; a/2,-b/2 ; -a/2,-b/2 ; -a/2,b/2)

The modulus of every coordinate point = sqrt((a/2)²+(b/2)²) = mod

You can now calculate the rotated coordinates. for (a/2,b/2) this gives the new coordinates (d,e) d = mod x cos(θ) and e = mod x sin(θ)

Once you have applied the rotation on all the 4 coordinates, you still have to translate the coordinates with (cx,cy) by just adding the values to every coordinate pair -> (d+cx, e+cy).

Follow the same thoughts for the other coordinates