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.
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