0

I'm working on a simple graphics tool that currently draws an ellipse using a bounding rectangle. This is nice and simple, as you just drag the two corners of the rectangle to where you want it.

I have been requested to generate an ellipse using 3-4 points that exist along the ellipse perimeter. This way you can plot 3 or 4 points along the edge of a pre-existing ellipse and have the tool match it.

The constraints are that the ellipse major & minor axes are parallel to the X and Y axes, no rotation. Is this possible?

From what I can understand so far is that from only 3 points, I can only reliably create a circle, but would 4 points be enough to calculate the Major Axis, Minor Axis, and Center of an ellipse?

Update: Clarification
None of the points are expected to reside on either Major or Minor axis, and the center is expected to never be zero.

Update 2: Must have 4 points
Based on the discussion here: How many points are needed to uniquely define an ellipse?, 4 points will define an infinite number of ellipses. So it looks like I would need to have a minimum of 5 points.

flamewave000
  • 101
  • 1
  • I've seen this equation, but my understanding is that it expects one of the points to be on either the Major or Minor axis so you can solve for a or b. None of the points are expected to be on an axis, and the center is expected to never be (0,0). Can this equation be solved for that? – flamewave000 May 03 '21 at 15:37
  • Also, I'm not sure where you see the 4 free terms. I only see 2 sets of XY values and then an AB pair. – flamewave000 May 03 '21 at 15:51
  • 2
    If you have the four points, say, $(x,y)=(2,5),(5,6),(6,2),(3,2),$ then this gives the four equations in four variables solve([(2-x0)^2/a^2+(5-y0)^2/b^2-1,(5-x0)^2/a^2+(6-y0)^2/b^2-1,(6-x0)^2/a^2+(2-y0)^2/b^2-1,(3-x0)^2/a^2+(2-y0)^2/b^2-1],[a,b,x0,y0]); which gives the solution $a^2=\frac{2275}{22}, b^2=\frac{2275}{264}, x_0=\frac92, y_0=\frac{85}{22}.$ – Jan-Magnus Økland May 03 '21 at 16:48
  • This answer gives a determinant that generates the equation of a conic from five points (as part of a discussion of when the fifth point yields an ellipse). To glean geometric properties from the equation, you could look at this answer, which gives various formulas (although not always in the clearest manner). – Blue May 03 '21 at 22:52
  • 2
    If the four points are corners of a rectangle that is parallel to the two axes, there is not a unique solution. – 2'5 9'2 May 03 '21 at 23:02
  • 1
    If all your points lie on a line, you don't get an ellipse no matter how many points you specify. So without any generality assumptions you won't get a number of "needed" points. An axes-aligned ellipse "needs" four general points, where general means no three on a line; no four make a axes-aligned rectangle; no one point in the convex hull of the other three (in this case the solution wants to be a axes-aligned hyperbola). A not necessarily axes-aligned (general) conic needs five general points, where general points means "no three of the points on a line". Hyperbolas and parabolas may occur. – Jan-Magnus Økland May 04 '21 at 10:13

0 Answers0