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
- How to know if two ellipses are intersecting?
- How to calculate the intersection area between the two ellipses?
Thank you in advance.
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.