1

Is there a not-too-long way to calculate points of intersection for rectangle and ellipse? I need this for my college project - vector editor with few primitives. I'm using Java, but, as I looked through oracle docs, this problem seems to be possible to solve only through geometrical approach.

Thanks in advance.

4

1 回答 1

2

No complete solution, but some hints:

  • A recangle consist of four line segments. If you have to points x1 and x2 of a line seqment, the vector equation is r=x1+t(x2-x1) while t is in (0,1).

  • The equation of an ellipse with focus points f1 and f2 is |r-f1| + |r-f2| = 2a where a is the radius.

  • Intersections of two figures are points r that fulfill the equations of both figures.

于 2012-05-21T18:37:07.830 回答