3 ms·
The same simple explanation in the animation leads to a nice simple Haskell implementation. Assuming you already have a parametric line function `line p q t` t
by kilovoltaire 14y ago
The same simple explanation in the animation leads to a nice simple Haskell implementation.
Assuming you already have a parametric line function `line p q t` that interpolates between two points p and q on t in [0,1], you can recursively implement parametric Bézier on a list of control points as:
bezier [p] t = p
bezier ps t = line (bezier (init ps) t)
(bezier (tail ps) t)
t
It's exponential in the number of points though ;)
(Full source at https://github.com/hrldcpr/Bezier.hs/blob/master/Bezier.hs https://github.com/hrldcpr/Bezier.hs/blob/master/Bezier.hs)