5 ms·
Bézier curves in Haskell
- kilovoltaire 15y agoEvery time I remember how simply Bézier curves can be implemented it makes me happy, so I thought I'd share this. Given a list of n points it generates an n-degree Bézier curve. The complexity of this is O(2^n) so even a 20-point curve could be quite slow. (In "real" graphics code this is avoided by using, e.g. a second-degree curve, regardless of the number of points. But the implementation of that doesn't have as pretty a recursive structure imho.)