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.
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
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.
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?
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.