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
C0
C1
C2
A continuous composite Bézier is also called a polybezier, by similarity to polyline, but whereas in polylines the points are connected by straight lines, in a polybezier the points are connected by Bézier curves. A beziergon (also called bezigon) 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.[2] [3] [4] Some authors even call a
C0
Perhaps the most common use of composite Béziers 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 composite Bézier curves composed of cubic Bézier curves (3rd order curves) for drawing curved shapes.
A commonly desired property of splines is for them to join their individual curves together with a specified level of parametric or geometric continuity. While individual curves in the spline are fully
Cinfin
The Bézier spline is fairly unique in that it's one of the few splines that doesn't guarantee any higher degree of continuity than
C0
Given two cubic Bézier curves with control points
[P0,P1,P2,P3]
[P3,P4,P5,P6]
P3
C0/G0
P3
C1
P4=2P3-P2
G1
C1
\beta1
P4=P3+(P3-P2)\beta1
While the following continuity constraints are possible, they are rarely used with cubic Bézier splines, as other splines like the B-spline or the β-spline[7] will naturally handle higher constraints without loss of local control.
C2
P5=P1+4(P3-P2)
C2
C2
G2
P5=P3+(P3-P2)(2\beta1+\beta
2+\beta | |
2/2)+(P |
1-P2)\beta
2 | |
1 |
C2
\beta1
\beta2
C3
P6=P3+(P3-P0)+6(P1-P2+P3-P2)
C3
Cinfin
In case circular arc primitives are not supported in a particular environment, they may be approximated by Bézier curves.[9] Commonly, eight quadratic segments[10] or four cubic segments are used to approximate a circle. It is desirable to find the length
k
Considering only the 90-degree unit-circular arc in the first quadrant, we define the endpoints
A
B
A'
B'
\begin{align} A&=[0,1]\\ A'&=[k,1]\\ B'&=[1,k]\\ B&=[1,0]\\ \end{align}
From the definition of the cubic Bézier curve, we have:
C(t)=(1-t)3A+3(1-t)2tA'+3(1-t)t2B'+t3B
With the point
C(t=0.5)
\begin{align} C&=
1 | |
8 |
A+
3 | A'+ | |
8 |
3 | B'+ | |
8 |
1 | |
8 |
B\\ C&=\sqrt{1/2}=\sqrt{2}/2 \end{align}
Solving these equations for the x-coordinate (and identically for the y-coordinate) yields:
0 | + | |
8 |
3 | k+ | |
8 |
3 | |
8 |
+
1 | |
8 |
=\sqrt{2}/2
k=
4 | |
3 |
(\sqrt{2}-1) ≈ 0.5522847498
Note however that the resulting Bézier curve is entirely outside the circle, with a maximum deviation of the radius of about 0.00027.By adding a small correction to intermediate points such as
\begin{align} A'&=[k+0.0009,1-0.00103]\\ B'&=[1-0.00103,k+0.0009], \end{align}
the magnitude of the radius deviation to 1 is reduced by a factor of about 3, to 0.000068 (at the expense of the derivability of the approximated circle curve at endpoints).
We may approximate a circle of radius
R
A
B
\theta=2\phi
\begin{align} Ax&=R\cos(\phi)\\ Ay&=R\sin(\phi)\\ Bx&=Ax\\ By&=-Ay \end{align}
The control points may be written as:[11]
\begin{align} A'x&=
4R-Ax | |
3 |
\\ A'y&=
(R-Ax)(3R-Ax) | |
3Ay |
\\ B'x&=A'x\\ B'y&=-A'y \end{align}
TrueType fonts use composite Béziers composed of quadratic Bézier curves (2nd order curves). To describe a typical type design as a computer font to any given accuracy, 3rd order Beziers require less data than 2nd order Beziers; and these in turn require less data than a series of straight lines. 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.