1
$\begingroup$

According to this question, I'm looking for some method to find the t value in Quadratic bezier curve equation:

$$ B(t)=P_0+t(1-t)P_1+t^2P_2 \space \space where \space 0 ≤ t ≤ 1 $$

In this equation we have 3 points that that will return $B$ like this picture:

enter image description here

This picture downloaded from here

As you can see, The changes on $t$ will change the $B$ position. Now my question is I have position of these points $P_0 ,P_1,P_2, B$ , is there any way to find $t$ with these parameters?

$\endgroup$

1 Answer 1

1
$\begingroup$

You can just solve the equation you display directly. For example, let $$ P_0=(0,0),\;\; P_2=(1,0),\;\; P_1=(0.4,0.8) \;, $$ and suppose $B=(0.174,0.168)$:


          BPlot
Then your equation $$ B=P_0+t(1-t)P_1+t^2P_2 $$ becomes after substitution, $$ \left(0.174,0.168\right)=\left( t^2+0.4(1-t) t, \; 0.8 (1-t) t \right) \;, $$ and its solution is $t=0.3$.

Maybe what's confusing you is this is two equations in one unknown. But both are quadratic equations. So solving for the $x$-component yields $t=\{-0.97,0.3\}$ and solving for the $y$-component yields $t=\{0.3,0.7\}$. So clearly only $t=0.3$ matches both components of $B$.

$\endgroup$
2
  • $\begingroup$ Thank you for your answer, is there any way to convert this method to programming function? cause I should use this method in a program, it seems hard to use this method in program. $\endgroup$
    – Gabriel
    Jul 18, 2015 at 5:55
  • $\begingroup$ @Gabriel: Just implement solving the two quadratic equations, and select the common root $\endgroup$ Jul 18, 2015 at 12:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.