Interact with smooth curves.
For each Task below show
The B-spline control points \(P_i\) are the same for all three Tasks.
The \(c_{i,j}\) in Task 3,4 are called BB-coefficients
ip = i+1; if i==N, ip = 0; or
modulo or
repeat the end point when setting up the VAO, VBO
for the polygon.)
From the polygon in Task 1, generate a smoother curve by subdivision.
where \(k\) is the level of subdivison and
\(i\) is in \(0, \dots, (N\times 2^k-1)\) .
For example, if \(k=1,i=7\),
\(P^{0}_{7} = \begin{bmatrix} 4 \cr 0 \end{bmatrix} \),
\(P^{0}_{0} = \begin{bmatrix} 4c \cr 4s \end{bmatrix} \)
then
\(P^{1}_{14} = \begin{bmatrix} 3+c \cr s \end{bmatrix} \),
\(P^{1}_{15} = \begin{bmatrix} 1+3c \cr 3s \end{bmatrix} \).
Another way to generate a curve is to construct several smoothly connected pieces in Bernstein-Bézier (BB) form.
We construct N BB-pieces of degree 2.
The \(i\)th piece has BB-coefficients
\(\mathbf{c}_i=\{c_{i,0},c_{i,1},c_{i,2}\}\).
The interior BB-coefficient is:
Determine \(c_{i,0}\) and \(c_{i,2} = c_{i+1,0}\) so that
the polynomial pieces join \(C^1\).
Write down the formulas for the BB-coefficients in terms of the
B-spline control points in readme.txt
Let \(n\) be the tessellation number (= number of evaluations-1 = number of segments) per BB-piece.
Implement Task 4 using the OpenGL 4.x's tessellation engine. (You will have to use the web for details -- or sign up for Advanced Graphics) Make a note in the readme.txt file.
Make sure picking still works on the original \(N\) vertices, and your curves adapt when moved.