FWIW, here's the bezier algorithm in Python:<p><pre><code> def bezier(t, *handles):
"""Computes a single point of a bezier of any order where 0 <= t <= 1."""
if len(handles) == 1:
return handles[0]
else:
pairs = zip(handles[:-1], handles[1:])
return bezier(t, *[_bezier_interpolate(t, a, b) for a, b in pairs])
def _bezier_interpolate(t, a, b):
return [a * (1-t) + b * t for a, b in zip(a, b)]
assert bezier(0.25, [1, 1, 1], [2, 2, 2], [3, 4, 5]) == [1.5, 1.5625, 1.625]
</code></pre>
You can pass it any order of bezier (cubic, quadratic, etc.) for any number of dimensions, and how for along the interpolation you are. It will give you a single point. Connect a bunch together to get your curve. You can actually stop when `len(handles) == 2` and you get line segments instead of points, but it's slightly less accurate.<p>You can see the math for computing a point (or segment) is trivial (addition and multiplication) and it can be easily parallelized. It can even be a one-liner, but that isn't very readable.<p>Here's a good website for visualizing the math: <a href="https://www.summbit.com/blog/bezier-curve-guide/" rel="nofollow">https://www.summbit.com/blog/bezier-curve-guide/</a>