How to Compute the Coordinates of a Bézier Curve
At a glance
- 1. List the control points
Write the curve’s control points in order, from the starting point to the ending point.
- 2. Choose a parameter
Pick a value t between 0 and 1 to identify a point on the curve.
- 3. Calculate the weights
For a degree-n curve, use the Bernstein weights for the chosen t.
- 4. Combine coordinates
Multiply each control point by its weight and add the results component by component.
A Bézier curve is specified by its control points and a parameter . To compute a point on the curve, evaluate a weighted average of the control points. The weights depend on and on the curve’s degree.
For the usual curve segment, take : gives the first control point, and gives the last. Intermediate values trace the curve between them.
The Bézier curve formula
Given control points , the degree- Bézier curve is
The factors
are called the Bernstein weights. For , they are nonnegative and sum to . Thus is a weighted average of the control points.
The formula works for points in two or three dimensions, or any coordinate space: apply it separately to each coordinate. For example, if , then
Common formulas by degree
A linear Bézier curve has two control points:
A quadratic Bézier curve has three:
A cubic Bézier curve has four:
The degree is one less than the number of control points. For a cubic curve, for instance, there are four control points.
Worked example: a cubic curve
Take the control points
and calculate the curve point at . The cubic weights are
So
The curve passes through at parameter value . Notice that this point is not found by simply taking the midpoint of any one pair of control points; all four contribute according to their weights.
A reliable alternative: de Casteljau’s algorithm
You can compute the same point using repeated linear interpolation. Start with the control points and, at each stage, interpolate between neighboring points using
For the example at , the first stage gives
Interpolate between those three points to get and . Interpolating once more gives , matching the Bernstein-form calculation.
De Casteljau’s algorithm is especially useful for computation because it uses only linear interpolation and works for any degree. It also gives intermediate control polygons that can be used to split a curve into smaller Bézier curves.
Common mistakes
- Using the wrong degree: With four control points, use the cubic formula, not the quadratic one.
- Mixing up the order of points: The first and last control points are the curve’s endpoints, so their order matters.
- Applying powers to coordinates: The powers in the formula apply to and ; the resulting weights multiply the control points.
- Assuming equal parameter steps mean equal distances: Equal increments in do not generally produce equally spaced points along the curve. The parameter describes how the curve is evaluated, not distance traveled.
- Confusing control points with points on the curve: Except for the endpoints, a control point usually guides the curve rather than lying on it.
For a standard polynomial Bézier segment, evaluate at values in . The same polynomial can be evaluated outside that interval, but those values describe an extrapolation beyond the segment rather than the usual curve segment.
References
- Gerald Farin, Curves and Surfaces for CAGD: A Practical Guide
- James D. Foley et al., Computer Graphics: Principles and Practice
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.