# Is it possible to build a circle with quadratic Bézier curves?

i'm searching for a curve type with a minimum of functionality and maximum of usability. I run into quadratic Bézier curves and i wonder, if its possible to draw a circle with it.

-

No, you can only produce some good approximations for sufficiently small arcs. Bezier curves can be parametrized as $(x(t),y(t))$ where $x,y$ are polynomials in $t$. To run on a circle arc, wlog. the unit circle, we must have $x(t)^2+y(t)^2=1$ for all $t$. If wlog. $d:=\deg x\ge \deg y$ then $x(t)^2+y(t)^2$ is a polynomial of degree $2d$ and can conincide with the constant $1$ only if $d=0$. That is: A nonconstant Bézier curve (even of higher than quadratic degree) cannot describe an arc.

-

That depends on what you mean. If you're looking for a planar Bézier curve which describes a circular arc in that plane, the existing answers are correct that it isn't possible.

However, if you're willing to consider a Bézier curve in 3D which forms a perfect circular arc when viewed from the correct point (i.e. with a perspective projection; this is also known as "rational Bézier curves"). E.g. these notes show how to construct any conic section with rational quadratic Béziers. And these notes handle the case of a circular arc explicitly:

This works for $\theta < \pi$ (or $\theta = \pi$ using homogeneous coordinates); for a full circle, you need more than one arc.

-
just curious: what software did you use to draw the diagram? – Jason S Feb 23 '14 at 23:24
@JasonS, I took a screenshot of the linked PDF. – Peter Taylor Feb 23 '14 at 23:26

Quadratic Bezier curves are parabolas, so can only represent circular arcs approximately.

Cubic Bezier curves are very popular (e.g. they are used in Postscript, SVG, and most drawing and CAD programs). Again, they can only represent circular arcs approximately, but the approximation might be good enough for your needs. Many drawing programs use four 90-degree cubic segments to represent a complete circle, and I'm not aware of any flood of accuracy complaints.

You can look at this site for a simple method that uses four cubic Bezier curves and gives an approximation whose maximum error is 0.0196% of the radius. This might be good enough for your application.

Higher degree Bezier curves can produce even better approximations, of course, but the computational costs are obviously higher. Look at this answer for details.

Rational quadratic curves can exactly represent circular arcs (and other conic section curves).

A final thought ... if you want to be able to represent circles exactly, why not use circular arcs as your basic curve form. In 2D, you can have a curve defined by its end-points and a "bulge" parameter. When the bulge is non-zero, you get a circular arc, and when its zero you get a straight line. To get "free-form" curves, you just string together these basic curves. Circular arcs make many computations easy: they are easy to intersect, easy to offset, and its easy to compute their arclength and distance to them. These four basic computations are much more difficult with quadratic Bezier curves.

Another final thought :-) : if you draw a circle using sine and cosine functions on a computer, it's still an approximation. It's just that the approximation is hidden inside your computer's implementation of the sine and cosine functions.

-
"and I'm not aware of any flood of accuracy complaints" somewhat related: this snafu on the New York Regents Exams‌​. – Willie Wong Jul 22 '13 at 8:34
@ Willie. Interesting discussion. Thanks. I think the poor approximation comes from lack of skill and knowledge, not from weaknesses in the approximation technique. In other words, user error. I'm sure it's possible to construct cubic Bezier curves that are indistinguishable from sine function graphs on a printed page (if you know what you're doing). – bubba Jul 23 '13 at 13:09

"a curve type with a ... maximum of usability"

reminds me that Don Lancaster once said, "I feel the "best" method for simple and graceful curves involves using a cubic spline technique." (He specifically prefers cubic Bézier splines over quadratic Bézier splines).

A single cubic Bézier curves can exactly fit any straight line, any parabola (including any quadratic Bézier curve), and certain other curves.

Is it possible to build a circle with quadratic Bézier curves?

Any smooth curve can be approximated by a series of cubic curves in a way that is visually indistinguishable from the original smooth curve.

(Each cubic curve, in turn, can be approximated by a series of a few quadratic Bézier curves in a way that is visually indistinguishable from the cubic curve or from the original smooth curve).

Most "circles" you see on a computer screen are, in fact, drawn using a Bezier curve approximation. All the shapes you see in typography -- including circles and circular arcs -- are approximated by cubic Bézier curves (in PostScript, Asymptote, Metafont, and SVG fonts) or quadratic Bézier curves (in TrueType fonts).

It is possible to create an approximation of a circle (or a sine wave) to an accuracy of about 1 part in a thousand with 4 cubic Bezier curves, and to about 4 parts per million with 8 Bezier curves. See "Wikibooks: fixed-point", "Wikipedia: Bezigon circle approximation", "Approximating Cubic Bezier Curves with a few Quadratic Bezier curves in Flash MX", and "Don Lancaster's Cubic Spline Library" -- which in turn includes "Approximating a Circle or an Ellipse Using Bezier Cubic Splines" and "How to determine the control points of a Bézier curve that approximates a small circular arc".

-