Curves and Surfaces
Mathematical curves and surfaces allow smooth, continuous shapes to be defined by control points. They are essential for modeling organic shapes, fonts, and smooth surfaces.
Bezier Curves
Defined by control points. The curve starts at the first control point and ends at the last, with intermediate points pulling the curve toward them.
Quadratic Bezier (3 control points):
B(t) = (1-t)²P0 + 2(1-t)tP1 + t²P2 t ∈ [0,1]
P0 ---- P1 ---- P2
\ /
\ / Curve pulled toward P1
\ /
\ /
-------
Cubic Bezier (4 control points):
B(t) = (1-t)³P0 + 3(1-t)²tP1 + 3(1-t)t²P2 + t³P3
P0 ---- P1
\ /
\ / More flexible shape control
\ /
X
/ \
/ \
P3 ---- P2
De Casteljau's Algorithm
A numerically stable method for evaluating Bezier curves through repeated linear interpolation.
Cubic Bezier evaluation:
Given P0, P1, P2, P3 and parameter t:
Level 1:
Q0 = lerp(P0, P1, t)
Q1 = lerp(P1, P2, t)
Q2 = lerp(P2, P3, t)
Level 2:
R0 = lerp(Q0, Q1, t)
R1 = lerp(Q1, Q2, t)
Level 3:
S0 = lerp(R0, R1, t) ← point on curve at t
lerp(a, b, t) = (1-t)*a + t*b
B-Splines
Basis splines offer more control than Bezier curves. They are piecewise polynomial curves that pass through control points with continuity constraints.
B-Spline properties:
- Local control: moving one control point affects
only a portion of the curve
- Higher continuity at knots
- Defined by control points + knot vector
Cubic B-Spline basis functions:
N0(t) = (1-t)³/6
N1(t) = (3t³ - 6t² + 4)/6
N2(t) = (-3t³ + 3t² + 3t + 1)/6
N3(t) = t³/6
S(t) = Σ Ni(t) * Pi
NURBS
Non-Uniform Rational B-Splines extend B-splines with weights, allowing exact representation of conic sections (circles, ellipses, hyperbolas).
NURBS curve:
C(t) = Σ Wi * Ni(t) * Pi
-------------------
Σ Wi * Ni(t)
Wi = weight of control point Pi
Ni = B-spline basis function
Pi = control point
Weight > 1 → curve pulled toward Pi
Weight = 1 → standard B-spline
Weight < 1 → curve pushed away from Pi
Used in: CAD, 3D modeling, animation (Maya, 3ds Max)
Surfaces
Bézier Surface (tensor product):
S(u,v) = Σ Σ Bi,m(u) * Bj,n(v) * Pij
Where Bi,m are Bezier basis functions
Pij is the control point grid (m+1 x n+1)
NURBS Surface:
S(u,v) = Σ Σ Wi,j * Ni(u) * Nj(v) * Pij
-------------------------------
Σ Σ Wi,j * Ni(u) * Nj(v)