How to find position of object on a parabola?

1.2k Views Asked by At

I'm making a computer game, where an object flies along a parabola curve. This object is 'thrown' by a 'robot' towards another robot.

I know the vertex of the parabola, and also it's two intersections with the x axis.

I also now the object's x position.

I need a way to find the object's y position on the parabola.

I'm not great in math, so I'd like the method to do this be as simple as possible. Please try to explain it in a way I'll be able to understand.

My parabola: enter image description here

Thanks a lot

2

There are 2 best solutions below

0
On

Ok, assuming that $y = ax^{2} + bx + c$: The vertex is given by $$ y' = 0 = 2ax + b \implies x_{vertex} = -\frac{b}{2a}. $$ Now we also have the intercepts of the x axis given by the quadratic formula, $$ x = \frac{-b}{2a}\pm\frac{\sqrt{b^{2}-4ac}}{2a}. $$ Now does y = x = 0? since that will give c. So from knowing the vertex value and the roots and the intercept of y at x = 0 we can define any point on y in terms of x. Alternatively if we set robot 1 to have x-cord of (x,y)=(0,0) then c = 0. From here you can compute what a, and b are from the vertex value and the points that the robots are placed.

More explicitly: $$ \mathrm{vertex} = -\frac{b}{2a}\\ \mathrm{robot\,1\,position} = \frac{-b}{2a} - \frac{\sqrt{b^{2}-4ac}}{2a}\\ \mathrm{robot\,2\, position} = \frac{-b}{2a} + \frac{\sqrt{b^{2}-4ac}}{2a} $$

0
On

You are given the coordinate of the vertex $(h,k)$ and two distinct real roots, which by symmetry can be written as $h\pm r$ for some $r>0.$

Then the equation for the parabola is

$$y=-\frac{k}{r^2}(x-h)^2+k.$$


Another way to express this:

You are given distinct real roots $r_1,r_2$ and coordinate of vertex $\left(\frac{r_1+r_2}{2},k\right).$

Then the equation for the parabola is

$$y=-\frac{4k}{(r_1-r_2)^2}(x-r_1)(x-r_2).$$