I've seen similar questions, but none worded quite like what I'm asking here. I'm not a math major, so I may have follow-up questions if answers befuddle me.
Scenario: I'm trying to emulate a rabbit's "hop" in computer software (this is 2D, BTW)
Question: If I know where the rabbit is standing (p1) and where the rabbit is hopping to (p2), how can I create a formula that achieves an arc or parabola (either would suffice, but a parabola seems to make more sense, since the distances will sometimes vary).
Additional Info:
- When the Y values of p1 and p2 are the same, I would like a specific height of the apex (vertical height of apex = half of the distance between the X values of p1 and p2).
- When the Y values of p1 and p2 are different, I need to determine a reasonable height for the apex that doesn't look ridiculous (how could I specify a reasonable focus?).
If I have asked in the wrong place, I will happily follow links to the right place. Thanks in advance!
Here's a simple way to parameterize it. Let's say that the horizontal distance the rabbit would travel if his starting and ending heights were the same is $d$.
First suppose that the rabbit starts and ends at the same height, and that it takes 1 time unit to make the jump. Then $d=p_2-p_2$, then you can choose its $x$ and $y$ coordinates as a function of time to be
$$x(t) = dt\tag{1}$$ $$y(t)=2dt(1-t)\tag{2}$$
which gives the starting and ending positions correctly, and ensures that the rabbit is at height $d/2$ halfway through the jump. If you like, you can substitute one into the other to get
$$y = 2x(1-x/d) \tag{3}$$
Now suppose that instead, the horizontal distance of the jump is different from $d$. That is, he would jump the distance $d$, but the vertical height of his landing place is different, so he is either cut short (if he's jumping up) or he goes a bit further (if he's jumping down). We can use the formula (3) as above, but demand that when his vertical height is $\Delta y=y_2-y_1$, he has moved a total horizontal distance $\Delta p=p_2-p_1$:
$$\Delta y= 2\Delta p(1-\Delta p/d)$$
which you can rearrange to give $d$ in terms of the other parameters:
$$d = \frac{(\Delta x)^2}{\Delta x - \tfrac{1}{2}\Delta y}$$
You can now use formula (3) with this value of $d$ to get the rabbit's path, or if you want a parameterization in terms of time, then use formulas (1) and (2) with this value of $d$.
If you want the rabbit to take $T$ seconds to do the jump, rather than 1 second, then simply replace $t$ with $t/T$ on the right-hand side of formulas (1) and (2).