I have the coordinates of potentially any points within a 3D arc, representing the path an object will take when launched through the air. X is forward, Z is up, if that is relevant. Using any of these points, I need to create a bezier curve that follows this arc. The curve requires the tangent values for the very start and end of the curve. I can't figure out the formula needed to convert this arc into a bezier curve, and I'm hoping someone can help. I've found plenty of resources discussing circular arcs, but the arc here is not circular.


Assuming that the arc is indeed a parabola, then the procedures outlined at Convert segment of parabola to quadratic bezier curve and http://www.ams.org/samplings/feature-column/fcarc-bezier should provide the appropriate calculations.

  • $\begingroup$ Ah, I'll look closer at those. I didn't think they applied here, since the formula given required A, B, and C variables without any definition given as to what those represented, so I was left to assume that they were unique to the calculation of a Parabola, and not applicable here. I've never taken Calculus, so I have a bit of a tenuous grasp on that. $\endgroup$ – Zack Maxwell Feb 6 '17 at 4:18

Let $\mathbf{Q}$ be the start of the curve, let $\mathbf{V}$ be the initial velocity vector, and let $\mathbf{G}$ be the gravity vector. Then the equation of the trajectory is: $$ \text{ParabolaFunction:}\quad \mathbf{P}(t) = \mathbf{Q} + t\mathbf{V} + \tfrac12 t^2\mathbf{G} $$ I will assume that you have unitized the time scale so that the flight starts at $t=0$ and ends at $t=1$.

Compute three points on the curve: \begin{align} \mathbf{P}_0 &= \mathbf{P}(0) \\ \mathbf{P}_m &= \mathbf{P}(\tfrac12) \\ \mathbf{P}_3 &= \mathbf{P}(1) \end{align} and let $\mathbf{P}_c = \tfrac12(\mathbf{P}_0 + \mathbf{P}_1)$ be the mid-point. Compute $$ \mathbf{P}_a = \mathbf{P}_c + 2(\mathbf{P}_m - \mathbf{P}_c). $$ Then let \begin{align} \mathbf{P}_1 &= \tfrac23\mathbf{P}_a + \tfrac13\mathbf{P}_0 \\ \mathbf{P}_2 &= \tfrac23\mathbf{P}_a + \tfrac13\mathbf{P}_3 \end{align} Then the control points of the cubic Bezier curve are $\mathbf{P}_0$, $\mathbf{P}_1$, $\mathbf{P}_2$, $\mathbf{P}_3$.

Pseudocode is as follows. It assumes that addition and scalar multiplication of 3D points and vectors have been overloaded in the obvious way:

p0 = ParabolaFunction(0)
pm = ParabolaFunction(0.5)
p3 = ParabolaFunction(1)

pc = 0.5*(p0 + p3)      // Point on chord
pa = pc + 2*(pm - cc)   // Apex point; intersection of tangents

oneThird = 1.0/3.0
twoThirds = 2*oneThird 

p1 = twoThirds*pa + oneThird*p0
p2 = twoThirds*pa + oneThird*p3

result = CubicBezierCurve(p0, p1, p2, p3)
  • $\begingroup$ Hm... I'm really struggling with this one. It doesn't account for the Y-axis, so I had to put that in myself, which I attempted by just replicating the X-axis math on it. It also has some extraneous bits, since I already have the basic points in the parabola. My attempts so far have failed, though. I'm just getting a straight line as the bezier curve. $\endgroup$ – Zack Maxwell Feb 9 '17 at 21:02
  • $\begingroup$ From your question, I got the impression that your parabola was just $z$ as a function of $x$, with $y=0$ everywhere. If that's not the case, then the approach will need to be modified. Please clarify. $\endgroup$ – bubba Feb 10 '17 at 0:39
  • $\begingroup$ Do you actually have the ParabolaFunction that I assumed? If so, what are its inputs and outputs? $\endgroup$ – bubba Feb 10 '17 at 1:02
  • $\begingroup$ I... don't think I have a ParabolaFunction. I'm using X, Y and Z. I was simply stating that Z in my case is the up axis, but saying X is forward may have been misleading. I forgot that I was actually using world coordinates. $\endgroup$ – Zack Maxwell Feb 10 '17 at 2:43
  • $\begingroup$ What do you know about your "arc"? Do you know its equation? Do you have some points that lie on it? Can you calculate a point at any given "time" value? You're asking for a function that outputs a Bezier curve; you have to specify what inputs this function will receive. $\endgroup$ – bubba Feb 11 '17 at 3:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.