Results 1 to 6 of 6

Thread: Intersection point between a line and an ellipse

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2002
    Posts
    20

    Intersection point between a line and an ellipse

    This time, I have been trying to find the equation of intersection point between line and ellipse. I wrote an equation but the delta is negative so I can`t find the roots.

    x,y is the intersection point,
    x1, y1 is the start point of the line
    h, k is the center point of the line
    a is the major radius of the ellipse lies on X axis
    b is the minor radius of the ellipse lies on Y axis

    m = tan(AngleOfLine)

    (y - y1) = m * (x - x1) -> y = m * (x - x1) + y1

    I put m * (x - x1) + y1 instead of y in the ellipse equation
    (x - h) ^ 2 / a ^ 2 + (y- k) ^ 2 / b ^ 2 = 1

    and tried to solve.
    After I opened all of the paranthesises (very long line) and converted the equation in ax^2 + bx + c = 0 form, but the delta is negative.

    Even I tried to resolve this equation, the result is the same. I`m not sure if I`m doing something wrong but it seems right.

    Would you please help me to find that intersection point?
    Thanks in advance.

  2. #2
    Fanatic Member bugzpodder's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    787
    either the line does not intersect the elipse or double check your arithmetic.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Apr 2002
    Posts
    20
    Thanks for your reply bugzpodder.
    I have checked the equation 5 times, but everything is the same.
    I formed the equation in ax^2 + bx + c = 0 . I give a , b and c below.

    x1, y1 : coords of startpoint of the line
    x, y : coords of the intersection point
    h, k : coords of the center point of the ellipse
    ax, bx are major radius and minor radius of the ellipse.

    m = tan(Angle of the line)

    a = bx ^ 2 + (ax ^ 2 * m ^ 2)

    b = -2 * (bx ^ 2 * h + ax ^ 2 * m ^ 2 * x1 - ax ^ 2 * m * y1 + ax ^2 * k * m)

    c = bx ^ 2 * h ^ 2 + ax ^ 2 * m ^ 2 * x1 ^ 2 - ax ^ 2 * 2 * m * y1 * x1 + ax ^ 2 * y ^ 2 + ax ^ 2 * 2 * k * m * x1 - ax ^ 2 * 2 * k * y1 + k ^ 2 * ax ^ 2 - ax ^ 2 * bx ^ 2

    (-b - squareroot(b ^ 2 - 4 * a *c)) / 2a
    (-b + squareroot(b ^ 2 - 4 * a *c)) / 2a

    both must give the two x values of the intersection point but delta is negaive.

    I graphically tested the coordinates of the ellipse and line with AutoCAD, and the line intersected with the ellipse. But the equation above didn`t give the coords of the intersection point with the same parameters.

    Would you please help?

  4. #4
    Fanatic Member bugzpodder's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    787
    since you said ur able to draw it in autocad, i assume u have numeric numbers instead of a,b,c,d,e. y don't you give me that instead of a mess of equations?

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Apr 2002
    Posts
    20
    I attached the drawing.

    h,k : 200, 100
    major radius = ax = 100
    minor radius = bx = 50

    x1, y1 = 275, 150
    m = tan(21,80140949)

    So,

    a = 50 ^ 2 + (100 ^ 2 * m ^ 2) = 2868,82928182602

    b = -2 * (50 ^ 2 * 200 + 100 ^ 2 * m ^ 2 * 275 - 100 ^ 2 * m* 150 + 100 ^ 2 * 100 * m)= -1394905,39082075

    c = ... = 180706268,037612

    delta = b ^ 2 - 4 * a * c = -127900683282,42152740697049446
    Attached Images Attached Images  

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Apr 2002
    Posts
    20
    I`m very sorry mate, for taking your time. Please excuise me.
    I find the mistake: I have these equations solved by converting them to code in C++ and I forget tan(x) function gets the x in radians and I have entered it in degrees.
    I had been working on this for days just because a simple mistake.

    I apologize everyone who even read this post.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width