I would like to construct a cubic Bezier curve. For this, I assume a known starting point $K_0$ as well as a known end point $K_2$. I would like my resulting curve to pass through another known point $K_1$. I also know the angles of the curve at the starting and end points $K_0$ and $K_2$. So the resulting curve has the form $$S(u)=B_0(u)K_0+B_1(u)P_1+B_2(u)P_2+B_3(u)K_2$$ where $u$ is the curve parameter that takes values from $0$ to $1$.
All the points are known except for the two control points $P_1$ and $P_2$. I understand that I have to make a set of equations using the known information in order to find the two unknown control points.
For this, I assume that the following applies:
The first derivative of the $S(t)$ function at $t=0$ must equal the tangent of the known angle of the curve at its beginning: $Sx'(0)=\tan(0)$, $Sy'(0)=\tan(0)$.
The first derivative of the $S(t)$ function at $t=1$ must equal the tangent of the known angle of the curve at its ending: $Sx'(1)=\tan(45^\circ)$, $Sy'(1)=\tan(45^\circ)$
The function $S(t)$ must be equal to $K_1$ point for some value $t': Sx(t')= K_1x, Sy(t')=K_1y$.
Assume that $t'$ can be found using a simple geometric relation between points $K_0$, $K_1$, $K_2$ such as: $$t' = \frac{\operatorname{dist}(K_0,K_1)}{\operatorname{dist}(k_0,k_1)+\operatorname{dist}(k_1,k_2)}. $$
Doing all of the above is not producing expected results. Any suggestions?
This is a rough sketch of the scematic in order to help you visualize my problem
The first derivative of $S(u)$ at $u=0$ and $u=1$ should be represented as
$S'(0)=m_0(1,0)$
$S'(1)=m_1(\frac{1}{\sqrt{2}}, \frac{1}{\sqrt{2}})$
where $m_0$ and $m_1$ are the magnitudes for $S'(0)$ and $S'(1)$.
We can also associate $S'(0)$ and $S'(1)$ to the control points as
$S'(0)=3(P_1-K_0)$
$S'(1)=3(K_1-P_2)$
Your cubic Bezier curve also needs to pass $K_1$ at $u=t'$. Therefore, you have
$S(t')_x=K_{1,x}$
$S(t')_y=K_{1,y}$
from which you can find the value for $m_0$ and $m_1$ and you will have a fully-defined cubic Bezier curve.