2D point projection on an ellipse
Let's assume that the ellipse is centered at the origin. If it's not, then translate the ellipse and the points to make this so.
Given a point $(x_0, y_0)$ that you want to project, you first find the angle $\theta$ between the $x$-axis and the ray leading to the point: in code, use $\theta = \text{atan2}(y_0, x_0)$. Then the projected point $(x,y)$ can be calculated using
$$k = \frac{ab}{\sqrt{ {b^2}\cos^2{\theta} + {a^2}\sin^2{\theta} }}$$
$$x = k \cos\theta$$
$$y = k \sin\theta$$