Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Mathematical Intuition Behind Bezier Curves (buildingvts.com)
139 points by farashh on May 8, 2016 | hide | past | favorite | 19 comments


The geometric intuition is important but missing. Calculus and algebra is not everything.

Short version:

Imagine a line connecting A to B. Now imagine a point sliding across that line, starting at A and going to B.

Now consider a line A to B and a second line B to C. A point slides across each line: one from A to B, another from B to C. Now draw a line connecting these two points, and imagine a point sliding across that line.

This moving line starts as A to B, ends as B to C, so the point sliding along it goes from A to C along a curved path. This is a quadratic Bézier curve.

Add another layer and you get cubic.


The crucial insight I drew from the OP was that Bézier curves are essentially a weighted average of the endpoints and control points, with the weights shifting an a parametric way. Somehow that had never clicked before. Your comment gives a nice way to elabourate on how the parameterisation works.


Wikipedia has some good animations of this:

https://en.wikipedia.org/wiki/B%C3%A9zier_curve#Constructing...


For whatever it's worth, I found this explanation useful, at least when rendered visually, when first encountering this stuff.

But clearly the geometric viewpoint isn't important to everybody, because the author of the post would have mentioned it if so!

See also, maybe: http://psychclassics.yorku.ca/Galton/imagery.htm http://www.nytimes.com/2015/06/23/science/aphantasia-minds-e... https://www.facebook.com/notes/blake-ross/aphantasia-how-it-...


Which gets to their real advantage, they are easy to create by dragging around a few points.


This was a big revelation for me. It's just "nested percentages" in mathematical clothing.

How to connect simple concepts (I think almost everybody would understand linear interpolation, even in [a, 1-a] form) and get polynomials.


For anyone with enough formal mathematics background to follow the argument, Lyle Ramshaw’s monograph, On multiplying points: the paired algebras of forms and sites, supplies the clearest formalism for understanding and working with Bézier curves and various CAGD surface primitives. http://www.hpl.hp.com/techreports/Compaq-DEC/SRC-RR-169.html (Note: ~150 page math book, takes some work to follow.)

Also check out the pomax bezier curve primer, which is filled with interactive diagrams and nice explanations of algorithms for doing anything you might like with Bézier curves, http://pomax.github.io/bezierinfo/ (previous discussions, https://news.ycombinator.com/item?id=11402656 https://news.ycombinator.com/item?id=8804691)


Yes, this (Lyle Ramshaw's paper). My impression is that his work succeeds in finding the simplest human-comprehensible way of defining these objects. It's very much not the pragmatic "local hacker" approach to graphics, which can be forbidding.

I also enjoyed this interview with Tony DeRose: https://www.youtube.com/watch?v=mX0NB9IyYpU

It can be so discouraging for people to encounter this stuff (geometric modelling primitives) as a mysterious incantation, essentially as raw algebraic code. I think there's probably more scope to humanize it, as Ramshaw and DeRose's demonstrations suggest.


Jason Davies has a really great interactive demo of Bezier curves: https://www.jasondavies.com/animated-bezier/



To complement, here's a particularly lucid explanation of how bezier curves are constructed that appeals to geometric intuition: https://vimeo.com/106757336


Bezier curves are really cool and fun to learn. I actually had built an Impact.js bezier tool plugin for a shmup I was working on a while ago: https://github.com/dclowd9901/impactjsBezier

I did different things like toy with caching movement on the curve, having constant speed on the path, etc. There's even a bit of calculus in there, in estimating the length of the curve.


I only really found out how easy and fast Bezier curves are recently when I was adding some smoothing pathing to a game. They're really impressively useful.


You probably want a Catmull-Rom or similar interpolating (instead of approximating) spline. It's much easier to control animation or other paths when you know it'll precisely go through the points you specify.


You also need to care about velocity when using splines as trajectories. In general, if you sample a spline at a constant delta-t, your speed through the world won't be constant.


This is especially true if you've got large smooth curves with small "sharp" curves that you want to keep a constant speed over. You can mostly just ignore it if all of your curves have a fairly constant curvature, but obviously test first.


I did end up using Hermite curves and letting the designers and animators tune it how they wanted.


I don't think this does a great job of building up an intuition of how these curves are derived. Instead, I'd recommend starting with quadratic (and noticing the constraints on the tangents) and then realize how the cubic is built up from that. Like all (later discovered) splines it's a really elegant and simple thing!


Fascinating article!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: