A Bézier curve ( ) is a
parametric curve used in
computer graphics
Computer graphics deals with generating images with the aid of computers. Today, computer graphics is a core technology in digital photography, film, video games, cell phone and computer displays, and many specialized applications. A great de ...
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. The Bézier curve is named after
French
French (french: français(e), link=no) may refer to:
* Something of, from, or related to France
** French language, which originated in France, and its various dialects and accents
** French people, a nation and ethnic group identified with Franc ...
engineer
Pierre Bézier
Pierre Étienne Bézier (1 September 1910 – 25 November 1999; ) was a French engineer and one of the founders of the fields of solid, geometric and physical modelling as well as in the field of representing curves, especially in computer-ai ...
(1910–1999), who used it in the 1960s for designing curves for the bodywork of
Renault
Groupe Renault ( , , , also known as the Renault Group in English; legally Renault S.A.) is a French multinational automobile manufacturer established in 1899. The company produces a range of cars and vans, and in the past has manufactured ...
cars.
Other uses include the design of computer
font
In metal typesetting, a font is a particular size, weight and style of a typeface. Each font is a matched set of type, with a piece (a " sort") for each glyph. A typeface consists of a range of such fonts that shared an overall design.
In mo ...
s and animation.
Bézier curves can be combined to form a
Bézier spline, or generalized to higher dimensions to form
Bézier surfaces.
The
Bézier triangle A Bézier triangle is a special type of Bézier surface that is created by (linear, quadratic, cubic or higher degree) interpolation of control points.
''n''th-order Bézier triangle
A general ''n''th-order Bézier triangle has (''n'' +1)(''n ...
is a special case of the latter.
In
vector graphics
Vector graphics is a form of computer graphics in which visual images are created directly from geometric shapes defined on a Cartesian plane, such as points, lines, curves and polygons. The associated mechanisms may include vector display ...
, 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
rasterized images and are intuitive to modify.
Bézier curves are also used in the time domain, particularly in
animation
Animation is a method by which still figures are manipulated to appear as moving images. In traditional animation, images are drawn or painted by hand on transparent celluloid sheets to be photographed and exhibited on film. Today, most ani ...
,
user interface 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
interface 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.
Invention
The mathematical basis for Bézier curves—the
Bernstein polynomials—was established in 1912, but the
polynomial
In mathematics, a polynomial is an expression consisting of indeterminates (also called variables) and coefficients, that involves only the operations of addition, subtraction, multiplication, and positive-integer powers of variables. An exampl ...
s were not applied to graphics until some 50 years later when mathematician
Paul de Casteljau
Paul de Casteljau (19 November 1930 – 24 March 2022) was a French physicist and mathematician. In 1959, while working at Citroën, he developed an algorithm for evaluating calculations on a certain family of curves, which would later be formali ...
in 1959 developed
de Casteljau's algorithm In the mathematical field of numerical analysis, De Casteljau's algorithm is a recursive method to evaluate polynomials in Bernstein form or Bézier curves, named after its inventor Paul de Casteljau. De Casteljau's algorithm can also be used to s ...
, a
numerically stable method for evaluating the curves, and became the first to apply them to computer-aided design at French automaker
Citroën
Citroën () is a French automobile brand. The "Automobiles Citroën" manufacturing company was founded in March 1919 by André Citroën. Citroën is owned by Stellantis since 2021 and previously was part of the PSA Group after Peugeot acquired 8 ...
.
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
French
French (french: français(e), link=no) may refer to:
* Something of, from, or related to France
** French language, which originated in France, and its various dialects and accents
** French people, a nation and ethnic group identified with Franc ...
engineer
Pierre Bézier
Pierre Étienne Bézier (1 September 1910 – 25 November 1999; ) was a French engineer and one of the founders of the fields of solid, geometric and physical modelling as well as in the field of representing curves, especially in computer-ai ...
, who discovered them independently and used them to design
automobile
A car or automobile is a motor vehicle with wheels. Most definitions of ''cars'' say that they run primarily on roads, seat one to eight people, have four wheels, and mainly transport people instead of goods.
The year 1886 is regarded ...
bodies at
Renault
Groupe Renault ( , , , also known as the Renault Group in English; legally Renault S.A.) is a French multinational automobile manufacturer established in 1899. The company produces a range of cars and vans, and in the past has manufactured ...
.
Specific cases
A Bézier curve is defined by a
set
Set, The Set, SET or SETS may refer to:
Science, technology, and mathematics Mathematics
*Set (mathematics), a collection of elements
*Category of sets, the category whose objects and morphisms are sets and total functions, respectively
Electro ...
of ''
control points'' P
0 through P
''n'', where ''n'' is called the order of the curve (''n'' = 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
affine combinations – that is, the coefficients sum to 1.
Linear Bézier curves
Given distinct points P
0 and P
1, a linear Bézier curve is simply a
line
Line most often refers to:
* Line (geometry), object with zero thickness and curvature that stretches to infinity
* Telephone line, a single-user circuit on a telephone communication system
Line, lines, The Line, or LINE may also refer to:
Art ...
between those two points. The curve is given by
:
and is equivalent to
linear interpolation.
Quadratic Bézier curves
A quadratic Bézier curve is the path traced by the
function B(''t''), given points P
0, P
1, and P
2,
:
,
which can be interpreted as the
linear interpolant of corresponding points on the linear Bézier curves from P
0 to P
1 and from P
1 to P
2 respectively. Rearranging the preceding equation yields:
:
This can be written in a way that highlights the symmetry with respect to P
1:
:
Which immediately gives the
derivative
In mathematics, the derivative of a function of a real variable measures the sensitivity to change of the function value (output value) with respect to a change in its argument (input value). Derivatives are a fundamental tool of calculus. ...
of the Bézier curve with respect to ''t'':
:
from which it can be concluded that the
tangent
In geometry, the tangent line (or simply tangent) to a plane curve at a given point is the straight line that "just touches" the curve at that point. Leibniz defined it as the line through a pair of infinitely close points on the curve. Mo ...
s to the curve at P
0 and P
2 intersect at P
1. As ''t'' increases from 0 to 1, the curve departs from P
0 in the direction of P
1, then bends to arrive at P
2 from the direction of P
1.
The second derivative of the Bézier curve with respect to ''t'' is
:
Cubic Bézier curves
Four points P
0, P
1, P
2 and P
3 in the plane or in higher-dimensional space define a cubic Bézier curve.
The curve starts at P
0 going toward P
1 and arrives at P
3 coming from the direction of P
2. Usually, it will not pass through P
1 or P
2; these points are only there to provide directional information. The distance between P
1 and P
2 determines "how far" and "how fast" the curve moves towards P
1 before turning towards P
2.
Writing B
P''i'',P''j'',P''k''(''t'') for the quadratic Bézier curve defined by points P
''i'', P
''j'', and P
''k'', 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 P
1 and P
2 the curve may intersect itself, or contain a
cusp.
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 ''t'' = 1/3 and ''t'' = 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 ''t'' is
:
The second derivative of the Bézier curve with respect to ''t'' is
:
General definition
Bézier curves can be defined for any degree ''n''.
Recursive definition
A recursive definition for the Bézier curve of degree ''n'' expresses it as a point-to-point
linear combination (
linear interpolation) of a pair of corresponding points in two Bézier curves of degree ''n'' − 1.
Let
denote the Bézier curve determined by any selection of points P
0, P
1, ..., P
''k''. Then to start,
:
:
This recursion is elucidated in the
animations below.
Explicit definition
The formula can be expressed explicitly as follows (where t
0 and (1-t)
0 are extended continuously to be 1 throughout
,1:
:
where
are the
binomial coefficient
In mathematics, the binomial coefficients are the positive integers that occur as coefficients in the binomial theorem. Commonly, a binomial coefficient is indexed by a pair of integers and is written \tbinom. It is the coefficient of the t ...
s.
For example, when ''n'' = 5:
:
Terminology
Some terminology is associated with these parametric curves. We have
:
where the polynomials
:
are known as
Bernstein basis polynomials of degree ''n''.
Note that ''t''
0 = 1, (1 − ''t'')
0 = 1, and that the
binomial coefficient
In mathematics, the binomial coefficients are the positive integers that occur as coefficients in the binomial theorem. Commonly, a binomial coefficient is indexed by a pair of integers and is written \tbinom. It is the coefficient of the t ...
,
, is:
:
The points P
''i'' are called ''control points'' for the Bézier curve. The
polygon
In geometry, a polygon () is a plane figure that is described by a finite number of straight line segments connected to form a closed '' polygonal chain'' (or ''polygonal circuit''). The bounded plane region, the bounding circuit, or the two ...
formed by connecting the Bézier points with
lines, starting with P
0 and finishing with P
''n'', is called the ''Bézier polygon'' (or ''control polygon''). The
convex hull
In geometry, the convex hull or convex envelope or convex closure of a shape is the smallest convex set that contains it. The convex hull may be defined either as the intersection of all convex sets containing a given subset of a Euclidean space ...
of the Bézier polygon contains the Bézier curve.
Polynomial form
Sometimes it is desirable to express the Bézier curve as a
polynomial
In mathematics, a polynomial is an expression consisting of indeterminates (also called variables) and coefficients, that involves only the operations of addition, subtraction, multiplication, and positive-integer powers of variables. An exampl ...
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
In the mathematical subfield of numerical analysis, numerical stability is a generally desirable property of numerical algorithms. The precise definition of stability depends on the context. One is numerical linear algebra and the other is algorit ...
(
de Casteljau's algorithm In the mathematical field of numerical analysis, De Casteljau's algorithm is a recursive method to evaluate polynomials in Bernstein form or Bézier curves, named after its inventor Paul de Casteljau. De Casteljau's algorithm can also be used to s ...
should be used if this occurs). Note that the
empty product is 1.
Properties
* The curve begins at P
0 and ends at P
''n''; this is the so-called ''endpoint interpolation'' property.
* The curve is a line
if and only if
In logic and related fields such as mathematics and philosophy, "if and only if" (shortened as "iff") is a biconditional logical connective between statements, where either both statements are true or both are false.
The connective is bic ...
all the control points are
collinear.
* The start and end of the curve is
tangent
In geometry, the tangent line (or simply tangent) to a plane curve at a given point is the straight line that "just touches" the curve at that point. Leibniz defined it as the line through a pair of infinitely close points on the curve. Mo ...
to the first and last section of the Bézier polygon, respectively.
* A curve can be split at any point into two subcurves, or into arbitrarily many subcurves, each of which is also a Bézier curve.
* Some curves that seem simple, such as the
circle
A circle is a shape consisting of all points in a plane that are at a given distance from a given point, the centre. Equivalently, it is the curve traced out by a point that moves in a plane so that its distance from a given point is cons ...
, cannot be described exactly by a Bézier or
piecewise
In mathematics, a piecewise-defined function (also called a piecewise function, a hybrid function, or definition by cases) is a function defined by multiple sub-functions, where each sub-function applies to a different interval in the domain. P ...
Bézier curve; though a four-piece cubic Bézier curve can approximate a circle (see
composite Bézier curve
In geometric modelling and in computer graphics, a composite Bézier curve or Bézier spline is a spline made out of Bézier curves that is at least C^0 continuous. In other words, a composite Bézier curve is a series of Bézier curves joined ...
), with a maximum radial error of less than one part in a thousand, when each inner control point (or offline point) is the distance
horizontally or vertically from an outer control point on a unit circle. More generally, an ''n''-piece cubic Bézier curve can approximate a circle, when each inner control point is the distance
from an outer control point on a unit circle, where ''t'' is 360/''n'' degrees, and ''n'' > 2.
* Every quadratic Bézier curve is also a cubic Bézier curve, and more generally, every degree ''n'' Bézier curve is also a degree ''m'' curve for any ''m'' > ''n''. In detail, a degree ''n'' curve with control points P
0, ..., P
''n'' is equivalent (including the parametrization) to the degree ''n'' + 1 curve with control points P'
0, ..., P'
''n'' + 1, where
.
* Bézier curves have the
variation diminishing property. What this means in intuitive terms is that a Bézier curve does not "undulate" more than the polygon of its control points, and may actually "undulate" less than that.
* There is no
local control
Local may refer to:
Geography and transportation
* Local (train), a train serving local traffic demand
* Local, Missouri, a community in the United States
* Local government, a form of public administration, usually the lowest tier of administrat ...
in degree ''n'' Bézier curves—meaning that any change to a control point requires recalculation of and thus affects the aspect of the entire curve, "although the further that one is from the control point that was changed, the smaller is the change in the curve."
* A Bézier curve of order higher than two may intersect itself or have a
cusp for certain choices of the control points.
Second-order curve is a parabolic segment
A quadratic Bézier curve is also a segment of a
parabola
In mathematics, a parabola is a plane curve which is mirror-symmetrical and is approximately U-shaped. It fits several superficially different mathematical descriptions, which can all be proved to define exactly the same curves.
One descri ...
. As a parabola is a
conic section
In mathematics, a conic section, quadratic curve or conic is a curve obtained as the intersection of the surface of a cone with a plane. The three types of conic section are the hyperbola, the parabola, and the ellipse; the circle 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:
# Tangents to the parabola at the endpoints of the curve (A and B) intersect at its control point (C).
# If D is the midpoint of AB, the tangent to the curve which is ]perpendicular
In elementary geometry, two geometric objects are perpendicular if they intersect at a right angle (90 degrees or π/2 radians). The condition of perpendicularity may be represented graphically using the '' perpendicular symbol'', ⟂. It c ...
to CD (dashed cyan line) defines its vertex (V). Its axis of symmetry (dash-dot cyan) passes through V and is perpendicular to the tangent.
# E is either point on the curve with a tangent at 45° to CD (dashed green). If G is the intersection of this tangent and the axis, the line passing through G and perpendicular to CD is the directrix (solid green).
# The focus (F) is at the intersection of the axis and a line passing through E and perpendicular to CD (dotted yellow). The latus rectum is the line segment within the curve (solid yellow).
Derivative
The derivative for a curve of order ''n'' is
:
Constructing Bézier curves
Linear 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 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:
* Point Q0(''t'') varies from P0 to P1 and describes a linear Bézier curve.
* Point Q1(''t'') varies from P1 to P2 and describes a linear Bézier curve.
* Point B(''t'') is interpolated linearly between Q0(''t'') to Q1(''t'') and describes a quadratic Bézier curve.
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 and R1 that describe quadratic Bézier curves:
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:
For fifth-order curves, one can construct similar intermediate points.
These representations rest on the process used in De Casteljau's algorithm In the mathematical field of numerical analysis, De Casteljau's algorithm is a recursive method to evaluate polynomials in Bernstein form or Bézier curves, named after its inventor Paul de Casteljau. De Casteljau's algorithm can also be used to s ...
to calculate Bézier curves.
Offsets (or stroking) of Bézier curves
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
A railway track (British English and UIC terminology) or railroad track (American English), also known as permanent way or simply track, is the structure on a railway or railroad consisting of the rails, fasteners, railroad ties (sleepers, ...
), 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
In mathematics, an affine algebraic plane curve is the zero set of a polynomial in two variables. A projective algebraic plane curve is the zero set in a projective plane of a homogeneous polynomial in three variables. An affine algebraic plane ...
and more generally for a Bézier of degree ''n'' the two-sided offset curve is an algebraic curve of degree 4''n'' − 2. However, there are heuristic
A heuristic (; ), or heuristic technique, is any approach to problem solving or self-discovery that employs a practical method that is not guaranteed to be optimal, perfect, or rational, but is nevertheless sufficient for reaching an immediate ...
methods that usually give an adequate approximation for practical purposes.
In the field of vector graphics
Vector graphics is a form of computer graphics in which visual images are created directly from geometric shapes defined on a Cartesian plane, such as points, lines, curves and polygons. The associated mechanisms may include vector display ...
, painting two symmetrically distanced offset curves is called ''stroking'' (the Bézier curve or in general a path of several Bézier segments). The conversion from offset curves to filled Bézier contours is of practical importance in converting font
In metal typesetting, a font is a particular size, weight and style of a typeface. Each font is a matched set of type, with a piece (a " sort") for each glyph. A typeface consists of a range of such fonts that shared an overall design.
In mo ...
s 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.
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, systems that can only work with cubic Bézier curves can implicitly work with quadratic curves by using their equivalent cubic representation.
To do degree elevation, we use the equality Each component is multiplied by (1 − ''t'') and ''t'', thus increasing a degree by one, without changing the value. Here is the example of increasing degree from 2 to 3.
:
For arbitrary ''n'' we use equalities
:
Therefore:
:
introducing arbitrary and .
Therefore, new control points are
:
Repeated degree elevation
The concept of degree elevation can be repeated on a control polygon R to get a sequence of control polygons R, R1, R2, and so on. After ''r'' degree elevations, the polygon R''r'' has the vertices P0,''r'', P1,''r'', P2,''r'', ..., P''n''+''r'',''r'' given by
:
It can also be shown that for the underlying Bézier curve ''B'',
:
Rational Bézier curves
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 section
In mathematics, a conic section, quadratic curve or conic is a curve obtained as the intersection of the surface of a cone with a plane. The three types of conic section are the hyperbola, the parabola, and the ellipse; the circle is a ...
s exactly, including circular arcs.
Given ''n'' + 1 control points P0, ..., P''n'', the rational Bézier curve can be described by
:
or simply
:
The expression can be extended by using number systems besides reals for the weights. In the complex plane
In mathematics, the complex plane is the plane formed by the complex numbers, with a Cartesian coordinate system such that the -axis, called the real axis, is formed by the real numbers, and the -axis, called the imaginary axis, is formed by the ...
the points , , and with weights , , and generate a full circle with radius one. For curves with points and weights on a circle, the weights can be scaled without changing the curve's shape. Scaling the central weight of the above curve by 1.35508 gives a more uniform parameterization.
Applications
Computer graphics
Bézier curves are widely used in computer graphics to model smooth curves. As the curve is completely contained in the convex hull
In geometry, the convex hull or convex envelope or convex closure of a shape is the smallest convex set that contains it. The convex hull may be defined either as the intersection of all convex sets containing a given subset of a Euclidean space ...
of its control points, the points can be graphically displayed and used to manipulate the curve intuitively. Affine transformation
In Euclidean geometry, an affine transformation or affinity (from the Latin, ''affinis'', "connected with") is a geometric transformation that preserves lines and parallelism, but not necessarily Euclidean distances and angles.
More generall ...
s such as translation
Translation is the communication of the meaning of a source-language text by means of an equivalent target-language text. The English language draws a terminological distinction (which does not exist in every language) between ''transla ...
and rotation
Rotation, or spin, is the circular movement of an object around a '' central axis''. A two-dimensional rotating object has only one possible central axis and can rotate in either a clockwise or counterclockwise direction. A three-dimensional ...
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 composite Bézier curve
In geometric modelling and in computer graphics, a composite Bézier curve or Bézier spline is a spline made out of Bézier curves that is at least C^0 continuous. In other words, a composite Bézier curve is a series of Bézier curves joined ...
. A composite Bézier curve is commonly referred to as a "path" in vector graphics
Vector graphics is a form of computer graphics in which visual images are created directly from geometric shapes defined on a Cartesian plane, such as points, lines, curves and polygons. The associated mechanisms may include vector display ...
languages (like PostScript
PostScript (PS) is a page description language in the electronic publishing and desktop publishing realm. It is a dynamically typed, concatenative programming language. It was created at Adobe Systems by John Warnock, Charles Geschke, Do ...
), vector graphics standards (like SVG
Scalable Vector Graphics (SVG) is an XML-based vector image format for defining two-dimensional graphics, having support for interactivity and animation. The SVG specification is an open standard developed by the World Wide Web Consortium s ...
) and vector graphics programs (like Artline, Timeworks Publisher, Adobe Illustrator
Adobe Illustrator is a vector graphics editor and design program developed and marketed by Adobe Inc. Originally designed for the Apple Macintosh, development of Adobe Illustrator began in 1985. Along with Creative Cloud (Adobe's shift to month ...
, CorelDraw
CorelDRAW is a vector graphics editor developed and marketed by Corel Corporation. It is also the name of the Corel graphics suite, which includes the bitmap-image editor Corel Photo-Paint as well as other graphics-related programs (see below) ...
, Inkscape
Inkscape is a free and open-source vector graphics editor used to create vector images, primarily in Scalable Vector Graphics (SVG) format. Other formats can be imported and exported.
Inkscape can render primitive vector shapes (e.g. rec ...
, and Allegro
Allegro may refer to:
Common meanings
* Allegro (music), a tempo marking indicate to play fast, quickly and bright
* Allegro (ballet), brisk and lively movement
Artistic works
* L'Allegro (1645), a poem by John Milton
* ''Allegro'' (Satie), an ...
). In order to join Bézier curves into a composite Bézier curve without kinks, a property called ''G1 continuous'', it suffices to force the control point at which two constituent Bézier curves meet to lie on the line defined by the two control points on either side.
The simplest method for scan converting (rasterizing
In computer graphics, rasterisation (British English) or rasterization (American English) is the task of taking an image described in a vector graphics format (shapes) and converting it into a raster image (a series of pixels, dots or lines, wh ...
) 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 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 Bézier is intersected with each scan line involve finding roots
A root is the part of a plant, generally underground, that anchors the plant body, and absorbs and stores water and nutrients.
Root or roots may also refer to:
Art, entertainment, and media
* ''The Root'' (magazine), an online magazine focusing ...
of cubic polynomials (for cubic Béziers) and dealing with multiple roots, so they are not often used in practice.
The rasterisation algorithm used in Metafont is based on discretising the curve, so that it is approximated by a sequence of " rook moves" that are purely vertical or purely horizontal, along the pixel boundaries. To that end, the plane is first split into eight 45° sectors (by the coordinate axes and the two lines ), then the curve is decomposed into smaller segments such that the ''direction'' of a curve segment stays within one sector; since the curve velocity is a second degree polynomial, finding the values where it is parallel to one of these lines can be done by solving quadratic equation
In algebra, a quadratic equation () is any equation that can be rearranged in standard form as
ax^2 + bx + c = 0\,,
where represents an unknown value, and , , and represent known numbers, where . (If and then the equation is linear, not qu ...
s. Within each segment, either horizontal or vertical movement dominates, and the total number of steps in either direction can be read off from the endpoint coordinates; in for example the 0–45° sector horizontal movement to the right dominates, so it only remains to decide between which steps to the right the curve should make a step up.
There is also a modified curve form of Bresenham's line drawing algorithm by Zingl that performs this rasterization by subdividing the curve into rational pieces and calculating the error at each pixel location such that it either travels at a 45° angle or straight depending on compounding error as it iterates through the curve. This reduces the next step calculation to a series of integer
An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign ( −1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the languag ...
additions and subtractions.[Zingl, Alois "A Rasterizing Algorithm for Drawing Curves" (2012) http://members.chello.at/~easyfilter/Bresenham.pdf]
Animation
In animation applications, such as Adobe Flash
Adobe Flash (formerly Macromedia Flash and FutureSplash) is a multimedia software platform used for production of animations, rich web applications, desktop applications, mobile apps, mobile games, and embedded web browser video players. Flash ...
and Synfig, 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.
In 3D animation, Bézier curves are often used to define 3D paths as well as 2D curves for keyframe interpolation. Bézier curves are now very frequently used to control the animation easing in CSS
Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation of a document written in a markup language such as HTML or XML (including XML dialects such as SVG, MathML or XHTML). CSS is a cornerstone technolo ...
, JavaScript
JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of websites use JavaScript on the client side for webpage behavior, of ...
, JavaFx
JavaFX is a software platform for creating and delivering desktop applications, as well as rich web applications that can run across a wide variety of devices. JavaFX has support for desktop computers and web browsers on Microsoft Windows, Linu ...
and Flutter SDK.
Fonts
TrueType
TrueType is an outline font standard developed by Apple in the late 1980s as a competitor to Adobe's Type 1 fonts used in PostScript. It has become the most common format for fonts on the classic Mac OS, macOS, and Microsoft Windows operating ...
fonts use composite Bézier curves composed of quadratic Bézier curves. Other languages and imaging tools (such as PostScript
PostScript (PS) is a page description language in the electronic publishing and desktop publishing realm. It is a dynamically typed, concatenative programming language. It was created at Adobe Systems by John Warnock, Charles Geschke, Do ...
, Asymptote
In analytic geometry, an asymptote () of a curve is a line such that the distance between the curve and the line approaches zero as one or both of the ''x'' or ''y'' coordinates tends to infinity. In projective geometry and related context ...
, Metafont, and SVG
Scalable Vector Graphics (SVG) is an XML-based vector image format for defining two-dimensional graphics, having support for interactivity and animation. The SVG specification is an open standard developed by the World Wide Web Consortium s ...
) use composite Béziers composed of cubic Bézier curves for drawing curved shapes. OpenType
OpenType is a format for scalable computer fonts. It was built on its predecessor TrueType, retaining TrueType's basic structure and adding many intricate data structures for prescribing typographic behavior. OpenType is a registered trademark ...
fonts can use either kind of curve, depending on which font technology underlies the OpenType wrapper.
The internal rendering of all Bézier curves in font or vector graphics renderers will split them recursively up to the point where the curve is flat enough to be drawn as a series of linear or circular segments. The exact splitting algorithm is implementation dependent, only the flatness criteria must be respected to reach the necessary precision and to avoid non-monotonic local changes of curvature. The "smooth curve" feature of charts in Microsoft Excel
Microsoft Excel is a spreadsheet developed by Microsoft for Microsoft Windows, Windows, macOS, Android (operating system), Android and iOS. It features calculation or computation capabilities, graphing tools, pivot tables, and a macro (comp ...
also uses this algorithm.
Because arcs of circles and ellipse
In mathematics, an ellipse is a plane curve surrounding two focal points, such that for all points on the curve, the sum of the two distances to the focal points is a constant. It generalizes a circle, which is the special type of ellipse in ...
s 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
Non-uniform rational basis spline (NURBS) is a mathematical model using B-spline, basis splines (B-splines) that is commonly used in computer graphics for representing curves and Surface (mathematics), surfaces. It offers great flexibility and pr ...
, that can be rendered incrementally without first splitting the curve recursively to reach the necessary flatness condition. This approach also preserves 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 using a process known as font rasterization.
Robotics
Bézier curves can be used in robotics to produce trajectories of an end-effector due to the virtue of the control polygon’s ability to give a clear indication of whether the path is colliding with any nearby obstacle or object. Furthermore, joint space trajectories can be accurately differentiated using Bézier curves. Consequently, the derivatives of joint space trajectories are used in the calculation of the dynamics and control effort (torque profiles) of the robotic manipulator.
See also
* Bézier surface
* B-spline
In the mathematical subfield of numerical analysis, a B-spline or basis spline is a spline function that has minimal support with respect to a given degree, smoothness, and domain partition. Any spline function of given degree can be expresse ...
* GEM/4 & GEM/5
* Hermite curve
* NURBS
Non-uniform rational basis spline (NURBS) is a mathematical model using B-spline, basis splines (B-splines) that is commonly used in computer graphics for representing curves and Surface (mathematics), surfaces. It offers great flexibility and pr ...
* String art
__notoc__
String art or pin and thread art, is characterized by an arrangement of colored thread strung between points to form geometric patterns or representational designs such as a ship's sails, sometimes with other artist material comprisin ...
– 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
References
Citations
Sources
*
*
* Excellent discussion of implementation details; available for free as part of the TeX distribution.
*
*
*
Further reading
A Primer on Bézier Curves
an open source online book explaining Bézier curves and associated graphics algorithms, with interactive graphics
Cubic Bezier Curves – Under the Hood (video)
video showing how computers render a cubic Bézier curve, by Peter Nowell
Feature Column from American Mathematical Society
The American Mathematical Society (AMS) is an association of professional mathematicians dedicated to the interests of mathematical research and scholarship, and serves the national and international community through its publications, meeting ...
*
*
* This book is out of print and freely available from the author.
*
*
* (60 pages)
*
*
*
* Hovey, Chad (2022). Formulation and Python Implementation of Bézier and B-Spline Geometry
SAND2022-7702C
(153 pages)
External links
; Computer code
TinySpline: Open source C-library for NURBS, B-splines and Bézier curves with bindings for various languages
C++ library to generate Bézier functions at compile time
Simple Bézier curve implementation via recursive method in Python
{{DEFAULTSORT:Bezier curve
Graphic design
Interpolation
Curves
Design