Duplicate quadratic Bézier curve with new start point? I have Bézier curve as shown by the wikipedia gif here: 
I would like to create a new curve that is a segment of the old one. For example, in this gif (from the same article): 

.. if I wanted B to be the starting point of the new curve, but for the curve to follow the same path, how could I find the new control point?
I can see that the answer is very straightforward and easily solvable, but my mind still hasn't caught up with the logic behind the equation for the quadratic Bézier curve: 

so I'm having trouble thinking it out. I would greatly appreciate any hints/advice that would help push me in the right direction.
 A: Generically, this process is known as De Casteljau subdivision: it turns out that the process of (recursively) evaluating the curve at a given point leads to new sets of control points representing the curves on either side of that point.  In your case, in the process of evaluating $B=B(t)$ from $P_0$, $P_1$ and $P_2$ we build the following structure:


*

*$Q_0 = (1-t) P_0 + t P_1$

*$Q_1 = (1-t) P_1 + t P_2$

*$B = (1-t) Q_0 + tQ_1$


It then turns out that the two pieces of the curve to either side of $B$ can be represented by the curves with control points $(P_0, Q_0, B)$ and $(B, Q_1, P_2)$ (each over the interval $(0..1)$, of course), respectively.  Proving this is a grind through the algebra, but it's a fairly instructive one - I definitely recommend trying it for yourself.
A: Suppose you know $Q_0$:
Note that since $Q_0$ is on the line $\overline{P_0P_1}$, we can write $Q_0=(1-k)P_0+kP_1$ for some $k$, $0\leq k\leq1$, which has to be determined. To have the same curve, you also require $Q_1=(1-k)P_1+kP_2$.
Then, the original bezier curve is traced out by varying $t$ from $0$ to $1$. You can get the segment by varying $t$ from $k$ to $1$ to trace out the curve from $B$ to $P_2$.
More than likely, you don't know $Q_0$, but only $B$.
Since the bezier curve traces out the line
$$
   C(t) = (1-t)^2P_0+2t(1-t)P_1+t^2P_2,
$$
by solving $B=(1-t)^2P_0+2t(1-t)P_1+t^2P_2$ for $t$, you get the beginning of the range for which $t$ will vary. This must have a solution, since $B$ is on the curve $C(t)$. I have called this $k$ above.
A: The middle control point of a quadratic Bézier curve lies at the intersection of the tangents to the curve at the two outer control points, so in theory to find the middle control point for a subdivision of the curve, you simply have to compute those tangents and their intersection. In your illustration, the line segment $\overline{Q_0Q_1}$ is tangent to the curve at $B$, so the new control point is either $Q_0$ or $Q_1$ depending on which side of $B$ you wanted.  
However, there’s no need to do all that. Recall that the parameter $t$ represents the proportional distance moved along the line segments that are used to construct a Bézier curve. That is, $$\begin{align}Q_0&=(1-t)P_0+tP_1 \\ Q_1&=(1-t)P_1+tP_2 \\ B&=(1-t)Q_0+tQ_1.\end{align}$$ So, if you have the value of $t$ that corresponds to the new endpoint $B$, computing the new middle control point is trivial. In fact, depending on how you’re generating the curve, you might already have it.  
If, on the other hand, you only have a point $B$ known to be on the curve, then you can solve solve the resulting pair of quadratic equations for $t$ and plug that into the above equation for $Q_0$ or $Q_1$. Alternatively, with a bit of work you can find expressions for the slope of the tangent at $B$ as a function of $B$’s coordinates and those of the original control points only, but you’ll have to figure out a way to choose the correct sign of the square roots involved to get the right slope. Once you have it, you can compute the intersection of the tangents, but I think solving for $t$ directly is less work.
