3
$\begingroup$

I do not have a background in mathematics and geometry, so I will be so thankful if someone please give me a simple way to get the following, as I tried to understand some posts related to this issues, but I couldn't get a clear idea:

Giving two axis parallel ellipses with the parameters of the center of each ellipse $(x_0, y_0)$ for the first ellipse, $(x_1, y_1)$ for the second, and the major and minor radius for each $(h_0, k_0)$ for the first and $(h_1, k_1)$ for the second. My questions are

  1. How to know if two ellipses are intersecting?
  2. How to calculate the intersection area between the two ellipses?

Thank you in advance.

$\endgroup$
  • $\begingroup$ Show us at least some work first. Perhaps start with the equations for the two ellipses? $\endgroup$ – barrycarter Mar 8 '16 at 17:17
  • $\begingroup$ I am afraid there is no simple way. You will need to find the intersection points between the two ellipses, which involves the resolution of a quartic equation, and combine the areas of elliptic segments. I am not sure you are ready for that. $\endgroup$ – Yves Daoust Mar 9 '16 at 10:14
  • $\begingroup$ If you explain your goal, maybe we can advise a workaround to avoid the frontal assault. $\endgroup$ – Yves Daoust Mar 9 '16 at 10:25
  • $\begingroup$ @YvesDaoust: You can avoid the quartic equation, cubic is enough, but that's still pretty hard, so on the whole I agree with you. $\endgroup$ – MvG Mar 9 '16 at 10:42
  • $\begingroup$ @MvG: as there can be four roots, this is indeed an algebraic problem of the fourth degree. The quartic equations are solved by factorization, which results in a cubic equation. $\endgroup$ – Yves Daoust Mar 9 '16 at 11:02
1
$\begingroup$

You can't hope to find a simple closed formula for this, since there are many different configurations how the two ellipses could intersect.

I'd start by computing the points of intersection. Even if done cleverly, this requires solving a cubic equation, and performing most of the computation using complex numbers. In the end you will have four points of intersection, and can check whether any of them are real.

That will answer your question as to whether the ellipses intersect, if by “ellipse” you mean the curve. If you are referring to the interior, there may still be the situation where one of the ellipses is completely enclosed inside the other. You can detect that case by checking whether both centers are on the same side (i.e. result in the same sign) for one of the quadratic forms.

If you have points of intersection, then you can connect those with lines to cut the intersection between the ellipses apart along those lines. Afterwards you have decomposed the intersection into several pieces, which are either polygons (in fact rectangles in the case of axis-aligned ellipses) or bounded by one line and one ellipse arc. Computing the area of the former is easy. For the latter, you can apply an affine transformation (i.e. a scaling in one of the coordinate directions, in your case of axis-aligned ellipses) to turn this into a circular segment for which the area is easy to compute, and then correct the computed area for the scale factor to get the original area.

To tackle this problem without a background in mathematics or geometry will be very hard, in my opinion. So unless you are really determined to learn all the required tools, I'd suggest you look for alternatives. Perhaps you can work with an approximation? Or perhaps you can let some computer program do the job for you? It depends on where you need this.

$\endgroup$
1
$\begingroup$

Test for intersection:

You can stretch space in one axis so that one of the ellipses is transformed in a circle. Then there is intersection if

  • the center of the circle is inside the ellipse, or
  • the center is outside but the distance between the point and the ellipse outline is smaller than the radius.

Testing insideness is immediate (plug the coordinates of the center in the implicit equation of the ellipse and check the sign).

Computing the distance is another matter. Let the center of the circle be $(x,y)$ and the ellipse be at the origin (WLOG), with semi-axis $a,b$ (sorry for the change of notation, I can't help it). The squared distance between the given point and an arbitrary point on the ellipse outline is

$$d^2=(a\cos(t)-x)^2+(b\sin(t)-y)^2.$$

The extrema of the distance are achieved when the derivative cancels, i.e.

$$-a\sin(t)(a\cos(t)-x)+b\cos(t)(b\sin(t)-y)=0$$ which can be written

$$\frac{ax}{\cos(t)}-\frac{by}{\sin(t)}=a^2-b^2.$$

This equation can be rationalized by the usual transform

$$\cos(t)=\frac{1-z^2}{1+z^2},\sin(t)=\frac{2z}{1+z^2},$$

giving the quartic equation

$$byz^4 + 2(ax + (a^2-b^2))z^3 + 2(ax -(a^2-b^2)^2)z-by= 0.$$

One of the real roots gives the shortest distance.

$\endgroup$
0
$\begingroup$

HINT:

Sketch the ellipses. If you see they intersect at two points, those points are real. If at no points, then they are imaginary or when at two coincident points, they are real and coincident.

If the ellipses are expressed as separate functions of x and y, Lagrange Multiplier can decide about their relative size/proportion for intersection/non-intersection using partial derivatives w.r.t. x and y for comparison.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.