Curve used in computer graphics and related fields
A ( ) is a used in and related fields. A set of discrete "control points" defines a smooth, continuous curve by means of a formula. Usually the curve is intended to approximate a real-world shape that otherwise has no mathematical representation or whose representation is unknown or too complicated. Bézier curve is named after engineer , who used it in the 1960s for designing curves for the bodywork of cars. Other uses include the design of computer and animation. Bézier curves can be combined to form a , or generalized to higher dimensions to form . The is a special case of the latter.
In , Bézier curves are used to model smooth curves that can be scaled indefinitely. "Paths", as they are commonly referred to in image manipulation programs, are combinations of linked Bézier curves. Paths are not bound by the limits of images and are intuitive to modify.
Bézier curves are also used in the time domain, particularly in , design and smoothing cursor trajectory in eye gaze controlled interfaces. For example, a Bézier curve can be used to specify the velocity over time of an object such as an icon moving from A to B, rather than simply moving at a fixed number of pixels per step. When animators or designers talk about the "physics" or "feel" of an operation, they may be referring to the particular Bézier curve used to control the velocity over time of the move in question.
This also applies to robotics where the motion of a welding arm, for example, should be smooth to avoid unnecessary wear.
The mathematical basis for Bézier curves—the —was established in 1912, but the were not applied to graphics until some 50 years later when mathematician in 1959 developed , a method for evaluating the curves, and became the first to apply them to computer-aided design at French automaker . Yet, de Casteljau's method was patented in France but not published until the 1980s while the Bézier polynomials were widely publicised in the 1960s by the engineer , who discovered them independently and used them to design bodies at .
A Bézier curve is defined by a of through , where is called the order of the curve ( = 1 for linear, 2 for quadratic, 3 for cubic, etc.). The first and last control points are always the endpoints of the curve; however, the intermediate control points (if any) generally do not lie on the curve. The sums in the following sections are to be understood as – that is, the coefficients sum to 1.
Given distinct points and , a linear Bézier curve is simply a between those two points. The curve is given by
and is equivalent to .
A quadratic Bézier curve is the path traced by the (), given points , , and ,
which can be interpreted as the of corresponding points on the linear Bézier curves from to and from to respectively. Rearranging the preceding equation yields:
This can be written in a way that highlights the symmetry with respect to :
Which immediately gives the of the Bézier curve with respect to :
from which it can be concluded that the to the curve at and intersect at . As increases from 0 to 1, the curve departs from in the direction of , then bends to arrive at from the direction of .
The second derivative of the Bézier curve with respect to is
Four points , , and in the plane or in higher-dimensional space define a cubic Bézier curve.
The curve starts at going toward and arrives at coming from the direction of . Usually, it will not pass through or ; these points are only there to provide directional information. The distance between and determines "how far" and "how fast" the curve moves towards before turning towards .
Writing () for the quadratic Bézier curve defined by points , , and , the cubic Bézier curve can be defined as an affine combination of two quadratic Bézier curves:
The explicit form of the curve is:
For some choices of and the curve may intersect itself, or contain a .
Any series of 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 the points along the curve corresponding to = 1/3 and = 2/3, the control points for the original Bézier curve can be recovered.
The derivative of the cubic Bézier curve with respect to is
The second derivative of the Bézier curve with respect to is
Bézier curves can be defined for any degree .
A recursive definition for the Bézier curve of degree expresses it as a point-to-point () of a pair of corresponding points in two Bézier curves of degree − 1.
Let denote the Bézier curve determined by any selection of points , , ..., . Then to start,
This recursion is elucidated in the .
The formula can be expressed explicitly as follows (where t and (1-t) are extended continuously to be 1 throughout [0,1]):
where are the .
For example, when = 5:
Some terminology is associated with these parametric curves. We have
where the polynomials
are known as of degree .
Note that = 1, (1 − ) = 1, and that the , , is:
The points are called for the Bézier curve. The formed by connecting the Bézier points with , starting with and finishing with , is called the (or ). The of the Bézier polygon contains the Bézier curve.
Sometimes it is desirable to express the Bézier curve as a instead of a sum of less straightforward . Application of the 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 ( should be used if this occurs). Note that the is 1.
A quadratic Bézier curve is also a segment of a . As a parabola is a , some sources refer to quadratic Béziers as "conic arcs". With reference to the figure on the right, the important features of the parabola can be derived as follows:
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.
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 and R1 that describe quadratic Bézier curves:
Construction of a cubic Bézier curve
Animation of a cubic Bézier curve, t in [0,1]
For fourth-order curves one can construct intermediate points Q0, Q1, Q2 and Q3 that describe linear Bézier curves, points R0, R1 and R2 that describe quadratic Bézier curves, and points S0 and S1 that describe cubic Bézier curves:
Construction of a quartic Bézier curve
Animation of a quartic Bézier curve, t in [0,1]
For fifth-order curves, one can construct similar intermediate points.
Animation of a fifth-order Bézier curve, t in [0,1] in red. The Bézier curves for each of the lower orders are also shown.
The curve at a fixed offset from a given Bézier curve, called an offset or parallel curve in mathematics (lying "parallel" to the original curve, like the offset between rails in a railroad track), cannot be exactly formed by a Bézier curve (except in some trivial cases). In general, the two-sided offset curve of a cubic Bézier is a 10th-order algebraic curve[14] and more generally for a Bézier of degree n the two-sided offset curve is an algebraic curve of degree 4n−2.[15] However, there are heuristic methods that usually give an adequate approximation for practical purposes.[16]
In the field of vector graphics, painting two symmetrically distanced offset curves is called stroking (the Bézier curve or in general a path of several Bézier segments).[14] The conversion from offset curves to filled Bézier contours is of practical importance in converting fonts defined in Metafont, which require stroking of Bézier curves, to the more widely used PostScript type 1 fonts, which only require (for efficiency purposes) the mathematically simpler operation of filling a contour defined by (non-self-intersecting) Bézier curves.[17]
, particularly p. 16 "taxonomy of offset curves".
Parts 19–22 of
Excellent discussion of implementation details; available for free as part of the TeX distribution.
This book is out of print and freely available from the author.