Find equation for a parabolic line that goes through two points in 3D space

3dgeometry

I'm currently working on some computer graphics program where I want to show a line that "bounces" from point $A$ to point $B$, so I need an equation through which I can plug in values and interpolate the points that would trace the bounce.

Given two points, $A$ and $B$, in three dimensions, how do I determine the equation of a parabola that goes through $A$ and $B$?

Some additional information that might be helpful:

  • Assume that a point $C$ is the midpoint between $A$ and $B$
  • Assume that a point $D$ is the vertex of the parabolic line
  • The length of line segment $\overline{CD}$ is a known variable/value

enter image description here

Best Answer

Let's first specify the line from $A$ to $B$: $$ u(\lambda) = (1-\lambda) A + \lambda B $$ where $\lambda \in [0, 1]$.

Now we stack the parabola on top: $$ f(\lambda) = (\lambda - 0)(\lambda - 1) h $$ where $h$ is such that $f(1/2) = \vec{CD}$, which is the vector from $C$ to $D$: $$ f(1/2) = (1/2)(1/2 - 1) h = \vec{CD} \iff \\ h = -4 \cdot \vec{CD} \iff \\ f(\lambda) = 4 \, \vec{CD} \, \lambda(1 - \lambda) $$ This gives $$ v(\lambda) = (1-\lambda) A + \lambda B + 4\, \vec{CD} \, \lambda(1-\lambda) $$ This requires $C = (A+B)/2$. That way $A$ and $B$ can be arbitrary points, they need not lie in the $z=0$ plane.