~luyu/comp5411-asgn3

comp5411-asgn3/main.tex -rw-r--r-- 25.8 KiB
3158dda4Luyu Cheng Add everything 8 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
\documentclass[a4paper]{article}

\usepackage{amsmath,amsfonts}

\setlength{\oddsidemargin}{0in}
\setlength{\textwidth}{6.5in}
% \setlength{\topmargin}{0in}
% \setlength{\headheight}{0in}
% \setlength{\headsep}{0in}
% \setlength{\textheight}{8.7in}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage[T1]{fontenc}
\usepackage{charter}
\usepackage{tikz}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{multicol}
\usepackage{array}
\usepackage{amsmath}
\usepackage{cancel}
\usepackage{enumitem}
\usepackage{pgfplots}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{hyperref}
\usepackage{xcolor}
\usetikzlibrary{arrows.meta}

\hypersetup{colorlinks=true,linkcolor=purple}

\def\comma{\text{,}}
\def\period{\text{.}}
\newcommand*{\transpose}{^{\mkern-1.5mu\mathsf{T}}}

\newtheorem*{lemma}{Lemma}
\newtheorem*{property}{Property}

\setcounter{section}{-1}

\title{Advanced Computer Graphics \\ \Large{Geometry Part -- Written Assignment}}
\author{Luyu Cheng, HKUST}

\begin{document}
\maketitle

\newcommand{\bc}{B\'{e}zier curve}
\newcommand{\bcs}{B\'{e}zier curves}
\newcommand{\ubs}[2]{\underset{#1}{\underbrace{#2}}}

\begin{enumerate}
    \item 
    \begin{enumerate}
        \item {\bfseries Endpoint interpolation property.} Compute the endpoints. \begin{alignat*}{1}
            C(0) & = \frac16P_0 + \frac23P_1 + \frac16P_2 \neq P_0 \\
            C(1) & = \frac16P_1 + \frac23P_2 + \frac16P_3 \neq P_3
        \end{alignat*}
        Therefore, the basis functions do not satisfy the endpoint interpolation property.

        {\bfseries Partition of unity property.} All terms of $u$ are cancelled in the calculation.
        \begin{align*}
            \sum_{k=0}^3N_i(u) &= \frac16(1-u)^3 + \frac16(3u^3−6u^2+4) + \frac16(−3u^3+3u^2+3u+1)+\frac16u^3\\
            &= \frac16\left(
                \left(\cancel{-u^3}+\cancel{3u^2}-\cancel{3u}+1\right)
                +\left(\cancel{3u^3}\cancel{6u^2}+4\right)
                +\left(−\cancel{3u^3}+\cancel{3u^2}+\cancel{3u}+1\right)
                +\cancel{u^3}\right) \\
            &= 1
        \end{align*}
        Therefore, the basis functions have the partition of unity property.

        {\bfseries Convex hull property.} $C(u)$ is a weighted average of four control points and weights sum to 1 (i.e. is a convex combination of control points). Therefore, $C(u)$ belongs to the convex hull of control points.

        % Derive the first derivative and the second derivative of C(u). Let C1(u) and C2(u) be two B-sline curves defined by P0P1P2P3 and P1P2P3P4, respectively. Find the first and second derivatives of the two B-spline curves at the joint and discuss the order of continuity there.
        \item \label{it:1b} Here are the first and the second derivatives of $C(u)$. \begin{alignat*}{6}
            C'(u) & = & \ubs{N'_0(u)}{-\frac{1}{2}(1-u)^2} P_0 & + & \ubs{N'_1(u)}{\left(\frac{3}{2}u^2 - 2u\right)} P_1 & + & \ubs{N'_2(u)}{\left(-\frac{3}{2}u^2+u+\frac{1}{2}\right)} P_2 & + \ubs{N'_3(u)}{\frac{1}{2}u^2} P_3 \\
            C''(u) & = & \ubs{N''_0(u)}{(1-u)} P_0 & + & \ubs{N''_1(u)}{(3u-2)} P_1 & + & \ubs{N''_2(u)}{(-3u+1)} P_2 & + \ubs{N''_3(u)}{u} P_3
        \end{alignat*}

        Prove the $C_0$ continuity at the joint of $C_1$ and $C_2$. \begin{alignat*}{3}
            C_1(1) & =
            \frac16P_1 + \frac23P_2 + \frac16P_3 && =
            C_2(0) && =
            \frac16P_1 + \frac23P_2 + \frac16P_3
        \end{alignat*}

        Prove the $C_1$ continuity at the joint of $C_1$ and $C_2$. \begin{alignat*}{3}
            C'_1(1) & = &
            \cancel{-\frac{1}{2}(1-1)^2 P_0} + \left(\frac{3}{2} - 2\right) P_1 + \cancel{\left(-\frac{3}{2}+1+\frac{1}{2}\right)} P_2 + \frac{1}{2} P_3 & =
            -\frac12P_1 + \frac12P_3 \\
            C'_2(0) & = &
            -\frac{1}{2}(1-0)^2 P_1 + \cancel{\left(\frac{3}{2}\cdot 0 - 0\right)} P_2 + \left(-\frac{3}{2}+0+\frac{1}{2}\right) P_3 + \cancel{\frac{1}{2}\cdot 0 P_4} & =
            -\frac12P_1 + \frac12P_3
        \end{alignat*}

        Prove the $C_2$ continuity at the joint of $C_1$ and $C_2$. \begin{alignat*}{3}
            C''_1(1) & = &
            \cancel{(1-1) P_0} + (3-2) P_1 + (-3+1) P_2 + 1 P_3 & =
            P_1 -2 P_2 + P_3 \\
            C''_2(0) & = &
            (1 - 0)P_1 + (0 - 2)P_2 + (0 + 1)P_3 + \cancel{0 P_3} & =
            P_1 - 2P_2 + P_3
        \end{alignat*}

        Therefore, the joint of B-spline curves is $C^2$ continuity.
        
        % What properties of the basis functions lead to the order of continuity being independent of the location of the control points?
        \item If we concatenate the basis functions into a piecewise function $N(x)$. $N(x)$ is $C^2$ continuous at every joints. The $C^2$ continuity makes the order of continuity is independent of the location of control points. \begin{equation}
            \label{eq:piecewise-basis-functions}
            N(x)=\begin{cases}
                N_0(r) & x=4n+0+r\\
                N_1(r) & x=4n+1+r\\
                N_2(r) & x=4n+2+r\\
                N_3(r) & x=4n+3+r\\
            \end{cases}, n\in \mathbb Z, 0\le r<1.
        \end{equation} We can discover the property by observing the calculation in solution \ref{it:1b}. We can find that \begin{displaymath}
            \begin{array}{ccc}
                N_1(1) = N_0(0), & N'_1(1) = N'_0(0), & N''_1(1) = N''_0(0); \\
                N_2(1) = N_1(0), & N'_2(1) = N'_1(0), & N''_2(1) = N''_1(0); \\
                N_3(1) = N_2(0), & N'_3(1) = N'_2(0), & N''_3(1) = N''_2(0).
            \end{array}
        \end{displaymath}
        We can also find these relations on the plot (Figure \ref{fig:1c}) of the basis functions and their derivatives. Note that values at endpoints of functions are the same.

        \begin{figure}
            \centering
            \begin{subfigure}{0.31\textwidth}
                \centering
                \begin{tikzpicture}[scale=0.95]
                    \centering
                    \begin{axis}[
                        width=0.8\textwidth,
                        height=1.2\textwidth,
                        scale only axis,
                        domain=0:1,
                        xmin=0, xmax=1,
                        ymin=-0.5, ymax=1.0,
                        grid,
                        minor x tick num=1,
                        minor y tick num=1,
                    ]
                        \addplot[no marks,red,thick] {1/6*(1-x)^3};
                        \addplot[no marks,teal,thick] {1/6*(3*x^3+(-6)*x^2+4)};
                        \addplot[no marks,blue,thick] {1/6*((-3)*x^3+3*x^2+3*x+1)};
                        \addplot[no marks,purple,thick] {1/6 * x^3};
                    \end{axis}
                \end{tikzpicture}
                \caption{The plot of \textcolor{red}{$N_0(u)$}, \textcolor{teal}{$N_1(u)$}, \textcolor{blue}{$N_2(u)$}, and \textcolor{purple}{$N_3(u)$}.}
            \end{subfigure}
            \hfill
            \begin{subfigure}{0.31\textwidth}
                \centering
                \begin{tikzpicture}[scale=0.95]
                    \centering
                    \begin{axis}[
                        width=0.8\textwidth,
                        height=1.2\textwidth,
                        scale only axis,
                        domain=0:1,
                        xmin=0, xmax=1,
                        ymin=-0.75, ymax=0.75,
                        grid,
                        minor x tick num=1,
                        minor y tick num=1,
                    ]
                        \addplot[no marks,red,thick] {(-1/2)*(1-x)^2};
                        \addplot[no marks,teal,thick] {(3/2)*x^2-2*x};
                        \addplot[no marks,blue,thick] {-(3/2)*x^2+x+1/2};
                        \addplot[no marks,purple,thick] {(1/2)*x^2};
                    \end{axis}
                \end{tikzpicture}
                \caption{The plot of \textcolor{red}{$N'_0(u)$}, \textcolor{teal}{$N'_1(u)$}, \textcolor{blue}{$N'_2(u)$}, and \textcolor{purple}{$N'_3(u)$}.}
            \end{subfigure}
            \hfill
            \begin{subfigure}{0.32\textwidth}
                \centering
                \begin{tikzpicture}[scale=0.95]
                    \centering
                    \begin{axis}[
                        width=0.8\textwidth,
                        height=1.2\textwidth,
                        scale only axis,
                        domain=0:1,
                        xmin=0, xmax=1,
                        ymin=-0.5, ymax=1,
                        grid,
                        minor x tick num=1,
                        minor y tick num=1,
                    ]
                        \addplot[no marks,red,thick] {1-x};
                        \addplot[no marks,teal,thick] {3*x-2};
                        \addplot[no marks,blue,thick] {0-3*x+1};
                        \addplot[no marks,purple,thick] {x};
                    \end{axis}
                \end{tikzpicture}
                \caption{The plot of \textcolor{red}{$N''_0(u)$}, \textcolor{teal}{$N''_1(u)$}, \textcolor{blue}{$N''_2(u)$}, and \textcolor{purple}{$N''_3(u)$}.}
            \end{subfigure}
            \caption{The plot of the basis functions and their derivatives. Note that values at endpoints of these functions are the same.}
            \label{fig:1c}
        \end{figure}
    \end{enumerate}
    \item
    \begin{enumerate}
        \item \label{it:2a} Suppose the points of $C(u)$ are $P_0=(0,0)$, $P_1=(1,4)$, and $P_2=(5,3)$. We have
        \begin{alignat*}{6}
            P_0^{(1)} &= \left(1-\frac{1}{4}\right)P_0       &&+ \frac{1}{4}P_1       &&= (\frac{1}{4},1) \\
            P_1^{(1)} &= \left(1-\frac{1}{4}\right)P_1       &&+ \frac{1}{4}P_2       &&= (2,\frac{15}{4}) \\
            P_0^{(2)} &= \left(1-\frac{1}{4}\right)P_0^{(1)} &&+ \frac{1}{4}P_1^{(1)} &&= (\frac{11}{16},\frac{27}{16})
        \end{alignat*}
        Figure \ref{fig:2-a} illustrates $C(u)$ and $Q(0.25)$. \footnote{Figures in this report are plotted with Ti$k$Z.}

        \begin{figure}
            \centering
            \begin{tikzpicture}
                \draw[loosely dotted] (0,0) grid (5.5,4.5);
                % \path[use as bounding box] (-2,-1) rectangle (5,5);
                \draw[->] (-0.2,0) -- (5.5,0) node[right] {$x$};
                \draw[->] (0,-0.25) -- (0,4.5) node[above] {$y$};
                \foreach \x/\xtext in {1/1, 2/2, 3/3, 4/4, 5/5}
                \draw[shift={(\x,0)}] (0pt,2pt) -- (0pt,-2pt) node[below] {$\xtext$};
                \foreach \y/\ytext in {1/1, 2/2, 3/3, 4/4}
                \draw[shift={(0,\y)}] (2pt,0pt) -- (-2pt,0pt) node[left] {$\ytext$};
                \shade[top color=blue,bottom color=gray!50]
                    (0,0) parabola (0.1*1,0.01*1) |- (0,0);
                \draw[color=gray] (0,0) -- (1,4) -- (5,3);
                % P0, (1/3 P0+2/3 P1), (2/3 P1+1/3 P2), P2
                \draw[thick] (0,0) .. controls (2/3,2.664) and (2.331,3.663) .. (5,3);
                \foreach \p/\ptext/\o in {
                    (0,0)/$P_0$/{above left},
                    (1,4)/$P_1$/above,
                    (5,3)/$P_2$/right,
                    (0.6875,1.6875)/$Q(0.25)$/{right}} {
                    \draw[fill=black] \p circle (2pt) node[\o] {\ptext};
                }
            \end{tikzpicture}
            \caption{The quadratic Bezier curve in problem \ref{it:2a}}
            \label{fig:2-a}
        \end{figure}

        % Problem 2 (b)
        \item Let $P_0$, $P_1$, and $P_2$ be the points of a \bc. \begin{displaymath}
            \begin{alignedat}{1}
                P_0^{(1)} &= (1-t)P_0 + tP_1 \\
                P_1^{(1)} &= (1-t)P_1 + tP_2 \\
                P_0^{(2)} &= (1-t)P_0^{(1)} + tP_1^{(1)} \\
                &= (1-t)\left((1-t)P_0 + tP_1\right) + t\left((1-t)P_1 + tP_2\right) \\
                &= \ubs{\beta_0}{(1-t)^2} P_0 + \ubs{\beta_1}{2t(1-t)}P_1 + \ubs{\beta_2}{t^2} P_2
            \end{alignedat}
        \end{displaymath}
        Therefore, the basis functions are \begin{displaymath}
            \begin{alignedat}{1}
                \beta_0 &= t^2 \\
                \beta_1 &= 2t(1-t) \\
                \beta_2 &= (1-t)^2.
            \end{alignedat}
        \end{displaymath}

        % Problem 2. (c) Express the quadratic Bezier curves and their first derivative in matrix form.
        \item We can derive the matrix form of quadratic \bcs\space as follows. \begin{displaymath}
            \begin{alignedat}{1}
                C(t) & = (1-t)^2 P_1 + 2(1-t)t P_2 + t^2 P_3 \\
                & = (1 - 2t + t^2)P_1 + (0 + 2t - 2t^2)P_2 + (0 + 0t + t^2)P_3 \\
                & = \left[\begin{matrix}
                    1 - 2t + t^2 \\
                    0 + 2t - 2t^2 \\
                    0 + 0t + t^2
                \end{matrix}\right]^{\transpose} \left[\begin{matrix}
                    P_1 \\ P_2 \\ P_3
                \end{matrix}\right] \\
                & = \left[\begin{matrix}
                    1 \\ t \\ t^2
                \end{matrix}\right]^{\transpose} \left[\begin{matrix}
                    1  & 0  & 0 \\
                    -2 & 2  & 0 \\
                    1  & -2 & 1
                \end{matrix}\right] \left[\begin{matrix}
                    P_1 \\ P_2 \\ P_3
                \end{matrix}\right]
            \end{alignedat}
        \end{displaymath}
        We can derive the matrix form of the first derivative of quadratic \bcs\space as follows. \begin{displaymath}
            \begin{alignedat}{1}
                C'(t) & = 2t P_1 + 2(1-2t)P_2 + 2(t-1)P_3 \\
                & = (0+2t) P_1 + (2-4t) P_2 + (-1+2t) P_3 \\
                & = \left[\begin{matrix}
                    1 \\ t
                \end{matrix}\right]^{\transpose} \left[\begin{matrix}
                    0 & 2  & -1 \\
                    2 & -4 & 2
                \end{matrix}\right] \left[\begin{matrix}
                    P_1 \\ P_2 \\ P_3
                \end{matrix}\right]
            \end{alignedat}
        \end{displaymath}

        % Problem 2. (d) What are the conditions for two quadratic Bezier curves to join at C1 continuity in terms of the placement of the certain control points?
        \item Suppose we have two quadratic \bcs, $C_1(t)$ and $C_2(t)$. The points of $C_1(t)$ are $P_1$, $P_2$, and $P_3$. The points of $C_2(t)$ are $P_3$, $P_4$, and $P_5$.  Expand and reduce $C_1(u)$ and $C_2(t)$, we will have 
        \begin{alignat*}{4}
            C_1(t) & = (P_1-2P_2+P_3)t^2+2(-P_1+P_2)t+P_1\\
            C_2(t) & = (P_4-2P_5+P_6)t^2+2(-P_4+P_5)t+P_4 .
        \end{alignat*}
        Their derivatives are
        \begin{alignat*}{4}
            C'_1(t) & = 2t(P_1-2P_2+P_3)+2(-P_1+P_2)\\
            C'_2(t) & = 2t(P_4-2P_5+P_6)+2(-P_4+P_5) .
        \end{alignat*}

        Let $C_1(1)=C_2(0)$, we will have
        \begin{alignat*}{3}
            (\cancel{P_1}-\cancel{2P_2}+P_3)+\cancel{2(-P_1+P_2)}+\cancel{P_1} & = P_4 \\
            P_3 & = P_4
        \end{alignat*}

        Let $C'_1(1)=C'_2(0)$, we will have
        \begin{alignat*}{3}
            2(P_1-2P_2+P_3)+2(-P_1+P_2) & = 2(-P_4+P_5) \\
            -P_2 + P_3 & = -P_4 + P_5 \\
            \Longrightarrow P_3 = P_4 & = \frac{P_2 + P_5}2
        \end{alignat*}
        Therefore, the conditions are $P_3 = P_4 = \frac{P_2 + P_5}2$, which means that $P_3$ and $P_4$ are the midpoint of $P_2$ and $P_5$.
        
        % Problem 2. (e) Given a sequence of four points B0, B1, B2, B3. Explain how you might construct a C1 continuous quadratic Bezier spline comprising two Bezier curves that approximates the given points (i.e., none of the given points need to be interpolated). Draw a sketch of your construction.
        \item \label{it:2e} Let \begin{displaymath}
            \begin{array}{ccccc}
                P_0 = \frac{2}{3} B_0+\frac{1}{3} B_1\text{,} &
                P_1 = B_1\text{,} &
                P_2 = \frac{B_1+B_2}{2}\text{,} &
                P_3 = B_2\text{,} &
                P_4 = \frac{1}{3} B_2+\frac{2}{3} B_3\text{.}
            \end{array}
        \end{displaymath}
        Let $P_0, P_1, P_2$ be control points of the first \bc\space and $P_1, P_2, P_3$ be control points of the second \bc. Figure \ref{fig:2e} shows an example of the construction.

        \begin{figure}
            \centering
            \begin{tikzpicture}
                \draw[loosely dotted] (0,0) grid (8,4);
                % \path[use as bounding box] (-2,-1) rectangle (5,5);
                \draw[->] (-0.2,0) -- (8.5,0) node[right] {$x$};
                \draw[->] (0,-0.25) -- (0,4.5) node[above] {$y$};
                \foreach \x/\xtext in {1/1, 2/2, 3/3, 4/4, 5/5, 6/6, 7/7, 8/8}
                \draw[shift={(\x,0)}] (0pt,2pt) -- (0pt,-2pt) node[below] {$\xtext$};
                \foreach \y/\ytext in {1/1, 2/2, 3/3, 4/4}
                \draw[shift={(0,\y)}] (2pt,0pt) -- (-2pt,0pt) node[left] {$\ytext$};
                \shade[top color=blue,bottom color=gray!50]
                    (0,0) parabola (0.1*1,0.01*1) |- (0,0);
                \draw[color=gray] (3,0) -- (1,3) -- (4.5,3.5) -- (8,4) -- (6,0);
                % P0, (1/3 P0+2/3 P1), (2/3 P1+1/3 P2), P2
                \draw[thick] (2+1/3,1) .. controls (5/3,2) and (13/6,19/6) .. (4.5,3.5);
                \draw[thick] (4.5,3.5) .. controls (1.5+16/3,3.5/3+8/3) and (16/3+2,8/3) .. (4+8/3,4/3);
                \foreach \p/\ptext/\o in {
                    (3,0)/{$\textcolor{red}{B_0}$}/{above right},
                    {(2+1/3,1)}/{$P_0$}/{above right},
                    (1,3)/{$\textcolor{red}{B_1}$,$P_1$}/{above left},
                    (4.5,3.5)/$P_2$/above,
                    (8,4)/{$\textcolor{red}{B_2}$,$P_3$}/above,
                    {(4+8/3,4/3)}/{$P_4$}/{above left},
                    (6,0)/{$\textcolor{red}{B_3}$}/{above left}} {
                    \draw[fill=black] \p circle (2pt) node[\o] {\ptext};
                }
            \end{tikzpicture}
            \caption{The quadratic B\'{e}zier spline in problem \ref{it:2e}. The given points are in red.}
            \label{fig:2e}
        \end{figure}

        % Problem 2. (f) Repeat part (e) to construct a C2 continuous cubic Bezier spline comprising two Bezier curves for a minimum number of given points.
        \item \label{it:2f} Before the construction, we will introduce the conditions of a $C^2$ continuous cubic B\'ezier spline.
        
        \begin{lemma}
            Suppose a B\'{e}zier spline has \bcs\space $C_1(t)$ and $C_2(t)$. The control points of $C_1(t)$ are $P_1$, $P_2$, $P_3$, and $P_4$. The control points of $C_2(t)$ are $Q_1$, $Q_2$, $Q_3$, and $Q_4$. If their joint is $C^2$ continuous, we have $P_4=Q_1$, $P_2-P_1=Q_4-Q_3$, and $(P_3-P_2)+(P_3-P_4)=(Q_2-Q_1)+(Q_2-Q_3)$. 
        \end{lemma}
        
        We can construct a $C^2$ continuous cubic B\'{e}zier spline (containing two \bcs) with at least \emph{three} given points. Suppose given points are $B_0$, $B_1$, and $B_2$. From the lemma, we know that we need to build 7 control points. The process is as follow.
        
        \begin{enumerate}
            \item Let $P_0 = B_0$ and $P_6 = B_2$. If $B_0$ and $B_2$ should not be interpolated, we can also choose $P_0$ and $P_6$ to be nearby points on line segments $\overline{B_0B_1}$ and $\overline{B_2B_1}$ respectively.
            \item Select $P_1$ and $P_5$ respectively on line segments $\overline{B_0B_1}$ and $\overline{B_1B_2}$ such that $\left|\overline{P_1B_1}\right|=\left|\overline{B_1P_5}\right|$. 
            \item Let $P_2=\frac{P_1+B_1}2$, $P_4=\frac{B_1+P_5}2$, and $P_3=\frac{P_2+P_4}2$.
        \end{enumerate}

        The first cubic \bc\space has control points $P_0$, $P_1$, $P_2$, and $P_3$. The second cubic \bc\space has control points $P_3$, $P_4$, $P_5$, and $P_6$. From Figure \ref{fig:2f} depicts three example of the construction.

        \begin{figure}
            \centering
            \begin{subfigure}{0.55\textwidth}
                \begin{tikzpicture}[scale=0.9]
                    \draw[loosely dotted] (0,0) grid (8.5,4);
                    % \path[use as bounding box] (-2,-1) rectangle (5,5);
                    \draw[->] (-0.2,0) -- (8.5,0) node[right] {$x$};
                    \draw[->] (0,-0.25) -- (0,4.5) node[above] {$y$};
                    \foreach \x/\xtext in {1/1, 2/2, 3/3, 4/4, 5/5, 6/6, 7/7, 8/8}
                    \draw[shift={(\x,0)}] (0pt,2pt) -- (0pt,-2pt) node[below] {$\xtext$};
                    \foreach \y/\ytext in {1/1, 2/2, 3/3, 4/4}
                    \draw[shift={(0,\y)}] (2pt,0pt) -- (-2pt,0pt) node[left] {$\ytext$};
                    \shade[top color=blue,bottom color=gray!50]
                        (0,0) parabola (0.1*1,0.01*1) |- (0,0);
                    \draw[color=gray] (1,1) -- (2,2) -- (3,3) -- (4,4) -- (5,3) -- (6,2) -- (8,0);
                    \draw[color=gray] (3,3) -- (5,3);
                    \draw[thick] (1,1) .. controls (2,2) and (3,3) .. (4,3);
                    \draw[thick] (4,3) .. controls (5,3) and (6,2) .. (8,0);
                    \foreach \p/\ptext/\o in {
                        (1,1)/{$\textcolor{red}{B_0}$,$P_0$}/{below},
                        (2,2)/{$P_1$}/{above left},
                        (3,3)/$P_2$/{above left},
                        (4,4)/{$\textcolor{red}{B_1}$}/above,
                        (4,3)/{$P_3$}/above,
                        (5,3)/{$P_4$}/{above right},
                        (6,2)/{$P_5$}/{above right},
                        (8,0)/{$\textcolor{red}{B_2}$,$P_6$}/{above right}} {
                        \draw[fill=black] \p circle (2pt) node[\o] {\ptext};
                    }
                \end{tikzpicture}
                \caption{An example.}
            \end{subfigure}
            \begin{subfigure}{0.44\textwidth}
                \centering
                \begin{tikzpicture}[scale=0.9]
                    \draw[loosely dotted] (0,0) grid (6.5,4);
                    % \path[use as bounding box] (-2,-1) rectangle (5,5);
                    \draw[->] (-0.2,0) -- (6.5,0) node[right] {$x$};
                    \draw[->] (0,-0.25) -- (0,4.5) node[above] {$y$};
                    \foreach \x/\xtext in {1/1, 2/2, 3/3, 4/4, 5/5, 6/6}
                    \draw[shift={(\x,0)}] (0pt,2pt) -- (0pt,-2pt) node[below] {$\xtext$};
                    \foreach \y/\ytext in {1/1, 2/2, 3/3, 4/4}
                    \draw[shift={(0,\y)}] (2pt,0pt) -- (-2pt,0pt) node[left] {$\ytext$};
                    \shade[top color=blue,bottom color=gray!50]
                        (0,0) parabola (0.1*1,0.01*1) |- (0,0);
                    \draw[color=gray] (2.5,0) -- (1.8315935,1.336813) -- (1.1657968,2.6684065) -- (0.5,4) -- (1.959856,3.7080288) -- (3.419712,3.4160576) -- (5.5,3);
                    \draw[color=gray] (1.1657968,2.6684065) -- (1.959856,3.7080288);
                    \draw[thick] (2.5,0) .. controls (1.8315935,1.336813) and (1.1657968,2.6684065) .. (1.5628264,3.1882176);
                    \draw[thick] (1.5628264,3.1882176) .. controls (1.959856,3.7080288) and (3.419712,3.4160576) .. (5.5,3);
                    \foreach \p/\ptext/\o in {
                        (2.5,0)/{$\textcolor{red}{B_0}$,$P_0$}/{above right},
                        (1.8315935,1.336813)/{$P_1$}/{left},
                        (1.1657968,2.6684065)/$P_2$/{left},
                        (0.5,4)/{$\textcolor{red}{B_1}$}/above,
                        (1.5628264,3.1882176)/{$P_3$}/{above left},
                        (1.959856,3.7080288)/{$P_4$}/{above right},
                        (3.419712,3.4160576)/{$P_5$}/{above right},
                        (5.5,3)/{$\textcolor{red}{B_2}$,$P_6$}/{below}} {
                        \draw[fill=black] \p circle (2pt) node[\o] {\ptext};
                    }
                \end{tikzpicture}
                \caption{Another example.}
                \label{fig:2fb}
            \end{subfigure}
            \begin{subfigure}{\textwidth}
                \centering
                \begin{tikzpicture}[scale=0.9]
                    \draw[loosely dotted] (0,0) grid (12,5);
                    % \path[use as bounding box] (-2,-1) rectangle (5,5);
                    \draw[->] (-0.2,0) -- (12,0) node[right] {$x$};
                    \draw[->] (0,-0.25) -- (0,4.5) node[above] {$y$};
                    \foreach \x/\xtext in {1/1, 2/2, 3/3, 4/4, 5/5, 6/6, 7/7, 8/8, 9/9, 10/10, 11/11}
                    \draw[shift={(\x,0)}] (0pt,2pt) -- (0pt,-2pt) node[below] {$\xtext$};
                    \foreach \y/\ytext in {1/1, 2/2, 3/3, 4/4, 5/5}
                    \draw[shift={(0,\y)}] (2pt,0pt) -- (-2pt,0pt) node[left] {$\ytext$};
                    \shade[top color=blue,bottom color=gray!50]
                        (0,0) parabola (0.1*1,0.01*1) |- (0,0);
                    \draw[color=gray] (0.5,2) -- (5.9285774,3.986065) -- (7.3142886,4.4930325) -- (8.7,5) -- (9.435513,3.7208471) -- (10.171026,2.441694) -- (11,1);
                    \draw[color=gray] (7.3142886,4.4930325) -- (9.435513,3.7208471);
                    \draw[thick] (0.5,2) .. controls (5.9285774,3.986065) and (7.3142886,4.4930325) .. (8.374901,4.10694);
                    \draw[thick] (8.374901,4.10694) .. controls (9.435513,3.7208471) and (10.171026,2.441694) .. (11,1);
                    \foreach \p/\ptext/\o in {
                        (0.5,2)/{$\textcolor{red}{B_0}$,$P_0$}/{below},
                        (5.9285774,3.986065)/{$P_1$}/{above left},
                        (7.3142886,4.4930325)/$P_2$/{above left},
                        (8.7,5)/{$\textcolor{red}{B_1}$}/above,
                        (8.374901,4.10694)/{$P_3$}/above,
                        (9.435513,3.7208471)/{$P_4$}/{above right},
                        (10.171026,2.441694)/{$P_5$}/{above right},
                        (11,1)/{$\textcolor{red}{B_2}$,$P_6$}/{below}} {
                        \draw[fill=black] \p circle (2pt) node[\o] {\ptext};
                    }
                \end{tikzpicture}
                \caption{Yet another example.}
                \label{fig:2fc}
            \end{subfigure}
            \caption{Three examples of the quadratic B\'{e}zier spline construction in problem \ref{it:2f}. The given points are in red.}
            \label{fig:2f}
        \end{figure}
    \end{enumerate}
\end{enumerate}

\end{document}