Ma · Mathematics

How to Find the Control Point for a Point on a Quadratic Bézier Curve

Published By the 9to5Science editorial team

At a glance

  1. 1. Write the curve

    Use the quadratic Bézier formula with endpoints, control point, and parameter t.

  2. 2. Solve for the control point

    If t is known and is not an endpoint, rearrange the curve equation to isolate the control point.

  3. 3. Check uniqueness

    Without t or another constraint, one point and two endpoints do not determine a unique control point.

  4. 4. Compare distances

    For an already specified curve, calculate distances from the given point to each control point and choose the smallest.

Advertisement

A quadratic Bézier curve is determined by two endpoints, one control point, and a parameter tt between 0 and 1. If you know the endpoints and the parameter value at which the curve passes through a point QQ, you can solve directly for the control point. If you know only the endpoints and QQ, there is usually not enough information to determine one unique control point.

There is a second possible meaning: if the curve and all three control points are already known, you may simply want to know which control point is closest to QQ. That is a distance comparison, not an inverse-curve calculation.

The quadratic Bézier formula

Let P0P_0 and P2P_2 be the endpoints, and let P1P_1 be the control point. The curve is

B(t)=(1−t)2P0+2(1−t)tP1+t2P2,0≤t≤1.B(t)=(1-t)^2P_0+2(1-t)tP_1+t^2P_2,\qquad 0\leq t\leq 1.

The points may be coordinates in the plane or in three-dimensional space. The formula works component by component, so the same rearrangement applies in either case.

If the point QQ is on the curve at a known parameter tt, set B(t)=QB(t)=Q and isolate P1P_1:

P1=Q−(1−t)2P0−t2P22t(1−t).P_1=\frac{Q-(1-t)^2P_0-t^2P_2}{2t(1-t)}.

This formula applies when 0<t<10<t<1. At t=0t=0, the curve is at P0P_0; at t=1t=1, it is at P2P_2. The control point has zero weight at both endpoints, so an endpoint observation cannot determine P1P_1.

Worked example

Suppose the endpoints are P0=(0,0)P_0=(0,0) and P2=(4,0)P_2=(4,0), and the curve passes through Q=(2,1)Q=(2,1) at t=12t=\tfrac12. Substituting into the formula gives

P1=(2,1)−(12)2(0,0)−(12)2(4,0)2(12)(12)=(2,1)−(1,0)12=(2,2).\begin{aligned} P_1 &=\frac{(2,1)-(\tfrac12)^2(0,0)-(\tfrac12)^2(4,0)}{2(\tfrac12)(\tfrac12)}\\ &=\frac{(2,1)-(1,0)}{\tfrac12}\\ &=(2,2). \end{aligned}

So the required control point is (2,2)(2,2). Checking it in the original curve equation:

B(12)=14(0,0)+12(2,2)+14(4,0)=(2,1),B(\tfrac12)=\tfrac14(0,0)+\tfrac12(2,2)+\tfrac14(4,0)=(2,1),

which confirms the result.

What if the parameter is unknown?

Knowing P0P_0, P2P_2, and QQ does not generally fix P1P_1, because the parameter tt is also unknown. For any chosen tt strictly between 0 and 1, the rearranged formula gives a control point that makes the curve pass through QQ at that parameter. Those different choices can produce different control points.

For instance, keep P0=(0,0)P_0=(0,0), P2=(4,0)P_2=(4,0), and Q=(2,1)Q=(2,1), but choose t=14t=\tfrac14 instead of 12\tfrac12. The formula gives P1=(143,83)P_1=(\tfrac{14}{3},\tfrac83), which is different from (2,2)(2,2) but still makes the curve pass through QQ at the selected parameter. You need enough additional information to ensure a unique solution—for example, the parameter itself. A specified line for P1P_1 or another point on the curve may provide useful additional constraints, but need not guarantee uniqueness on its own.

If the full curve is known, meaning all three control points are specified, you can instead find the parameter for which B(t)=QB(t)=Q. In coordinates this means solving the component equations for a common value of tt in [0,1][0,1]. A point may have no such parameter if it is not on the curve. Once you have the parameter, it does not change which of the already specified control points is nearest to QQ.

Finding the nearest existing control point

For a known curve, calculate the Euclidean distance from QQ to each control point. In two dimensions, for Q=(x,y)Q=(x,y) and a control point Pi=(xi,yi)P_i=(x_i,y_i),

d(Q,Pi)=(x−xi)2+(y−yi)2.d(Q,P_i)=\sqrt{(x-x_i)^2+(y-y_i)^2}.

In the worked example, P1=(2,2)P_1=(2,2) is one unit from Q=(2,1)Q=(2,1). Each endpoint is 5\sqrt{5} units away, so P1P_1 is the nearest control point. In computations, you can compare squared distances instead; taking square roots is unnecessary because squaring preserves the ordering of nonnegative distances.

Common mistakes

  • Leaving out the parameter. A point on the curve is not enough to recover the control point unless the parameter or another constraint is known.
  • Using the formula at an endpoint. The denominator 2t(1−t)2t(1-t) is zero at t=0t=0 and t=1t=1, and the control point cannot be inferred from those endpoint values.
  • Assuming a control point lies on the curve. A Bézier curve is pulled toward its control point, but it generally does not pass through it.
  • Confusing “the control point” with “the nearest control point.” The first asks for an unknown that generates the curve; the second compares distances to control points that are already known.

References

  1. Curves and Surfaces for Computer-Aided Geometric Design: A Practical Guide, Gerald Farin

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.