5.3 Bezier Curves
5.3 Bezier Curves
5.3 Bezier Curves
Bézier curves are widely used in computer graphics to model smooth curves. As
the curve is completely contained in the convex hull of its control points, the points
can be graphically displayed and used to manipulate the curve intuitively. Affine
transformations such as translation and rotation can be applied on the curve by
applying the respective transform on the control points of the curve.
Quadratic and cubic Bézier curves are most common. Higher degree curves are
more computationally expensive to evaluate. When more complex shapes are
needed, low order Bézier curves are patched together, producing a Bézier
spline. A Bézier spline is commonly referred to as a "path" in vector
graphics standards (like SVG) and vector graphics programs (like Adobe
Illustrator, CorelDraw and Inkscape). To guarantee smoothness, the control point at
which two curves meet must be on the line between the two control points on
either side.
The simplest method for scan converting (rasterizing) a Bézier curve is to evaluate
it at many closely spaced points and scan convert the approximating sequence of
line segments. However, this does not guarantee that the rasterized output looks
sufficiently smooth, because the points may be spaced too far apart. Conversely it
may generate too many points in areas where the curve is close to linear. A
common adaptive method is recursive subdivision, in which a curve's control
points are checked to see if the curve approximates a line segment to within a small
tolerance. If not, the curve is subdivided parametrically into two segments, 0 ≤ t ≤
0.5 and 0.5 ≤ t ≤ 1, and the same procedure is applied recursively to each half.
There are also forward differencing methods, but great care must be taken to
analyse error propagation. Analytical methods where a spline is intersected with
each scan line involve finding roots of cubic polynomials (for cubic splines) and
dealing with multiple roots, so they are not often used in practice.
Animation
Fonts
Because arcs of circles and ellipses cannot be exactly represented by Bézier curves,
they are first approximated by Bézier curves, which are in turn approximated by
arcs of circles. This is inefficient as there exists also approximations of all Bézier
curves using arcs of circles or ellipses, which can be rendered incrementally with
arbitrary precision. Another approach, used by modern hardware graphics adapters
with accelerated geometry, can convert exactly all Bézier and conic curves (or
surfaces) into NURBS, that can be rendered incrementally without first splitting
the curve recursively to reach the necessary flatness condition. This approach also
allows preserving the curve definition under all linear or perspective 2D and 3D
transforms and projections.
Font engines, like FreeType, draw the font's curves (and lines) on a pixellated
surface, in a process called Font rasterization.
Examination of cases
A Bézier curve is defined by a set of control points P0 through Pn, where n is called
its order (n = 1 for linear, 2 for quadratic, etc.). The first and last control points are
always the end points of the curve; however, the intermediate control points (if
any) generally do not lie on the curve.
A quadratic Bézier curve is the path traced by the function B(t), given points P0, P1,
and P2,
,
which can be interpreted as the linear interpolant of corresponding points on the
linear Bézier curves from P0 to P1 and from P1 to P2 respectively. Rearranging the
preceding equation yields:
from which it can be concluded that the tangents to the curve at P0 and P2 intersect
at P1. As t increases from 0 to 1, the curve departs from P0 in the direction of P1,
then bends to arrive at P2 from the direction of P1.
Writing BPi,Pj,Pk(t) for the quadratic Bézier curve defined by points Pi, Pj, and Pk, the
cubic Bézier curve can be defined as a linear combination of two quadratic Bézier
curves:
For some choices of P1 and P2 the curve may intersect itself, or contain a cusp.
Any series of any 4 distinct points can be converted to a cubic Bézier curve that
goes through all 4 points in order. Given the starting and ending point of some
cubic Bézier curve, and any two other distinct points along that curve, the control
points for the original Bézier curve can be recovered. [3]
Generalization
Bézier curves can be defined for any degree n.
Recursive definition
Explicit definition ]
Terminology
Properties
Derivative
The t in the function for a linear Bézier curve can be thought of as describing how
far B(t) is from P0 to P1. For example when t=0.25, B(t) is one quarter of the way
from point P0 to P1. As t varies from 0 to 1, B(t) describes a straight line
from P0 to P1.
Quadratic curves
For quadratic Bézier curves one can construct intermediate points Q0 and Q1 such
that as t varies from 0 to 1:
Higher-order curves
For higher-order curves one needs correspondingly more intermediate points. For
cubic curves one can construct intermediate points Q0, Q1, and Q2 that describe
linear Bézier curves, and points R0 & R1 that describe quadratic Bézier curves:
Degree elevation
A Bézier curve of degree n can be converted into a Bézier curve of
degree n + 1 with the same shape. This is useful if software supports Bézier curves
only of specific degree. For example, you can draw a quadratic Bézier curve
with Cairo, which supports only cubic Bézier curves.
To do degree elevation, we use the equality . Each
component is multiplied by (1 − t) or t, thus increasing a degree by one.
Here is the example of increasing degree from 2 to 3.
Polynomial form
Sometimes it is desirable to express the Bézier curve as a polynomial instead of a
sum of less straightforward Bernstein polynomials. Application of the binomial
theorem to the definition of the curve followed by some rearrangement will yield:
where
This could be practical if can be computed prior to many evaluations of ;
however one should use caution as high order curves may lack numeric
stability (de Casteljau's algorithm should be used if this occurs). Note that
the empty product is 1.
The rational Bézier curve adds adjustable weights to provide closer approximations
to arbitrary shapes. The numerator is a weighted Bernstein-form Bézier curve and
the denominator is a weighted sum of Bernstein polynomials. Rational Bézier
curves can, among other uses, be used to represent segments of conic
sections exactly.[6]
Given n + 1 control points Pi, the rational Bézier curve can be described by:
or simply
Quadratic Bèziers in string art: The end points (•) and control point (×) define the
quadratic Bèzier curve (⋯).
Bézier surface
Hermite curve
NURBS
String art – Bézier curves are also formed by many common forms of string
art, where strings are looped across a frame of nails.
Variation diminishing property of Bézier curves
Notes
1. ^ Image manipulation programs such as Inkscape, Adobe Photoshop,
and GIMP.
2. ^ In animation applications such as Adobe Flash, Adobe After
Effects, Microsoft Expression Blend, Blender, Autodesk
Maya and Autodesk 3ds max.
References
1. ^ http://www.xlrotor.com/resources/files.shtml
2. ^ a b FreeType Glyph Conventions, David Turner + Freetype Development
Team, Freetype.org, retr May 2011
3. ^ John Burkardt. "Forcing Bezier Interpolation".
4. ^ Shene, C.K. "Finding a Point on a Bézier Curve: De Casteljau's
Algorithm". Retrieved 6 September 2012.
5. ^ Farin, Gerald (1997). Curves and surfaces for computer-aided geometric
design (4 ed.). Elsevier Science & Technology Books. ISBN 978-0-12-
249054-5
6. ^ Neil Dodgson (2000-09-25). "Some Mathematical Elements of Graphics:
Rational B-splines". Retrieved 2009-02-23.
Rida T. Farouki, The Bernstein polynomial basis: A centennial
retrospective, Computer Aided Geometric Design, Volume 29, Issue 6,
August 2012, Pages 379–419, doi:10.1016/j.cagd.2012.03.001
Paul Bourke: Bézier Surfaces (in
3D), http://local.wasp.uwa.edu.au/~pbourke/geometry/bezier/index.html
Donald Knuth: Metafont: the Program, Addison-Wesley 1986, pp. 123–131.
Excellent discussion of implementation details; available for free as part of
the TeX distribution.
Dr Thomas Sederberg, BYU Bézier
curves, http://www.tsplines.com/resources/class_notes/Bezier_curves.pdf
J.D. Foley et al.: Computer Graphics: Principles and Practice in C (2nd ed.,
Addison Wesley, 1992)