Implementing curves and surfaces with lots of points is inefficient. We want higher-level representation of curves and surfaces. Specifically, we would like to find a smooth curve/surface with a minimal number of control points.
Parametric Geometry
p(t)=(x(t),y(t))
p(u,v)=(x(u,v),y(u,v),z(u,v))
e.g. parameterized line passing through (t0,p0),(t1,p1) is
p(t)=t1−t0t1−tp0+t1−t0t−t0p1
Why parameteric?
It matches the intrinsic dimension of objects we want to manipulate. Curves are 1D, surfaces are 2D. It may exist in higher dimensions, but it doesn't matter!
Also, once a curve/surface is parameterized, sampling process is easy, so our graphics hardware can render easily. We can sample like P(0),P(0.1),P(0.2),…
Differential Properties of Parameteric Curves
Velocity
Instantaneous positional change: P′(t)
Tangent
Normalized velocity vector: T(t):=∥P′(t)∥P′(t)
Curvature
Instantaneous tangential change: K(T):=T′(t) Curvature is always orthogonal to tangent, K(t)⋅T(t)=0
In geometry, ∥K(t)∥1 is same as the radius of the circle that touches P(t) at t.
Curve Normal
Normalized curvature vector: N(t):=∥K(t)∥K(t)
In 3D, there is also a binormal vector: B(t):=T(t)×N(t)
Tangent vector, Curve normal vector, Binormal vector form a coordinate system called Frenet frame. However, it is not well defined (curvature can be 0).
1D Interpolation
If n+1 points (0,x0),(t1,x1),…(tn−1,xn−1),(1,xn) are given, degree is n, and order is n + 1.
We can think cubic polynomial as a 4D vector (a,b,c,d) of which bases are t3,t2,t,1. We can change bases to use independent bases instead of monomial bases.
Deritvatives are 3 times difference between control points. x′(0)=3(x1−x0),x′(1)=3(x3−x2)
The curve is contained in the convex hull of the control polygon.
Invariance under affine transformation. i.e. Applying affine transformation to the curve is the same as applying affine transformation to the control points then evaluating the curve.
De Casteljau Algorithm
x(t) can be evaluated by recursively interpolating control points with the ratio of (t, 1-t).
After De Casteljau algorithm, bezier curve can be divided into two parts with new control polygons! x0,x0(1)(t),x0(2)(t),x(t) and x(t),x1(2)(t),x2(1)(t),x3 forms two control polygons.
2D, 3D Interpolation
Curves in higher dimensions can be constructed by simply expanding coordinates.
P(t)=(x(t),y(t),z(t)),P′(t)=(x′(t),y′(t),z′(t))
e.g. 2D Bezier Curve is constructed from four control points:
A piecewise polynomial with a high degree of smoothness where pieces meet. Use multiple curves to make complex curve!
e.g. TrueType fonts use quadratic bezier curve, and PostScript fonts use cubic bezier curve.
Continuity
To ensure a smooth transition from one section of a piecewise parametric spline to the next, we can impose various continuity conditions at the connection points.
Parametric continuity: Matching the parametric derivatives of adjoining curve sections at their common boundary
Geometric continuity: Geometric smoothness independent of parametrization (i.e. parametrization can be different between curves!)
Orders of Continuity
C0, G0 continuity (positional continuity): The positions of common control points are the same
G1 continuity (tangency continuity): C0 and the directions of derivates are the same
C1 continuity: C0 and the derivatives are the same
G2 continuity (curvature continuity): G1 and the second derivatives (or curvature) are the same
C2 continuity: C1 and the second derivatives (or curvature) are the same
G2, C2 continuity is extremely hard...
e.g. When connecting cubic bezier curves,
C0 continuity is guaranteed if points are same.
G1 continuity is guaranteed if three control points are on a straight line.
C1 continuity is guaranteed if three control points are on a straight line, and the distance is the same. (recall: bezier curve's derivative is 3 times difference between control points.)
c.f. Fonts someimtes need to be angled. Solution: Overlap control points! By overlapping two control points, we lose C1 continuity, but we get angled curve.
Bezier Splines with Tangent Conditions
Bezier curve is tedious - we need to position every control points carefully.
Instead, just give points and tangent vectors of each points. Then we can poisition control points by moving 1/3 of the tangent vector.
Catmull-Rom Splines
Giving tangent vectors is tedious - just give points and calculate tangent vectors! First and last tangents are set to be zero, and other tangents are set to difference between adjacent points.
p0′=pn′=0,pi′=2pi+1−pi−1
Only points are needed to create C1 continuous curve that passes through them! We can either position control points and draw a Bezier spline, or draw a Hermite spline directly.
Natural Cubic Splines
Is C1 enough? Car surface have to guarantee at least G3 continuity. Theoretically, splines of degree n can guarantee Cn−1 continuity.
Given n + 1 control points, we want to find n connected Bezier curves passing through the points with C2 continuity.
We have 4n unknowns (4 control points per each curve)
We have 4n-2 equations
2n equations for end point interpolations
n-1 equations for tangential continuity
n-1 equations for second derivative continuity
We need 2 more equations! We need to specify boundary conditions.
For open curve, p′′(t0)=p′′(tn)=0 (i.e., curve ends with a straight line)
For closed curve, p′(t0)=p′(tn) and p′′(t0)=p′′(tn)
Natural Cubic Splines is affine-invariant! But we lose local controllability, i.e. moving one point affects the entire curve.
B-splines
Motivation: We need C2 continuous curve with local controllability.
Use all four consecutive points as control points. e.g. p0,p1,p2,p3 forms control points, p1,p2,p3,p4 forms control points, ...
We get local controllability, but we lose interpolation, i.e. curves no longer pass through any points.
Curve segment is changed when t becomes an integer. Since curve segment is changed uniformly, (i.e. knots are equally spaced) this spline is called uniform cubic B-spline.
Properties of B-splines
Convex hull
Affine invariance
Cn−1 continuity
Local controllability
Variation diminishing: B-spline never crosses any given plane more often than its control polygon does.
We can compute control points of the B-spline curve from control points of the Bezier curve. Parametrization is different, but curves are same!
NURBS (Non-Uniform Rational B-Spline)
p(t)=∑wjBj(t)∑wjpjBj(t)
Generalized version of B-Splines! We use rational polynomial to represent conics (circle, ellipses, hyperbolics). Rational polynomial is invariant under projective transformation. Non-uniform means we can use non-uniform location of knots.
We need 4x4 control points and 4x4 2D basis functions to create a surface. Each sub-surface is called patch.
Also called bicubic tensor product surface because it's cubic bezier curve in two direction, and surface is made with tensor product of two bezier curves.
Tensor Product B-Spline Patches, Rational splines, NURBS is also possible!