General equation for a parabola given 2 points and the maximum

338 Views Asked by At

This is driving me a little nuts. I have a programming need that requires a parabolic trajectory. I must technically do this in 3 dimensions but I think the problem reduces to resolving equations in just 2 planes, which will have almost identical structure. So I just need the 2d case figured out.

enter image description here

what is the general formula for an upside-down parabola when 2 points are are known, one of them on the x-axis (although if that isn't required that would be more useful for a general sol'n) and the maximum height is known? The vertex is not known (although the generic formula $(b/2a,\mathbb{height})$ should hold.

I figured this should be a simple system of 3 linear equations (at worst) but I keep messing it up and I'm pretty embarrassed at this point. Has anybody done this?

EDIT

Thanks to @Yves Daoust for posting instructions. Define the following: $$X_{START} := X_S, \\ Y_{START} := Y_S, \\ X_{END} := X_E, \\ Y_{END} := Y_E, \\ \mathbb{midX} := X_M, \\ \mathbb{height} := Y_M. \\$$

We want a formula of the sort

$$Y = Y_M - C \left(X - X_M\right)^2$$

By following Yves Daoust's instructions, you get

$$ X_M = \frac{X_E \sqrt{\frac{Y_M - Y_S}{Y_M - Y_E}} - X_S}{\sqrt{\frac{Y_M - Y_S}{Y_M - Y_E}} - 1} \quad , \quad \frac{X_E \sqrt{\frac{Y_M - Y_S}{Y_M - Y_E}} + X_S}{\sqrt{\frac{Y_M - Y_S}{Y_M - Y_E}} + 1}\\C = \frac{Y_M - Y_E}{\left(X_E - X_M\right)^2}$$

For the formula to work, we will need $\left(X_S <= X_M <= X_E\right)$ or $\left(X_E <= X_M <= X_S\right)$. Only one value will meet this criteria.

1

There are 1 best solutions below

0
On BEST ANSWER

A parabola with apex at $(X_m,Y_m)$ is

$$Y=Y_m-c(X-X_m)^2.$$

You can express two extra crossing points,

$$Y_s=Y_m-c(X_s-X_m)^2$$ and $$Y_e=Y_m-c(X_e-X_m)^2.$$

Now by eliminating $c$,

$$\left(\frac{X_s-X_m}{X_e-X_m}\right)^2=\frac{Y_m-Y_s}{Y_m-Y_e}.$$

You can solve for $\dfrac{X_s-X_m}{X_e-X_m}$, then for $X_m$ and for $c$. You will find two solutions, of which one can be rejected.