What is the equation for the first curve in the image?
I have this formula:
But when I substitute values, I get an image that looks like x^2. It isn't the same shape as the image.
What is the equation for the first curve in the image?
I have this formula:
But when I substitute values, I get an image that looks like x^2. It isn't the same shape as the image.
The three points $P_0,P_1,P_2$ are the control points
of the quadratic Bezier segment.
On the images these points are connected
with straight lines. $P_0$ and $P_2$
are the endpoints of the curve,
$P_1$ (marked with $\times$)
usually is not on the curve.
The formula
\begin{align}
B(t)&=(1-t)^2P_0+2(1-t)tP_1+t^2P_2
,\quad t\in[0,1]
\end{align}
is parametric, that is there are two
expressions in terms of parameter $t$,
that define $x(t)$ and $y(t)$:
Example for $a=3$: \begin{align} B_x(t)&=(1-t)^2P_{0x}+2(1-t)tP_{1x}+t^2P_{2x} ,\\ B_y(t)&=(1-t)^2P_{0y}+2(1-t)tP_{1y}+t^2P_{2y} . \end{align}
So for the first image we can assume that the control points looks like
\begin{align} P_0&=(0,a),\quad P_1=(0,0),\quad P_2=(a,0), \end{align}
and for the second one
\begin{align} P_0&=(a,a),\quad P_1=(0,0),\quad P_2=(a,0) \end{align}
for some constant $a$.
Note, that coordinates of the points are completely independent of the parametric range $[0,1]$.
The two images demonstrate how the curve changes, when just one endpoint is moved.
Example for $a=3$:
The tangent lines on the images illustrate the process of construction of the points on a quadratic Bezier curve by means of the points on linear Bezier segments:
Connecting the control points $P_0-P_1-P_2$, we create two linear Bezier segments: $P_0P_1$ with control points $P_0$ and $P_1$, and $P_1P_2$ with control points $P_1$ and $P_0$,
For any $t\in[0,1]$, find points $u_t,v_t$ on the line segments $P_0P_1$ and $P_1P_2$
\begin{align} u_t&=P_0(1-t)+P_1(t) ,\\ v_t&=P_1(1-t)+P_2(t) . \end{align}
Next, find the point $w_t$ on the linear Bezier segment $u_tv_t$ with control points $u_t$ and $v_t$,
\begin{align} w_t&=u_t(1-t)+v_t t , \end{align}
and the point $w_t$ is the point on the quadratic Bezier curve.
In the image, the curve seems to be the envelope of the lines whose $x$ and $y$ intercepts add to $1$. These lines are given by
$$ y=y_0\left(1-\frac x{1-y_0}\right)\;, $$
where $y_0$ is the $y$ intercept.
The envelope maximizes $y$ with respect to $y_0$ for given $x$. Setting the derivative of $y$ with respect to $y_0$ to zero yields
$$ 1-\frac x{1-y_0}-\frac{y_0x}{(1-y_0)^2}=0 $$
and thus $y_0=1-\sqrt x$. Substituting this into the equation for the lines yields $y=\left(1-\sqrt x\right)^2$, or in more manifestly symmetric form,
$$ \sqrt x+\sqrt y=1\;. $$
This can also be written parametrically as $(x,y)=(\sin^4 t,\cos^4 t)$.
Using vector notation $[x,y]^T$ : First we need to write down the points: $$P_0 = [0,1]^T, P_1 = [0,0]^T, P_2 = [1,0]^T$$ Now to the formula: $$B(t) = (1-t)^2[0,1]^T + (1-t)t[0,0]^T + t^2[1,0]^T = ...\\ [t^2,(1-t)^2]^T$$
So it is true you get quadratic functions, but the quadratic functions are in both $x$ and $y$ coordinates.
$$x = t^2, y = 1-2t+t^2$$ and then substitute $x=\sqrt{t}$ based on our interval $x\in[0,1]$, which belongs to positive real numbers,
$$y = 1-2\sqrt{x}+x$$
You can check with this Wolfram alpha plot.