Fork me on GitHub
Math for the people, by the people.

User login

Bézier curve

% this is the default PlanetMath preamble.  as your knowledge
% of TeX increases, you will probably want to edit this, but
% it should be fine as is for beginners.

% almost certainly you want these

% used for TeXing text within eps files
% need this for including graphics (\includegraphics)
% for neatly defining theorems and propositions
% making logically defined graphics

% there are many more packages, add them here as you need them

% define commands here

B\'ezier curves are a particular family of curves in $\mathbb{R}^m$
that parameterize a smooth path \PMlinkescapetext{between} given points.
They are often used to model or approximate general curved shapes 
because of their algebraic simplicity.

B\'ezier curves were originally developed by Paul de Casteljau in 1959. But it became a famous shape only when Pierre B\'ezier, a French engineer at Renault, used it to \PMlinkescapetext{design} automobiles in the 1970's. 
They are now widely used in many \PMlinkescapetext{fields} such as industrial and computer-aided \PMlinkescapetext{design}, 
vector-based drawing, font design, and 3D modeling.

Given $n+1$ points $\mathbf{P}_i$ in $\mathbb{R}^m$,
the \emph{B\'ezier curve} for these \emph{control points} is the curve $\mathbf{B} \colon [0,1] \to \mathbb{R}^m$
defined by
\mathbf{B}(t) = \sum_{i=0}^{n} \binom{n}{i} (1-t)^{n-i} \, t^i \: \mathbf{P}_i\,.
The coefficients in this expression:
b_{i,n}(t) = \binom{n}{i} (1-t)^{n-i} \, t^i \,, \quad  i=0,\ldots, n\,.
are the Bernstein basis polynomials.

\section{Special cases}
A B\'ezier curve between two control points is simply the line segment
between the two points:
\mathbf{B}(t) = (1-t) \, \mathbf{P}_0  +  t \, \mathbf{P}_1\,.

For three control points, we have the quadratic B\'ezier curve:
\mathbf{B}(t) = (1-t)^2 \, \mathbf{P}_0  +  2 t (1-t) \, \mathbf{P}_1 +  t^2 \, \mathbf{P}_2\,.

For four control points, we have the cubic B\'ezier curve:
\mathbf{B}(t) =  (1-t)^3 \, \mathbf{P}_0 +  3 t (1-t)^2 \, \mathbf{P}_1 + 3 t^2 (1-t) \, \mathbf{P}_2 + t^3\,  \mathbf{P}_3\,.

These are the most commonly employed versions of B\'ezier curves.


\item Except for the first and the last points, where the curve starts and ends, the B\'ezier curve should not pass through any of the control points. i.e. all the controls points lie on the curve if and only if the curve is a straight line.

\item The curve is tangent to the segment of line $\overline{\mathbf{P}_0 \, \mathbf{P}_1}$ at the start and $\overline{\mathbf{P}_{n-1} \, \mathbf{P}_n}$ at the end.

\item It is easy to keep until the first order continuity when chaining curves. Moreover, every B\'ezier curve can be cut at any point into two new B\'ezier curves. In fact, the \PMlinkescapetext{design} industry uses series of B\'ezier curves with only 4 control points (a bicubic version of the equations) to draw complex shapes.

\item The curves never do fancy stuff and always remain within the convex hull of the control points.

\item For one and two points the definition is still valid and the result became a point and a segment of line, respectively.

\item But it is impossible to draw circles or arcs of circle.

\item It is also impossible to draw two parallel curves (except in trivial cases: straight line B\'eziers and coincident B\'eziers curves)

\item If the first and the last point are the same, the curve is closed. And if $\mathbf{P}_1$ and $\mathbf{P}_{n-1}$ are aligned with $\mathbf{P}_0$ then the curve is closed with a first order continuity.


\section{Curve Cut}

Let $\mathbf{B}_p(t)$ be a Bezier curve, defined by its control points $\mathbf{P}_0$ to $\mathbf{P}_{n}$ for $t \in [0,1]$.

Let $a, b$ be such as $[a,b] \subset [0,1]$
Let $u = {{t - a} \over {b - a}}$ be such as $\forall u \in [0,1], t \in [a,b]$

$\mathbf{B}_q(u)$ is a part of the initial bezier curve with new control points $\mathbf{Q}_{0}$
to $\mathbf{Q}_{n}$ whose \PMlinkescapetext{coordinates} will be determined.

For $n$ control points $\mathbf{B}(t)$ is a $n-1$-order polynom.

$\mathbf{B}_p(a) = \mathbf{B}_q(0)$

$\mathbf{B}_p(b) = \mathbf{B}_q(1)$

Let take $n-2$ more points, evenly spaced in [a,b]
$u_i = k / {n-1} \forall k \in [1 .. n-1]$

$\mathbf{B}_p(u (b - a) + a) = \mathbf{B}_q(u_i)$ for each $u_i$

For a 4 control points bezier curve
If we take $u$ in $(0, {1 \over 3}, {2 \over 3}, 1)$, hence $t_0$, $t_1$, $t_2$, $t_3$ respectively equal to  $a$, $\frac{b - 2 a}{3}$, $\frac{2b - a}{3}$, $b$

$ \mathbf{Q}_0 = \mathbf{B}_p(t_0) $

$ \mathbf{Q}_1 = {-15 \mathbf{B}_p(t_0) + 54 \mathbf{B}_p(t_1) -27 \mathbf{B}_p(t_2) + 6 \mathbf{B}_p(t_3)} / 18 $

$ \mathbf{Q}_2 = {6 \mathbf{B}_p(t_0) -27 \mathbf{B}_p(t_1) + 54 \mathbf{B}_p(t_2) -15 \mathbf{B}_p(t_3)} / 18 $

$ \mathbf{Q}_3 = \mathbf{B}_p(b) $