Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Question Regarding Ellipses

  1. Oct 16, 2012 #1
    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. jcsd
  3. Oct 17, 2012 #2

    Ben Niehoff

    User Avatar
    Science Advisor
    Gold Member

    Simple. You solve

    [tex]PF_1 + PF_2 = 2a[/tex]
    subject to the constraint

    [tex]CF_1 = CF_2[/tex]
    where [itex]F_1, F_2[/itex] lie along [itex]\overline{AC}[/itex] on opposite sides of [itex]C[/itex]. 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. [itex]FG > PG > PF[/itex]

    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 [itex]\overline{FG}[/itex]).
  4. Oct 17, 2012 #3
    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 [tex]f=[/tex] so that I can see how it is done?
  5. Oct 17, 2012 #4

    Ben Niehoff

    User Avatar
    Science Advisor
    Gold Member

    Nope, you're responsible for your own algebra.
  6. Oct 17, 2012 #5
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook