Oh I do love a Bézier Curve post, the math and geometry behind them is just so beautiful.<p>Bartosz Ciechanowski's one from last year is my favourite, a little less math heavy and goes on to explain other curves and surfaces: <a href="https://ciechanow.ski/curves-and-surfaces/" rel="nofollow">https://ciechanow.ski/curves-and-surfaces/</a>
I used to think it was my fault that I struggled to draw things with Bézier curves but then I took a look at the resource packs for a game I respected (which had a flat art style that would have been a good fit for vectors) and found that my favorite character designers didn't know how to draw anime characters with Bézier curves either.<p>That is, no matter how much art you know or math you know it is awkward to draw things with Bézier curves and it's a bit of a tragedy that NURBS and other curve families that are more intuitive to work with haven't caught on.
Good article but I found this remark at the start interesting:
"The first of these are as easy to draw as they are easy to make a computer draw. Give a computer the first and last point in the line, and BAM! straight line. No questions asked."<p>Ha! Of course every graphics API makes it easy, but there is much going on under the hood. (Um, do GPU's have hoods?) See "Bresenham's algorithm": <a href="https://en.wikipedia.org/wiki/Bresenham's_line_algorithm" rel="nofollow">https://en.wikipedia.org/wiki/Bresenham's_line_algorithm</a>
There is a trivial interpretation of Bezier curves that helped me to understand them:<p>Quadratic Bezier is just trajectory of a point with initial velocity and constant acceleration.<p>Cubic Bezier is just trajectory of a point with initial velocity and acceleration, and constant change of acceleration.<p>Direction to control points are just initial/final velocity.
Norman J Wildberger has a series of videos about Bézier curves (referring to them as "de Casteljau Bézier", or dCB, curves) <a href="https://www.youtube.com/watch?v=6LtMKObyKMs" rel="nofollow">https://www.youtube.com/watch?v=6LtMKObyKMs</a><p>He's got hundreds of videos, from elementary school subjects up to research seminars, and they usually provide interesting perspectives even for familiar subjects, since he always tries to avoid using infinite sets, irrational numbers, limits, etc. (which he "doesn't believe in")
This video tutorial is also good: <a href="https://www.youtube.com/watch?v=aVwxzDHniEw" rel="nofollow">https://www.youtube.com/watch?v=aVwxzDHniEw</a>
Slightly related: Closed Continuous Bézier Curves with on-curve control-points for a Much more intuitive interaction. It is also used to fit curves into arbitrary outlines like country/region borders.<p>The project is heavily under construction, however the interactive examples are functional. The examples are intended for desktop, but should work with touchscreens.<p><a href="https://rockingship.github.io/ccbc/README.html" rel="nofollow">https://rockingship.github.io/ccbc/README.html</a>
Always nice to see folks enjoying the primer - if anyone runs into issues with it, feel free to head on over to <a href="https://github.com/Pomax/BezierInfo-2/issues" rel="nofollow">https://github.com/Pomax/BezierInfo-2/issues</a> and report your findings so we can improve things together.
So, let's say I want to implement these (or other) curves into a drawing program. How do I go about doing that? I mean to say, I want to implement a brush on canvas type interface - how do Bézier curves fit into that?<p>Do I collect points when mouse is down and build a curve with those points?
Do I get some other path information and rasterize?<p>I'm trying to write my own drawing program (for fun) but given my lack of background in this I feel myself floundering.
This is still the best resource I have come across for Bezier curves, B-splines and Nurbs:<p><a href="https://pages.mtu.edu/~shene/COURSES/cs3621/NOTES/" rel="nofollow">https://pages.mtu.edu/~shene/COURSES/cs3621/NOTES/</a><p>OP's primer looks very good too though. I look forward to going throught it properly.
This post helped me so much when I was using the graphviz library. I was trying to use the layout functions in graphviz for another tool, and graphviz spits out layout in bezier curve points. I was plotting the points directly, and didn't realize I needed to interpolate the actual points of the curve. This post helped immensely.
Related, for a practical application of Bézier curves, they can be used to simulate human-like mouse movements to prevent bot detection (ie. aimbots, web scraping): <a href="https://github.com/vincentbavitz/bezmouse" rel="nofollow">https://github.com/vincentbavitz/bezmouse</a>
Unrelated but similar, <a href="https://blog.maximeheckel.com/posts/cubic-bezier-from-math-to-motion/" rel="nofollow">https://blog.maximeheckel.com/posts/cubic-bezier-from-math-t...</a>.<p>Includes hands-on examples to help understand the math behind bezier curves.
I worked a lot with different curve generating algorithms when I was working in sail CAD design. If you can, avoid Bezier curves and use Splines. Far more predictable and much easier to construct with.
Is it just me or do the sliders lose focus after the slightest change?
This prevents me from dragging the slider to different values using my cursor to view the changes smoothly.
There is a nice C++ (GPLv3+) implementation of a lot of these algorithms in Solvespace here:<p><a href="https://github.com/solvespace/solvespace/blob/master/src/srf/ratpoly.cpp" rel="nofollow">https://github.com/solvespace/solvespace/blob/master/src/srf...</a><p>I'll be having a read of this to see if we can improve on some of these. In particular I've wanting to add curve-curve intersection as in section 29:<p><a href="https://pomax.github.io/bezierinfo/#curveintersection" rel="nofollow">https://pomax.github.io/bezierinfo/#curveintersection</a><p>I had already considered that exact approach, but there are cases (in CAD anyway) where portions of 2 curves may exactly overlap. In that case we'd want to identify the overlapping region and split the 2 curves into 3. These special cases might seem like corner cases and they are, but they come up in practice more than I'd like.