Generalize Finding $y$ value of Bezier curve given a $x$

33 Views Asked by At

A quadratic Bezier curve is a parametric curve. Its $x$ value can be represented by the equation: $$(t² × (x_0 - 2 × x_1 + x_2)) + (t × (2 × x_1 - 2 × x_0)) + (x_0 - x) = 0$$

For $0<t<1$

If I try to solve for $y$, I need to know the corresponding $t$ value. To find t below, I would use the quadratic formula to solve.

In this equation, $A = x_0 - 2 × x_1 + x_2$, $B = 2 × x_1 - 2 × x_0$, and $C = x_0 - x$.

The quadratic formula gives us two solutions for t:

$t_1 = \frac {-B + \sqrt{B^2 - 4 × A × C}} {2A}$

$t_2 = \frac {-B - \sqrt{B^2 - 4 × A × C}} {2A}$

However when I plug in the values of $t_1$ and $t_2$ into the $y$ function, only the $t_1$ is correct, why is that? Why when using the quadratic formula is the answer not $±$ and instead only for $+$.

1

There are 1 best solutions below

0
On

Your approach seems correct, to me. Suppose a parametric curve is given by $x = f(t)$, $y=g(t)$, for $a \le t \le b$, and we want to find the $y$ values corresponding to a given $x$ value, say $x=k$.

Then the steps are:

  1. Solve the equation $f(t) = k$ for $t$, which gives you $t$ values $t_1, \ldots, t_n$. If any of the $t$ values are outside the range $a \le t \le b$, we should discard them, because they don’t correspond to points on the original curve.
  2. Substitute each of these $t$ values into $y=g(t)$ to get $y$ values $y_1, \ldots, y_n$.

The only subtlety is that you should only use the $t$ values in the range $a \le t \le b$.

Your Bézier curve is parameterized over the interval $[0,1]$, so $t$ values outside this interval will not give you points on your curve.