1
$\begingroup$

How to explicitly find the control point $C_0(x_0,y_0)$ of quadratic Bezier curve if I have only its end-points $C_1(x_1,y_1)$ and $C_2(x_2,y_2)$?

Guess

This should be done using the fact that the tangent passing through $C_1$ and $C_2$ meets at $C_0$. So, from $$y=m_1x+b_1~~ {\rm and}~~ y=m_2x+b_2, $$ with $$ m_1=\frac{y_0-y_1}{x_0-x_1},~~ m_2=\frac{y_0-y_2}{x_0-x_2},~~ b_1=y_1-m_1x_1,~~ b_2=y_2-m_2x_2. $$ Therefore $$ m_1x_0+b_1=m_2x_0+b_2~~ {\rm or}~~ x_0=\frac{b_2-b_1}{m_1-m_2}, $$ which is nothing else but identity. Am I doing something wrong?

Edit

The end-points are located in an ellipse.

$\endgroup$
  • $\begingroup$ Do you have a parametric description such as $x= a t^3+..., y= c t^3+...$ ? $\endgroup$ – Jean Marie Feb 21 '16 at 19:52
  • $\begingroup$ curve end point tangents meet at cp. $\endgroup$ – Narasimham Feb 21 '16 at 19:54
  • $\begingroup$ From tangents I have $x_c=\frac{b_2-b_1}{m_1-m_2}$ and $y_c=m_1x_c+b_2$ with $m_1=\frac{y_c-y_1}{x_c-x_1}$ and $m_2=\frac{y_c-y_2}{x_c-x_2}$. How to find $b_1$ and $b_2$?? $\endgroup$ – Asatur Khurshudyan Feb 21 '16 at 20:01
  • $\begingroup$ Are they $b_1=y_1-m_1x_1$ and $b_2=y_2-m_2x_2$, correspondingly, or I will arrive at identity? $\endgroup$ – Asatur Khurshudyan Feb 21 '16 at 20:04
  • 1
    $\begingroup$ if you want the Bezier curve to match the ellipse, then you should get the tangent vectors from the ellipse. If you are willing to use a rational quadratic, rather than a regular polynomial quadratic, then you can match the ellipse exactly. $\endgroup$ – bubba Feb 23 '16 at 13:52
3
$\begingroup$

As Joriki says, you can't get the other control point with no other information.

However, if you know a point on the line you can work it out. The formula for a quadratic Bezier function taken from https://en.wikipedia.org/wiki/Bezier_curve is:

$P(t) = (1-t)^2P0 + 2(1-t)tP1 + t^2P2$

If you know any two control points, and a separate point on the line at a known time you can calculate the third control point. Say you know the start and end points P0 and P2, and know the curve passes through P(0.5) at t=0.5:

$$ P(0.5) = (1-0.5)^2P0 + 2(1-0.5)0.5P1+0.5^2P2\\ P(0.5) = 0.25P0 + 0.5P1 + 0.25P2\\ P1 = 2P(0.5)-0.5P0 - 0.5P2 $$

For a cubic Bezier if you know the start and end points you can find the middle two control points using the method described here: https://web.archive.org/web/20131225210855/http://people.sc.fsu.edu/~jburkardt/html/bezier_interpolation.html

That requires you to know the points that the curve goes through at t=1/3 and t=2/3. I'm afraid I haven't tried generalising it to any points in time.

$\endgroup$
1
$\begingroup$

You can't get the control point from the end points. A quadratic Bézier curve is defined by all three points. If you have only the end points, you can arbitrarily choose a control point to define a quadratic Bézier curve.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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