CE7453: Bezier Techniques
Published:
This post summarizes key concepts of Bezier techniques covered in CE7453, based on the lecture notes “03-BeizerTechniques”.
Key Concepts
Bezier curves and surfaces are parametric representations used extensively in computer graphics, CAD systems, and geometric modeling. They provide intuitive control over curve shapes through control points.
Historical Context
Bezier curves were developed independently by Pierre Bézier (at Renault) and Paul de Casteljau (at Citroën) in the 1960s for automotive design. The mathematical foundation, however, dates back to the Bernstein polynomials developed in the early 20th century.
Real-world Applications
- Vehicle Design: Automobile body shapes and aerodynamic profiles
- Font Design: TrueType and PostScript font outlines
- Animation: Smooth motion paths and transitions
- CAD/CAM: Industrial part design and manufacturing
- Computer Graphics: Representing curves and surfaces in rendering
Bezier Curves
1. Mathematical Foundation
- Definition: A Bezier curve of degree n is defined by n+1 control points
- Bernstein Basis: The mathematical foundation of Bezier curves
- Bi,n(t) = (n choose i) ti (1-t)n-i
- Parametric Equation: P(t) = Σi=0n Pi Bi,n(t), t ∈ [0,1]
Bernstein Polynomials Derivation
The Bernstein basis polynomials of degree n are:
Bi,n(t) = (n choose i) ti (1-t)n-i for i = 0, 1, …, n
Where (n choose i) is the binomial coefficient:
(n choose i) = n! / (i! × (n-i)!)
Common Bezier Curve Forms
- Linear Bezier Curve (n=1, 2 control points):
- P(t) = (1-t)P0 + tP1
- Simple linear interpolation between two points
- Quadratic Bezier Curve (n=2, 3 control points):
- P(t) = (1-t)²P0 + 2(1-t)tP1 + t²P2
- Creates a parabolic arc
- Cubic Bezier Curve (n=3, 4 control points):
- P(t) = (1-t)³P0 + 3(1-t)²tP1 + 3(1-t)t²P2 + t³P3
- Most commonly used form, offering good balance between flexibility and computational efficiency
Worked Example: Cubic Bezier Curve
Given control points in 2D:
- P0 = (0, 0)
- P1 = (1, 3)
- P2 = (3, 3)
- P3 = (4, 0)
Let’s compute points on the curve for t = 0, 0.25, 0.5, 0.75, 1:
t | (1-t)³ | 3(1-t)²t | 3(1-t)t² | t³ | P(t) |
---|---|---|---|---|---|
0 | 1 | 0 | 0 | 0 | (0, 0) |
0.25 | 0.422 | 0.422 | 0.141 | 0.016 | (1.31, 2.34) |
0.5 | 0.125 | 0.375 | 0.375 | 0.125 | (2.5, 2.25) |
0.75 | 0.016 | 0.141 | 0.422 | 0.422 | (3.44, 1.22) |
1 | 0 | 0 | 0 | 1 | (4, 0) |
This creates a smooth curve that starts at P0, is pulled toward P1 and P2, and ends at P3.
2. Properties
- Endpoint Interpolation: Curve passes through first and last control points
- Convex Hull: Entire curve lies within convex hull of control points
- Affine Invariance: Transforming control points transforms curve predictably
- Variation Diminishing: Curve doesn’t oscillate more than control polygon
- Differentiability: C∞ continuous within segments
Mathematical Proof of Properties
Endpoint Interpolation:
- At t=0: P(0) = B0,n(0)P0 + … + Bn,n(0)Pn = P0
- Because B0,n(0) = 1 and Bi,n(0) = 0 for i > 0
- At t=1: P(1) = B0,n(1)P0 + … + Bn,n(1)Pn = Pn
- Because Bn,n(1) = 1 and Bi,n(1) = 0 for i < n
Convex Hull Property:
- Since Bernstein polynomials are non-negative and sum to 1 (partition of unity), the Bezier curve is a convex combination of its control points.
Derivatives of Bezier Curves
The derivative of a Bezier curve of degree n is:
P’(t) = n Σi=0n-1 (Pi+1 - Pi) Bi,n-1(t)
For a cubic Bezier curve: P’(t) = 3[(P1 - P0)(1-t)² + (P2 - P1)2(1-t)t + (P3 - P2)t²]
The second derivative is: P’‘(t) = n(n-1) Σi=0n-2 (Pi+2 - 2Pi+1 + Pi) Bi,n-2(t)
3. De Casteljau Algorithm
- Purpose: Efficient and numerically stable way to evaluate Bezier curves
- Process: Recursive linear interpolation between control points
- Advantages:
- Geometrically intuitive
- Allows curve subdivision at any parameter value
- Numerically stable
Step-by-step De Casteljau Algorithm
- Start with n+1 control points: P0, P1, …, Pn
- For r from 1 to n:
- For i from 0 to n-r:
- Pir = (1-t)Pir-1 + tPi+1r-1
- For i from 0 to n-r:
- P0n is the point on the curve at parameter t
Worked Example: De Casteljau Algorithm
For a cubic Bezier curve with control points P0, P1, P2, P3, let’s evaluate at t = 0.5:
First level (r = 1):
- P01 = (1-0.5)P0 + 0.5P1 = 0.5P0 + 0.5P1
- P11 = (1-0.5)P1 + 0.5P2 = 0.5P1 + 0.5P2
- P21 = (1-0.5)P2 + 0.5P3 = 0.5P2 + 0.5P3
Second level (r = 2):
- P02 = (1-0.5)P01 + 0.5P11 = 0.5(0.5P0 + 0.5P1) + 0.5(0.5P1 + 0.5P2) = 0.25P0 + 0.5P1 + 0.25P2
- P12 = (1-0.5)P11 + 0.5P21 = 0.5(0.5P1 + 0.5P2) + 0.5(0.5P2 + 0.5P3) = 0.25P1 + 0.5P2 + 0.25P3
Third level (r = 3):
- P03 = (1-0.5)P02 + 0.5P12 = 0.5(0.25P0 + 0.5P1 + 0.25P2) + 0.5(0.25P1 + 0.5P2 + 0.25P3) = 0.125P0 + 0.375P1 + 0.375P2 + 0.125P3
This gives us P(0.5) = 0.125P0 + 0.375P1 + 0.375P2 + 0.125P3, which matches the cubic Bernstein polynomial evaluation.
Python Implementation for De Casteljau
import numpy as np
def de_casteljau(control_points, t):
"""
Evaluate a Bezier curve at parameter t using De Casteljau algorithm.
Parameters:
- control_points: List of control points (can be 2D or 3D)
- t: Parameter value in range [0, 1]
Returns:
- Point on the Bezier curve at parameter t
"""
points = np.copy(control_points)
n = len(points) - 1 # Degree of the curve
for r in range(1, n + 1):
for i in range(n - r + 1):
points[i] = (1 - t) * points[i] + t * points[i + 1]
return points[0] # Final point is P₀ⁿ
Curve Subdivision
One powerful application of the De Casteljau algorithm is curve subdivision. At parameter t, the algorithm computes intermediate points that can be used to represent two new Bezier curves of the same degree, together forming the original curve.
For a cubic curve at t = 0.5, the subdivided control points are:
- Left half: [P0, P01, P02, P03]
- Right half: [P03, P12, P21, P3]
This subdivision property is useful for rendering, intersection calculations, and adaptive approximation of Bezier curves.
Bezier Surfaces
- Construction: Tensor product of Bezier curves
- Control Net: Array of control points that define the surface
- Equation: P(u,v) = Σi=0n Σj=0m Pi,j Bi,n(u) Bj,m(v)
Tensor Product Construction
A Bezier surface is created by taking a bidirectional net of control points Pi,j and applying the Bernstein basis in both parametric directions (u and v).
For a bicubic Bezier surface (n=3, m=3), we have a 4×4 grid of 16 control points and:
P(u,v) = Σi=03 Σj=03 Pi,j Bi,3(u) Bj,3(v)
Evaluating Bezier Surfaces
Bezier surfaces can be evaluated using a bivariate extension of the De Casteljau algorithm:
- Apply the De Casteljau algorithm to each row of control points using parameter u
- Apply the De Casteljau algorithm to the resulting points using parameter v
Alternatively:
- Apply the De Casteljau algorithm to each column of control points using parameter v
- Apply the De Casteljau algorithm to the resulting points using parameter u
Either approach yields the same result due to the tensor product structure.
Python Implementation for Bezier Surface Evaluation
def bezier_surface(control_points, u, v):
"""
Evaluate a Bezier surface at parameters (u, v).
Parameters:
- control_points: 2D array of control points
- u, v: Parameter values in range [0, 1]
Returns:
- Point on the Bezier surface at (u, v)
"""
# First pass: evaluate along rows (u parameter)
row_points = []
for row in control_points:
point = de_casteljau(row, u)
row_points.append(point)
# Second pass: evaluate along result (v parameter)
return de_casteljau(row_points, v)
Practical Applications
1. Curve Design
- Path Design: Creating smooth trajectories for animation or motion planning
- Font Design: Representing letter outlines in digital typography
- Boundary Representation: Defining object boundaries in modeling
2. Surface Design
- Product Design: Creating smooth surfaces for industrial design
- Character Modeling: Defining smooth surfaces for animation characters
- Architectural Design: Creating complex curved structures
Interactive Design Tools
Modern design software uses Bezier curves and surfaces as fundamental building blocks:
- Adobe Illustrator/Photoshop: Pen tool creates Bezier paths
- Blender/Maya: Curve and surface tools based on Bezier formulations
- AutoCAD/SolidWorks: Curve and surface design tools
Rendering Bezier Curves
While Bezier curves are defined mathematically as continuous functions, for rendering purposes they are typically approximated using line segments or other primitives.
The common approach is:
- Evaluate the curve at a set of parameter values: t = 0, Δt, 2Δt, …, 1
- Connect the resulting points with line segments
More sophisticated approaches include:
- Adaptive subdivision based on curvature
- Conversion to other primitive types supported by graphics hardware
Limitations and Solutions
- Local Control: Lack of local control with pure Bezier curves
- Solution: Use piecewise Bezier curves
- Degree Elevation: Increasing the degree of a curve without changing its shape
- Degree Reduction: Approximating a high-degree curve with a lower-degree one
Piecewise Bezier Curves
To achieve local control, multiple Bezier curve segments can be joined together. For smoothness, continuity conditions must be enforced at join points:
- C0 continuity: Endpoint of one segment equals the start point of the next
- C1 continuity: First derivatives are equal at join points
- C2 continuity: Second derivatives are equal at join points
For cubic Bezier curves with control points [Pi,0, Pi,1, Pi,2, Pi,3] and [Pi+1,0, Pi+1,1, Pi+1,2, Pi+1,3]:
- C0 continuity: Pi,3 = Pi+1,0
- C1 continuity: Pi,3 - Pi,2 = α(Pi+1,1 - Pi+1,0), where α > 0
- C2 continuity: Additional constraints on control points
Degree Elevation
Degree elevation allows representing a Bezier curve of degree n as a Bezier curve of degree n+1 without changing its shape. The new control points are:
Pi’= (i/(n+1))Pi-1 + (1-i/(n+1))Pi for i = 0, 1, …, n+1
Where P-1 and Pn+1 are defined as P0 and Pn respectively.
Example: Elevating a Quadratic to Cubic
For a quadratic Bezier curve with control points [P0, P1, P2], the elevated cubic control points are:
- P0’ = P0
- P1’ = (1/3)P0 + (2/3)P1
- P2’ = (2/3)P1 + (1/3)P2
- P3’ = P2
Exam Focus Areas
- Bernstein Basis: Understanding and evaluating the basis functions
- De Casteljau Algorithm: Implementation and geometric interpretation
- Curve Properties: Understanding and applying the key properties
- Curve Manipulation: Degree elevation, subdivision, joining curves
- Surface Construction: Building and evaluating Bezier surfaces
Common Exam Questions
- Analytical: Derive the Bernstein basis functions for degree n
- Computational: Evaluate a Bezier curve at a specific parameter value
- Geometric: Describe the effect of moving control points
- Algorithmic: Trace through the De Casteljau algorithm steps
- Application: Design a piecewise Bezier curve with specific continuity
Practice Problems
- Implement the De Casteljau algorithm for a cubic Bezier curve
- Find the derivative of a Bezier curve and evaluate it at a specific parameter
- Perform degree elevation on a quadratic Bezier curve
- Create a C1 continuous piecewise Bezier curve from given control points
Challenge Problem
Design a piecewise cubic Bezier curve that passes through the points (0,0), (2,3), (5,1), and (7,4) with C1 continuity, and derive the necessary control points.
Original lecture notes are available at: /files/CE7453/CE7453/03-BeizerTechniques-4slides1page(1).pdf