I am having trouble in understanding and finding "the three-piece Bezier curve forming a triangle with vertices (1,2), (3,4) and (5,1)".
My understanding so far is that I need 4 points to form a cubic Bezier curve, but the textbooks excersice solution insists it is a third-degree (cubic) solution despite only having 3 points.
I have tried to use (1,2) as a fourth and last end-point and went on to solve for a Bezier curve with points (1,2), (3,4),(5,1), (1,2), but with no meaningful solution.
Off course I see that this will only be a dot in reality since I am basically puting the end-point at the same place as the starting-point, but I'm really clueless on what to do.
I am not sure I quite understand what a "three-piece" solution means, could that be a clue on how to solve?
The solution is stated as:
$\begin{cases} x(t) = 1+6t^2-4t^3\\y(t) = 2+6t^2-4t^3 \end{cases}$ $\begin{cases} x(t) = 3+6t^2-4t^3\\y(t) = 4-9t^2+6t^3 \end{cases}$ $\begin{cases} x(t) = 5-12t^2+8t^3\\y(t) = 1+3t^2-2t^3 \end{cases}$
The secret is realizing that the result is supposed to be a triangle. That means that each Bezier segment -- one side of the triangle --- in joining smoothly with the next segment, must have derivative $(0, 0)$ at each end. So your Bezier points, for the first segment of a triangle $ABC$, are $A,A,B,B$; for the second, they're $B,B,C,C$, and for the third, they're $C, C, A, A$.
The doubling of $A$ in the first segment and of $C$ in the last segment aren't strictly necessary, but when you do this, you get a kind of "wrap around" continuity, where $\gamma'(3) = \gamma'(0)$, where $t \mapsto \gamma(t)$ is your curve, and traverses edge $i$ of the triangle in the interval $i-1 \le t \le i$.
By the way, this isn't a very well written problem, so you were legitimately confused, I believe. There isn't a unique Bezier curve traversing a triangle, and the phrasing of the problem wrongly suggests that there is.