1
$\begingroup$

Wikipedia:

A quadratic Bézier curve is the path traced by the function $B(t)$, given points $P_0$, $P_1$, and $P_2$.

$$C(t) = \sum _{i=0}^{2}\binom{2}{i} t^i(1-t)^{2-i}P_i$$ $$C(t) = (P_0-2P_1+P_2)t^2+(-2P_0+2P_1)t+P_0 \quad t\in[0,1]$$

What exactly is $P_0$ or $P_1$ or $P_2$ concerning this equation?

Yes they are points. But in my understanding, a point is a pair of numbers (in 2D-space).

Let $P_0$ $=(1,1)$, $P_1 = (1,7)$ and $P_2=(7,1)$.

What values do you use (and where)?

How do you calculate the Bezier Curve for these points?

$\endgroup$

2 Answers 2

1
$\begingroup$

You can use standard operations on points in natural ways.

Adding (or subtracting) two points: $P_1+P_2$ = $(x_1+x_2,\ y_1+y_2)$

Multiplying (or dividing) a point by a number: $P_1k=(x_1k,\ y_1k)$.

The Bézier curve uses only the standard numerical operators and these two additional abilities.


an example, using your data.

$$C(t) = (P_0-2P_1+P_2)t^2+(-2P_0+2P_1)t+P_0 \quad t\in[0,1]$$

$$C(t) = ((1,1) - 2(1,7) + (7,1))t^2 + (-2(1,1)+2(1,7))t+(1,1)$$

Applying multiplication:

$$C(t) = ((1,1) - (2,14) + (7,1))t^2 + ((-2,-2)+(2,14))t+(1,1)$$

And addition:

$$C(t) = (6,-12)t^2+(0,12)t+(1,1)$$

then we can handle it by components by multiplying and adding some more:

$$C(t) = (6t^2+1, -12t^2+12t+1)$$

Usually you won't see it shown this way, though: The operations described above are considered already natural and straightforward.

$\endgroup$
1
$\begingroup$

Generally, the formula should read (for your special case, the quadratic, $m=2)$

$C(t) = \sum _{i=0}^m\left(\begin{matrix}m\\i\end{matrix}\right)P_i(1-t)^it^{m-i}$

In a 2-dimensional environment, with control points $(x_i\mid y_i)\qquad i=\{0,1,2\},$
$m=2.$

You would need TWO instances of the formula: one for each dimension. The first instance would utilize the $x$
parts of your given control points in place of the Ps. The second instance would utilize the $y$
parts. For each value of $t,$
the two values yielded by these TWO instances would constitute the two coördinates for each point of your desired Bézier curve. Clear, I hope?

For your example we need two coördinates for each of your given points. I have assigned each coördinate a name, as follows:
\begin{array}{c|ccc} \text{point}&x&y\\ \hline P_0&P_{0,x}&P_{0,y}\\ P_1&P_{1,x}&P_{1,y}\\ P_2&P_{2,x}&P_{2,y} \end{array}

For each value of t, the corresponding point of your desired curve is $(x_t\mid y_t),\quad$ where
$x_t=P_{0,x}(1-t)^2+2P_{1,x}(1-t)t+P_{2,x}t^2$
$y_t=P_{0,y}(1-t)^2+2P_{1,y}(1-t)t+P_{2,y}t^2$

$\endgroup$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .