Formula for analytical finding ellipse and circle intersection points if exist

225 Views Asked by At

I need a formula that will give me all points of random ellipse and circle intersection (ok, not fully random, the center of circle is laying on ellipse curve)

I need step by step solution (algorithm how to find it) if this is possible.

2

There are 2 best solutions below

10
On BEST ANSWER

Choose a coordinate system where the $x$ axis is parallel to the ellipse major semiaxis, $y$ axis parallel to the ellipse minor semiaxis, and origin where they intersect ("center of ellipse"). If $a$ is the semi-major axis and $b$ the semi-minor axis, and $$\frac{x^2}{a^2} + \frac{y^2}{b^2} = 1 \tag{1a}\label{BtV1a}$$ Assuming we have a nondegenerate ellipse (an ellipse with nonzero area), then $a, b \gt 0$, and we can write above as $$x^2 + \frac{a^2}{b^2} y^2 - a^2 = 0 \tag{1b}\label{BtV1b}$$

 
A circle of radius $r$ ($r \ge 0$) centered at $x = x_0$, $y = y_0$ fulfills $$(x - x_0)^2 + (y - y_0)^2 = r^2 \tag{2a}\label{BtV2a}$$ which we can also expand into $$x^2 - 2 x_0 x + y^2 - 2 y_0 y + x_0^2 + y_0^2 - r^2 = 0 \tag{2b}\label{BtV2b}$$

 
To find the point $(x, y)$ where the circle and the ellipse intersects, you need to solve the pair of equations, for example $\eqref{BtV1b}$ and $\eqref{BtV2b}$.

The system of equations has essentially form $$\left\lbrace ~ \begin{aligned} x^2 + C_1 y^2 + C_2 & = 0 \\ x^2 + C_3 x + y^2 + C_4 y + C_5 & = 0 \\ \end{aligned} \right . \tag{3}\label{BtV3}$$ where $$C_1 = \frac{a^2}{b^2}, ~ C_2 = -a^2, ~ C_3 = -2 x_0, ~ C_4 = -2 y_0, ~ C_5 = x_0^2 + y_0^2 - r^2$$ One efficient way of solving $\eqref{BtV3}$ is to substract the first equation from the second, and solve for $x$. You'll find exactly one algebraic solution for $x$ (that depends on $y$). Substitute it back into the first equation, and you have a quartic equation in $y$, which has zero, one, two, three, or four solutions. Solve that, then substitute the numeric value or values of $y$ back into the algebraic solution for $x$, and you have the solution, which is either no intersection, one point of intersection, or two points of intersection.

2
On

Referring to the standard equation of the ellipse, $\frac{x^2}{a^2}+\frac{y^2}{b^2}=1$, choose the centre of the circle to correspond to the parameter value $\theta$, so the equation of the circle with this centre and radius $r$ is $$(x-a\cos\theta)^2+(y-b\sin\theta)^2=r^2.$$

Let points of intersection of the circle with the ellipse have parameter values $\phi$, so for a chosen $\theta, a, b$ and $r$ you can find values of $\phi$ by solving $$(a\cos\phi-a\cos\theta)^2+(b\sin\phi-b\sin\theta)^2=r^2.$$