Equation of the ellipse between 2 points (its vertices)

analytic geometry

The idea is to start drawing an ellipse where the mouse is clicked (first vertex of the major axis) and ends at the mouse pointer (second vertex of the major axis). This way you could draw ellipses to where you move the mouse and with the desired rotation with respect to the first point. The width of the ellipse can be constant or changed with the mouse wheel. What I need is the equation of the ellipse (in parametric form) given 2 points in the Cartesian plane (these being its vertices, not its foci) and a value that would be the width, the size of the minor axis. I was trying to achieve it in Geogebra but I can't integrate the points to the parametric formula of the ellipse, and what is the best way to find the angle between the points (in case you need to use it).

The data I have:


Start point and end point:
$$A(x,y) \quad B(x,y)$$
Ellipse width:
$$w=2.5$$
Midpoint or center of the ellipse:
$$
M=\left(\frac{A_x + B_x}{2},\frac {A_y + B_y}{2}\right)
$$

The angle (that would be the angle between points A and B):
$$
\theta = ?
$$

Parametric equation of the ellipse with rotation:
$$
x= a * cos(t) * cos(\theta) + b * sin(t) * sin(\theta)
$$

$$
y=b*sin(t)*cos(\theta) – a*cos(t)*sin(\theta)
$$


I appreciate any help and thanks for reading!

Best Answer

If the end points of one axis are $A, B$, and the other semi-axis has length $w$, then the center of the ellipse is

$ C = \dfrac{1}{2} ( A_x + B_x , A_y + B_y ) $

The first semi-axis vector is

$ V_1 = \dfrac{1}{2} ( A_x - B_x, A_y - B_y ) $

And the second semi-axis vector is

$ V_2 = \dfrac{w}{ \| V_1 \| } \dfrac{1}{2} ( B_y - A_y, A_x - B_x ) $

Now the parametric equation of the ellipse is

$ p(t) = C + V_1 \cos t + V_2 \sin t $