问题
Equation of first ellipse=>
(((x*cos(A)+y*sin(A)-H1)^2)/(a1^2))+(((x*sin(A)-y*cos(A)-K1)^2)/(b1^2))=1
Equation of the second ellipse=>
(((x*cos(B)+y*sin(B)-H2)^2)/(a2^2))+(((x*sin(B)-y*cos(B)-K2)^2)/(b2^2))=1
I know that the ellipse will intersect at
- One Point
- Two Point
- Three Point
- Four Point
- No intersection at all
Is there a general set of equation to solve the same.
回答1:
You can transform these equations to general form of conic section:
A*x^2+2*B*x*y+C*y^2+D*x+E*y+F=0
and solve system of two quadratic equations using any available math packet: Matlab, Maple, Mathematica, Mathcad, free Maxima, Derive, Octave, etc. Solutions (points) are roots of the 4th order equation (from 0 to 4 real roots).
Addition: Maple 6 has solved this system, but solution text is very-very long. It seems that you know semiaxes, rotation angle, and centers of wllipse, so it may be worth to make affine transformation that transform one ellipse to unt circle, apply this transformation to both ellipses, solve simple system, and make back transformations.
Maple solution for this case:
solve({A*x^2+2*B*x*y+C*y^2+D*x+E*y+F=0,x^2+y^2=1},{x,y});
{y = RootOf((4*B^2+C^2+A^2-2*A*C)*_Z^4+(2*E*C+4*D*B-2*E*A)*_Z^3+(D^2-4*B^2+E^2+2*F*C-2*A*F+2*A*C-2*A^2)*_Z^2+(2*E*A-4*D*B+2*F*E)*_Z-D^2+2*A*F+F^2+A^2),
x = -(-RootOf((4*B^2+C^2+A^2-2*A*C)*_Z^4+(2*E*C+4*D*B-2*E*A)*_Z^3+(D^2-4*B^2+E^2+2*F*C-2*A*F+2*A*C-2*A^2)*_Z^2+(2*E*A-4*D*B+2*F*E)*_Z-D^2+2*A*F+F^2+A^2)^2*A+
RootOf((4*B^2+C^2+A^2-2*A*C)*_Z^4+(2*E*C+4*D*B-2*E*A)*_Z^3+(D^2-4*B^2+E^2+2*F*C-2*A*F+2*A*C-2*A^2)*_Z^2+(2*E*A-4*D*B+2*F*E)*_Z-D^2+2*A*F+F^2+A^2)^2*C+
RootOf((4*B^2+C^2+A^2-2*A*C)*_Z^4+(2*E*C+4*D*B-2*E*A)*_Z^3+(D^2-4*B^2+E^2+2*F*C-2*A*F+2*A*C-2*A^2)*_Z^2+(2*E*A-4*D*B+2*F*E)*_Z-D^2+2*A*F+F^2+A^2)*E+A+F)/
(2*RootOf((4*B^2+C^2+A^2-2*A*C)*_Z^4+(2*E*C+4*D*B-2*E*A)*_Z^3+(D^2-4*B^2+E^2+2*F*C-2*A*F+2*A*C-2*A^2)*_Z^2+(2*E*A-4*D*B+2*F*E)*_Z-D^2+2*A*F+F^2+A^2)*B+D)}
回答2:
It can be done by finding the eigenvalues of a 3x3 symmetric matrix, without (explicitly) solving quartics.
There is a paper in Graphics Gems V by Kenneth J. Hill titled Matrix-based Ellipse Geometry. Most of that paper is available on Google books, but there is a summary by the author archived from newsgroups sci.math and comp.graphics.algorithms in 1995. You can find it here--look about 2/3 of the way down the page.
The key idea is that if you put the conics, any 2d conic not just ellipses, in matrix form like this:
[ A B D ] [ x ]
[x y 1] [ B C E ] [ y ] = [ 0 ]
[ D E F ] [ 1 ]
or transpose(X).C.X = 0
, then you can play some games. C
is called the characteristic matrix of the conic.
So if C1
and C2
are characteristic matrices of your ellipses, and xi
is an intersection point, then xi
is an intersection point of any conic with a characteristic matrix C1 + lambda C2
. If lambda is chosen as an eigenvalue, then C1 + lambda C2
is degenerate and can be interpreted as a set of lines. All that is left is intersect the lines extracted from the degenerate characteristic matrices with the original ellipses and throwing out extraneous solutions.
来源:https://stackoverflow.com/questions/17213922/finding-intersection-of-an-ellipse-with-another-ellipse-when-both-are-rotated