2

I would like to find the points of intersection between an ellipse and a line

If using the example (ignoring a few un-needed arguments) from the dataEllipse function from the car package i.e.

x <- dataEllipse(Prestige$income, Prestige$education, levels=0.95, lty=2)

and say you have the horizontal line

abline(14,0)

how do you find the two points of intersection between the line and the ellipse

I know you can get the data that makes the ellipse from just looking at x, however I would like to get the exact points of intersection.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
h.l.m
  • 13,015
  • 22
  • 82
  • 169

2 Answers2

1

The equation of an ellipse is given by:

x^2/a+y^2/b=1, and the equation of a line by cx+d=y (where a,b,c,d coefficients).

You can substitute y in the ellipse equation. Then the goal is to find the solution of f(x)=0. You can use some method like bisection to solve such a problem.

Check this out:

http://www.math.wichita.edu/~cma/stat774/ch2.pdf

kostas
  • 1,959
  • 1
  • 24
  • 43
  • I am aware of the equation of an ellipse, however I do not have the coefficients for this particular ellipse that has been generated from the data, unless I am missing something... – h.l.m May 24 '12 at 06:35
  • I do however have x and y coordinates of the ellipse, can I get the coefficients from that data? – h.l.m May 24 '12 at 06:36
0

I bet there's a curve-fitting method that can get the foci and axis lengths of your ellipse from the set of x-y coords, but it looks tough: http://www.site.uottawa.ca/~mstoj075/Publications_files/EllipseFit.pdf . You might get a "good enough" answer by using splinefun on your set of x-y coordinate data and following the answers in The intersection point between a spline and a line

Community
  • 1
  • 1
Carl Witthoft
  • 20,573
  • 9
  • 43
  • 73