The plot is programmed according to chapter 4.4 in the book.
A 3rd degree Bezier curve will have the following formula in matrix form:
\( C(t) = \begin{bmatrix}1- t & t \end{bmatrix} \begin{bmatrix} 1- t & t & 0 \\ 0 & 1- t & t \end{bmatrix} \begin{bmatrix} 1- t & t & 0 & 0 \\ 0 & 1- t & t & 0 \\ 0 & 0 & 1- t & t \end{bmatrix} \begin{bmatrix} c_{0} \\ c_{1} \\ c_{2} \\ c_{3} \end{bmatrix}\), when \(t \in[0, 1]\), se kapittel 4.4.2 i boka. If we want to increase the degree, we just add a new matrix to the right in front of the control points.
The matrix formula above can be written more compactly as \( C(t) = T^3(t)\ \mathbf{c} \), and we can calculate the 1st derivative in the usual way, i.e. with the kernel rule: \( C'(t) = 3\ T^2(t)\ T' \mathbf{c} \). In matrix form it becomes:
\( C'(t) = 3 \begin{bmatrix}1- t & t \end{bmatrix} \begin{bmatrix} 1- t & t & 0 \\ 0 & 1- t & t \end{bmatrix} \begin{bmatrix} -1 & 1 & 0 & 0 \\ 0 & -1 & 1 & 0 \\ 0 & 0 & -1 & 1 \end{bmatrix} \begin{bmatrix} c_{0} \\ c_{1} \\ c_{2} \\ c_{3} \end{bmatrix}\), when \(t \in[0, 1]\), see expression 4.36 i boka, which also shows the formulas for all derivatives.
If we multiply the 3 matrices in the matrix formula of the Bezier curve we get 4 Bernstein polynomials of degree 3: \((1-t)^3\), \( 3t(1-t)^2\), \(3t^2(1-t)\) and \(t^3\). Set up in a different matrix form, the Bernstein polynomials are: \( \begin{bmatrix} 1 & -3 & 3 & -1\\ 0 & 3 & -6 & 3\\ 0 & 0 & 3 & 3\\ 0 & 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} 1 \\ t\\ t^2 \\ t^3 \end{bmatrix} \). The matrix in the expression is then the basis change matrix from a monomial 3rd-degree basis to a Bezier basis, i.e. Bernstein polynomials of degree 3. See table 4.1 in the book.