Bézier spline
In the mathematical field of numerical analysis and in computer graphics, a Bézier spline is a spline curve where each polynomial of the spline is in Bézier form.
In other words, a Bézier spline is simply a series of Bézier curves joined end to end where the last point of one curve coincides with the starting point of the next curve. Usually cubic Bézier curves are used, and additional control points (called handles) are added to define the shape of each curve. A Bézier spline is similar to a polyline in that it connects a series of points, but whereas in polylines the points are connected by straight lines, in a Bézier spline the points are connected by Bézier curves.
In geometry, a beziergon (also called bezigon or polybezier) is a closed path composed of Bézier curves. It is similar to a polygon in that it connects a set of vertices by lines, but whereas in polygons the vertices are connected by straight lines, in a beziergon the vertices are connected by Bézier curves. [1][2][3]
Perhaps the most common use of Bézier splines is to describe the outline of each letter in a PostScript or PDF file. Such outlines are composed of one beziergon for open letters, or multiple beziergons for closed letters.
Modern vector graphics and computer font systems like PostScript, Asymptote, Metafont, OpenType, and SVG use Bézier splines composed of cubic Bézier curves (3rd order curves) for drawing curved shapes.
TrueType fonts use Bézier splines composed of quadratic Bézier curves (2nd order curves) -- little pieces of parabolas.[4]
A few early digital fonts use polygonal chains—each letter form is composed of what are effectively 1st order Bézier curves—straight lines.
To describe a typical type design as a computer font to any given accuracy, 3rd order splines (a series of 3rd order curves) require less data than 2nd order splines; and 2nd order splines in turn require less data than a series of straight lines.[4] This is true even though any one straight line segment requires less data than any one segment of a parabola; and that parabolic segment in turn requires less data than any one segment of a 3rd order curve.
Definition
Given a spline S of degree n with k knots xi we can write the spline as a Bézier spline as:[citation needed]
where the are the Bernstein basis polynomials of degree and the are the (unique) coefficients according to their linear combination for .
Approximating circular arcs
In case circular arc primitives are not supported in a particular environment, they may be approximated by Bézier curves.[5] Commonly, four cubic segments are used to approximate a circle. It is desirable to find the length of control points which result in the least approximation error.
Using four curves
Considering only the 90-degree unit-circular arc in the first quadrant, we define the endpoints and with control points and , respectively, as:
From the definition of the cubic Bézier curve, we have:
With the point as the midpoint of the arc, we may write the following two equations:
Solving these equations for the x-coordinate (and identically for the y-coordinate) yields:
General case
We may compose a circle of radius from an arbitrary number of cubic Bézier curves.[6] Let the arc start at point and end at point , placed at equal distances above and below the x-axis, spanning an arc of angle :
The control points may be written as:[7]
Examples
-
Eight-segment quadratic Bézier spline (red) approximating a circle (black) with control points
-
Four-segment cubic Bézier spline (red) approximating a circle (black) with control points
References
- ↑ Microsoft polybezier API
- ↑ Papyrus beziergon API reference
- ↑ "A better box of crayons". InfoWorld. 1991.
- ↑ 4.0 4.1 Don Lancaster
- ↑ Stanislav, G. Adam. "Drawing a circle with Bézier Curves". Retrieved 10 April 2010.
- ↑ Riškus, Aleksas (October 2006). "APPROXIMATION OF A CUBIC BEZIER CURVE BY CIRCULAR ARCS AND VICE VERSA". INFORMATION TECHNOLOGY AND CONTROL (Department of Multimedia Engineering, Kaunas University of Technology) 35 (4): 371–378. ISSN 1392-124X.
- ↑ DeVeneza, Richard. "Drawing a circle with Bézier Curves". Retrieved 10 April 2010.
- Koehler; Dr. Ralph. 2D/3D Graphics and Splines with Source Code. ISBN 0-7596-1187-4.