ApplicationsComputer graphics
Bézier path in Adobe Illustrator CS2
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, scaling 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 expensive to evaluate. When more complex shapes are needed, low order Bézier curves are patched together. This is commonly referred to as a "path" in programs like Adobe Illustrator or Inkscape. These poly-Bézier curves can also be seen in the SVG file format. To guarantee smoothness, the control point at which two curves meet and one control point on either side must be collinear. 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. AnimationIn animation applications, such as Adobe Flash and Adobe Shockwave, or in applications like Game Maker, Bézier curves are used to outline, for example, movement. Users outline the wanted path in Bézier curves, and the application creates the needed frames for the object to move along the path. Examination of casesLinear Bézier curvesGiven points P0 and P1, a linear Bézier curve is simply a straight line between those two points. The curve is given by and is equivalent to linear interpolation. Quadratic Bézier curvesA quadratic Bézier curve is the path traced by the function B(t), given points P0, P1, and P2, A quadratic Bézier curve is also a parabolic segment. TrueType fonts use Bézier splines composed of quadratic Bézier curves. Cubic Bézier curvesFour points P0, P1, P2 and P3 in the plane or in three-dimensional space define a cubic Bézier curve. The curve starts at P0 going toward P1 and arrives at P3 coming from the direction of P2. Usually, it will not pass through P1 or P2; these points are only there to provide directional information. The distance between P0 and P1 determines "how long" the curve moves into direction P2 before turning towards P3. The parametric form of the curve is: Modern imaging systems like PostScript, Asymptote and Metafont use Bézier splines composed of cubic Bézier curves for drawing curved shapes. GeneralizationThe Bézier curve of degree n can be generalized as follows. Given points P0, P1,..., Pn, the Bézier curve is For example, for n = 5: This formula can be expressed recursively as follows: Let In words, the degree n Bézier curve is a linear interpolation between two degree n − 1 Bézier curves. TerminologySome terminology is associated with these parametric curves. We have where the polynomials are known as Bernstein basis polynomials of degree n, defining t0 = 1 and (1 - t)0 = 1. The points Pi are called control points for the Bézier curve. The polygon formed by connecting the Bézier points with lines, starting with P0 and finishing with Pn, is called the Bézier polygon (or control polygon). The convex hull of the Bézier polygon contains the Bézier curve.
Constructing Bézier curvesLinear curves
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 curved line from P0 to P1. Quadratic curvesFor quadratic Bézier curves one can construct intermediate points Q0 and Q1 such that as t varies from 0 to 1:
Higher-order curvesFor higher-order curves one needs correspondingly more intermediate points. For cubic curves one can construct intermediate points Q0, Q1 & Q2 that describe linear Bézier curves, and points R0 & R1 that describe quadratic Bézier curves:
For fourth-order curves one can construct intermediate points Q0, Q1, Q2 & Q3 that describe linear Bézier curves, points R0, R1 & R2 that describe quadratic Bézier curves, and points S0 & S1 that describe cubic Bézier curves:
(See also a construction of a fifth-order Bezier curve.) Polynomial formSometimes 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 Rational Bézier curvesThe rational Bézier 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. Given n + 1 control points Pi, the rational Bézier curve can be described by: or simply See also
References
External links
| |