Ellipse from foci

Is there any way to draw an ellipse from its foci? in the processing/p5.js library?

By foci, you mean focal points?

1 Like

Pretty sure foci are focal points, yes.

You can almost do it. Trouble is, two points define any number of ellipses. You’d also need to know the sum of the two distances from a point of the ellipse to the focal points as well (which we’ll call L for the rest of this discussion).

The center of the ellipse (Xc, Yc) is easy enough to find. It’s the midpoint between the two focal points.

Keep in mind the equation for an ellipse: Earth to move in it's orbit

Since you know L, you can work out A and B. B is half of L (I think? Someone check me on this.) A can be found by drawing a right triangle with a focal point and the center forming the base, the right angle being at the center. The hypotenuse is L/2, the base is D/2, and the other leg is A.

1 Like