# Question Regarding Ellipses

1. Oct 16, 2012

### Physt

I'm trying to write an algorithm that will create the smallest possible ellipse to encompass any number of points on 2D euclidean space. I've gotten it to the point where I can attain the major axis A by taking the furthest two points in the set and likewise the centerpoint C as the average of those two furthest points. I now want to loop through the remaining points in the set to find the highest minor axis B value, once the two furthest points are found the remaining points are normalized to them (moved/rotated) such that the center point of the ellipse is the new (0,0) and it is going to be an ellipse with horizontal foci, my question is:

Given the centerpoint of a normalized ellipse, it's major diameter A and any point P laying on the circumference of that ellipse, how do I find the focus F, or the minor diameter B?

If this helps explain it, I have C, a and P of this diagram, I want to find b or f:

Last edited: Oct 16, 2012
2. Oct 17, 2012

### Ben Niehoff

Simple. You solve

$$PF_1 + PF_2 = 2a$$
subject to the constraint

$$CF_1 = CF_2$$
where $F_1, F_2$ lie along $\overline{AC}$ on opposite sides of $C$. You have two algebraic equations for two unknowns: the locations of the two foci.

By the way, your algorithm is not going to find the smallest ellipse, if by "smallest" you mean "smallest area" or "smallest perimeter" (and take care, these two definitions of "smallest" are not compatible!). Your algorithm assumes that the two most distant points will coincide to the two endpoints of the ellipse along the major axis. Given the two endpoints F and G, the third point P can be chosen such that all of these hold:

1. $FG > PG > PF$

2. The ellipse having FG as one of its axes, and passing through P, can be made arbitrarily large (either in perimeter or area) by appropriate placement of P (very near F).

3. FG actually turns out to be the minor axis, rather than major!

In fact, in the case that 3 holds, the equations I gave at the top will have no real solutions (because the equations assume the foci are on the line $\overline{FG}$).

3. Oct 17, 2012

### Physt

I did find this online, but it will take a bit of study on my part to figure out how to code it into an algorithm, I'd like to know how to solve this equation first as it seems a lot simpler:
subject to the constraint
Is there any way you could break the equation down for me ending in $$f=$$ so that I can see how it is done?

4. Oct 17, 2012

### Ben Niehoff

Nope, you're responsible for your own algebra.

5. Oct 17, 2012