I want to display a parabola defined by a line and a focus point but I don't get what is expected.

56 Views Asked by At

So I want to get the equation of the parabola from a line equation and a focus point. The line is defined by 2 points (x1,y1); (x2,y2) on a plane. and the focus point (fx,fy) is another point on the plane. The line equation look like this:

y=m*x+b
m = (y2 - y1) / (x2 - x1)
b = y1 - m*x1

Then the equation of the parabola looks like this:

y = ((x - fx)^2+fy^2-(m*x+b)^2)/(2*(fy-(m*x+b)));

After these calculations I rotate the parabola equation (the points I got) with the angle of:
angle = (tan(slope) * 180) / PI;

With this kind of calculation I got something like this: (the first one is okay but than I don't know what I got) http://i.giphy.com/3oEdv3mt7fQPvVqxMY.gif

Here is another gif: http://i.giphy.com/3oEduKBNwV2A6VWy64.gif

I don't know why I got something like this. This is not what I expected. What is wrong with my calculations?

1

There are 1 best solutions below

0
On

Hint:

If I well understand you have the directrix of the parabola $d$ with equation: $$ mx-y+(y_1-mx_1)=0 \qquad m=\dfrac{y_1-y_2}{x_1-x_2} $$ and the focus $F=(F_x,F_y)$ so the parabola is, by definition, the locus of points $ P= (x,y)$ such that: $$ \overline{Pd}=\overline{PF} $$ and, using: $$ \overline{Pd}= \dfrac{|mx-y+(y_1-mx_1)|}{\sqrt{m^2+1}} $$

$$ \overline{PF}=\sqrt{(x-F_x)^2+(y-F_y)^2} $$ and squaring, you have the equation of the parabola that has as symmetry axis the straight line orthogonal to the directrix and passing thorough the focus.