
A Primer on Bézier Curves (2011) - ant6n
https://pomax.github.io/bezierinfo/
======
kxyvr
Neat site. Unless I missed it, I didn't see a discussion of blossoms, which
I've found to be a very nice tool when dealing with Bezier curves. There's a
great paper called, "Blossoming : a connect-the-dots approach to splines" by
Ramshaw ([http://www.hpl.hp.com/techreports/Compaq-DEC/SRC-
RR-19.pdf](http://www.hpl.hp.com/techreports/Compaq-DEC/SRC-RR-19.pdf)) that
discusses these ideas. I've also gained a lot of value out of Goldman's book,
"Pyramid Algorithms,"
([https://books.google.com/books?id=xFuhIl1rb2sC](https://books.google.com/books?id=xFuhIl1rb2sC)).
Finally, it's not a great book, but Prautzsch, Boehm, and Paluszny's book,
"Bezier and B-Spline Techniques,"
([https://www.springer.com/us/book/9783540437611](https://www.springer.com/us/book/9783540437611))
has the most compact and correct description of triangle Bernstein-Bezier
patches that I've seen, so I refer to it when working in higher dimensions.

~~~
TheRealPomax
Sure, but let's be fair: blossoms are "Bezier curves are nice but what if we
did something completely different", which isn't really in scope =)

~~~
jacobolus
That’s not a fair summary. Blossoms are the same thing, but with a “cleaner”
but more abstract mathematical description. They make certain proofs easier,
but require a bit more mathematical sophistication for the reader.

Personally I like Ramshaw’s later whitepaper (“On multiplying points: the
paired algebras of forms and sites”) even better, I found it yielded some neat
insights, but it’s been mostly ignored in the literature. Probably because
it’s even more abstract than the blossoming paper, and takes significant
amounts of concentrated effort to digest for anyone who isn’t a professional
mathematician: [http://www.hpl.hp.com/techreports/Compaq-DEC/SRC-
RR-169.pdf](http://www.hpl.hp.com/techreports/Compaq-DEC/SRC-RR-169.pdf)

~~~
TheRealPomax
"completely" was perhaps a poor choice of word, but insofar as Bezier theory
is concerned, blossoms do depart from it quite a bit. It's a great topic (and
your links are excellent!) but not something that would likely find its way
into the Primer any time soon (although that said, it would be nice to add a
"further exploration" section with links to material such as this, so I just
filed
[https://github.com/Pomax/BezierInfo-2/issues/26](https://github.com/Pomax/BezierInfo-2/issues/26)
and hopefully I can get to that soon)

------
Bouncingsoul1
Hmm looks like the Bezier equivalent to "the NURBS Book
"[http://www.springer.com/de/book/9783540615453](http://www.springer.com/de/book/9783540615453).
Understandable math, good drawings and pseudocode. Great for a medicore
developer like me. Now I only need a book "From Bezier to Nurbs and back" and
I'm all done.

~~~
jacobolus
Farin’s book about NURBS is pretty good,
[http://www.amazon.com/dp/1568810849](http://www.amazon.com/dp/1568810849)

Farin’s other CAGD book is probably the best overall survey, and should meet
your criterion.
[http://www.amazon.com/dp/0122490541](http://www.amazon.com/dp/0122490541)

~~~
chengiz
Second Farin's books, the CAGD one is great. On an unrelated note, he passed
away earlier this year: [https://asunow.asu.edu/20160128-life-and-career-
gerald-farin...](https://asunow.asu.edu/20160128-life-and-career-gerald-farin-
geometric-modeling-pioneer-generous-mentor)

------
Tomte
Whenever I dabble in type design or vector graphics I'm cursing Bézier curves.
I do understand them rationally. But I just can't move the control points such
that the result is what I want.

It's a pity that Knuth's Metafont curve definition system (with on-curve
points) hasn't gotten more attention.

Or Karow's Ikarus software also had something with on-curve points, IIRC.

~~~
jacobolus
Look up Raph Levien’s Ph.D thesis about “spiro” curves (a.k.a. cornu or Euler
spirals). He not only proposes a pretty neat type of curve to use, which
affords some nice UIs, but also does a great job detailing the history of
splines, including other types of smooth “minimum energy” curves, IKARUS
splines, Hobby splines (used by METAFONT), etc.
[http://www.levien.com/phd/phd.html](http://www.levien.com/phd/phd.html)

[I’m somewhat surprised that the Pomax page doesn’t have a section about Hobby
splines to go with the section about Catmull-Rom splines. Here’s the Stanford
tech report describing them
[http://i.stanford.edu/pub/cstr/reports/cs/tr/85/1047/CS-
TR-8...](http://i.stanford.edu/pub/cstr/reports/cs/tr/85/1047/CS-
TR-85-1047.pdf) ; Apple’s Pages and Keynote programs now can use Hobby splines
for making shapes, [https://bosker.wordpress.com/2013/11/13/beyond-bezier-
curves...](https://bosker.wordpress.com/2013/11/13/beyond-bezier-curves/) ;
the problem I have with Hobby splines is that there are certain types of
shapes that are a real pain to create. As long as you want something very
smooth it works pretty well, but whenever the Hobby curve isn’t giving you
quite the result you want, tweaking it precisely can become really tricky, and
you wish you just had full control over the Bézier arms. It could just be that
I don’t have enough practice with them though.]

Another type of curve that is very interesting for some applications is a
Pythagorean-hodograph curve. These are curves such that the derivative in the
X and Y direction are represented by "Pythagorean" polynomials, i.e. the
hypotenuse √(x²+y²) is itself a polynomial. This means that the arclength can
be precisely computed in closed form, as can mathematically precise offset
curves, which makes them great for defining CAM cut paths.

Lots of CAD software uses b-splines, specifically “NURBS”, as the main curve
primitive. Some computer animation software uses subdivision surfaces instead.
I’ve never been the biggest fan of UIs for manipulating either one. YMMV.

Personally, I think even for using parametric cubic polynomial segments (i.e.
for interoperating 1:1 with systems where the main drawing primitive is a
cubic Bézier curve), it works a bit better from a UI perspective to specify
the (x, y) locations of on-curve points at t = {0.0, 0.25, 0.75, 1.0} in each
segment [these points are the extrema of the Chebyshev polynomial of the
appropriate degree] and then convert to Bézier basis by multiplying by the
appropriate matrix. I haven’t ever seen anyone try to implement such a UI in
production software though, only my own little experimental doodles. (Only
downside is that makes it slightly trickier to ensure smoothness at the
endpoints in cases where that matters. I think this can be worked around with
some extra UI effort.)

~~~
delhanty
Raph's thesis is a great piece of work. Having said that, it's worth making
clear that the use of Euler Spirals in CAD predates his work. (His thesis is
clear about this point.)

In highway design they are known as clothoids.

[https://en.wikipedia.org/wiki/Track_transition_curve](https://en.wikipedia.org/wiki/Track_transition_curve)

I worked as a consultant on a Japanese road design system (Sanei's STRAX Road
CAD - still being sold it looks), and clothoids were already well established
when I started in 1995.

~~~
TheRealPomax
My coffee table book "The Physics Book", by Clifford A. Pickover, dates
practical applications of the clothoid curve back to at least 1901, when an
engineer by the name of Edwin C. Prescott received a patent for their use in
rollercoaster designs (after discovering the acceleration problems associated
with circular loops some 1~2 years prior).

~~~
delhanty
My point was that the use of Euler Spirals (aka clothoids) were ubiquitous in
commercial CAD systems for highway design well before Raph Levien's work in
fonts. My datapoint of 1995 in Japan certainly would not have been the first,
but it does show how widespread their use has been.

------
eurleif
This animated demo by Jason Davies makes the basics very easy to understand:
[https://www.jasondavies.com/animated-
bezier/](https://www.jasondavies.com/animated-bezier/)

~~~
TheRealPomax
No argument there: if you want an immediate understanding of "how do they
work", Jason's site is it. But: if you want to dive a bit deeper, hopefully
the Primer covers the rest (and if it doesn't, it's open source on github;
comments, questions, and PRs welcome)

~~~
eurleif
Absolutely, the primer has a lot of great info. :) I didn't mean to imply
there's any competition between the two; just linking another resource.

~~~
TheRealPomax
Same here - Jason did a great job getting the core idea across, I like to
think of his site, [http://cubic-bezier.com](http://cubic-bezier.com), and my
Primer as a "this should cover all the things you care about" =)

------
jhallenworld
There is a cool algorithm to least-squares fit Bezier curves to a list of
points by Philip J. Schneidr, printed in Graphics Gems. Here is a C# version I
found on github:

[https://github.com/burningmime/curves/blob/master/README.md](https://github.com/burningmime/curves/blob/master/README.md)

For example, you can use it convert scanned bitmapped font edges to curves to
create a scalable font.

~~~
TheRealPomax
In the same category of curve ftting, there's also work done by Itoh and Ohno
("A curve fitting algorithm for character fonts",
[https://pdfs.semanticscholar.org/e8fa/3b676324dc17ce3098ddbc...](https://pdfs.semanticscholar.org/e8fa/3b676324dc17ce3098ddbc218da7d6c6ea9f.pdf))
that tries to do the same kind of fitting, with fewer segments but slightly
higher MSE. If you read graphics gems, you might want to read this, too.

------
ant6n
This page really helped me wrap my head around Bezier curves. It's very well
done.

One thing, given all the live code on the site, it would be nice to have a
live sample where one can select points and a t in [0, 1], and it shows it's
coordinate along the line. I implemented a Bezier curve, and had trouble
coming up with unit test samples.

~~~
TheRealPomax
unit tests are generally easiest to do with unit curves:
(0,0)-(0,1)-(1,1)-(1,0) has well defined coordinates for many t values. t=0.5
-> (1/2,3/4), t=0.25 -> (5/32, 9/16), etc. If you need this for unit testing,
hit up [http://pomax.github.io/bezierjs](http://pomax.github.io/bezierjs)
instead, open dev tools, type "var b = new Bezier(x1,y1,x2,y2,x3,y3,x4,y4)"
with real values of course, and then check the coordinates you get for
"b.get(0.5)", "b.get(0.25", etc.

------
coldcode
I wish I'd had this when I implemented Bezier curve drawing in 1988.

------
amelius
I have a question. How does one make a perfect circle using Bezier curves?

~~~
jacobolus
You can’t. However, if you add enough segments you can get arbitrarily close.

~~~
amelius
This also holds for straight line segments :)

~~~
jacobolus
Indeed. It also holds for points only connected by horizontal or vertical
lines. Or even for sets of disconnected points. :-)

However, you need a lot fewer parametric cubic segments than straight lines to
get to any desired tolerance.

