Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bounding ellipse constrained to horizontal/vertical axes

Context: I'm trying to clip a topographic map into the minimum-size ellipse around a number of wind turbines, to minimize the size of the map. The program doing this map clipping can clip in ellipses, but only ellipses with axes aligned along the x and y axes.

I know the algorithm for the bounding ellipse problem (finding the smallest-area ellipse that encloses a set of points).

But how do I constrain this algorithm (or make a different algorithm) such that the resulting ellipse is required to have its major axis oriented either horizontally or vertically, whichever gives the smallest ellipse -- and never at an angle?

enter image description here

Of course, this constraint makes the resulting ellipse larger than it "needs" to be to enclose all the points, but that's the constraint nonetheless.

like image 785
Jean-François Corbett Avatar asked Sep 22 '11 09:09

Jean-François Corbett


1 Answers

The algorithm described here (referenced in the link you provided) is about solving the following optimization problem:

minimize log(det(A))
s.t. (P_i - c)'*A*(P_i - c)<= 1

One can extend this system of inequalities with the following constraint (V is the ellipse rotation matrix, for detailed info refer the link above):

V == [[1, 0], [0, 1]] // horizontal ellipse

or

V == [[0, -1], [1, 0]] // vertical ellipse

Solving the optimization problem with either of these constraints and calculating the square of the resulting ellipses will give you the required result.

like image 93
Andrei Avatar answered Sep 30 '22 00:09

Andrei