Prev: W4, Next: W6
Links: Zoom, TopHat (993679, or Form), Calculator:
Slide:

# Smoothness of Curves

📗 Smoothness of curves are usually defined by whether there are abrupt changes.
➩ Breaks or gaps.
➩ Corners.
➩ Changes in higher derivatives.
📗 Mathematically, continuity at a point at \(u\) is defined as the \(\lim_{x \to  u^{-}} f\left(x\right) = f\left(u\right) = \lim_{x \to  u^{+}} f\left(x\right)\).

# Parametric vs Geometric Continuity

📗 A curve is \(C\left(n\right)\) continuous if all derivatives up to \(n\) match.
➩ \(C\left(0\right)\) if \(f\left(u\right)\) is continuous.
➩ \(C\left(1\right)\) if \(f'\left(u\right)\) is continuous.
➩ \(C\left(2\right)\) if \(f''\left(u\right)\) is continuous.
📗 A curve is \(G\left(n\right)\) continuous if the directions of the derivatives match.
➩ \(G\left(0\right)\) if there are no gaps.
➩ \(G\left(1\right)\) if there are no corners.
➩ \(G\left(2\right)\) if the curve looks smooth.
📗 \(C\left(n\right)\) continuity depends on the parameterization of a curve.
📗 \(G\left(n\right)\) continuity only depends on the curve, not its parameterization.



# Polynomial Fit

📗 Given \(n\) points, to find a polynomial curve that passes through all the points, a polynomial of degree \(n - 1\) is needed.
➩ The coefficients are hard to compute (regression).
➩ The curve is hard to control.
➩ There can be unwanted wiggles.
➩ The resulting curve is \(C\left(\infty\right)\).
📗 Alternative 1: piecewise linear interpolation.
➩ The line segments are easy to control and predict.
➩ Only \(C\left(0\right)\).
📗 Alternative 2: piecewise polynomials (Hermite spline): Wikipedia.
➩ Connect the curves so that \(p'_{1}\) of the first segment is the same as \(p'_{0}\) of the second segment.
➩ This uses Hermite form polynomial.
➩ It requires specifying the derivatives at every point.
➩ The result is \(C\left(1\right)\).
📗 Alternative 3: piecewise polynomials (Cardinal spline): Wikipedia.
➩ Compute the derivative using the previous and next control points, meaning \(p'_{0} = s \left(p_{1} - p_{-1}\right)\) and \(p'_{1} = s \left(p_{2} - p_{0}\right)\), where \(s\) specifies the tension.
➩ When \(s = \dfrac{1}{2}\), the resulting spline is called Catmull-Rom spline.
➩ This works for closed loop too. Try this in Workbook 5.
➩ The result is \(C\left(1\right)\).

# Hermit Spline [ICA]

📗 The curve is not \(C\left(1\right)\) or \(G\left(1\right)\).
📗 Change the derivatives so that the resulting curve is \(C\left(1\right)\).
📗 Change the derivatives so that the resulting curve is \(G\left(1\right)\) but not \(C\left(1\right)\).
Demo curve_tangent_too



# Cardinal Catmull-Rom Spline [ICA]

📗 Catmull-Rom splines have \(p'_{0} = \dfrac{1}{2} \left(p_{1} - p_{-1}\right)\) and \(p'_{1} = \dfrac{1}{2} \left(p_{2} - p_{0}\right)\) for every curve segment connecting \(p_{0}\) and \(p_{1}\) and use the previous \(p_{-1}\) and next control \(p_{2}\) control points to compute the derivatives at \(p_{0}\) and \(p_{1}\).
Demo cardinal

# Chaikin's Algorithm

📗 Another subdivision curve that does not interpolate the control points is the B-spline (basis spline): Wikipedia.
📗 Chaikin's corner cutting algorithm can be used and the limit curve is a (uniform) quadratic B-spline.
📗 Quadratic B-spline can also be written in the form \(f\left(u\right) = \dfrac{1}{2} \left(1 - u\right)^{2} p_{1} + \left(-u^{2} + u + \dfrac{1}{2}\right) p_{2} + \dfrac{1}{2} u^{2} p_{3}\) (see Workbook readings for more details).
📗 Quadratic B-spline is \(C\left(1\right)\).
Demo cut_corner

# B Splines

📗 Cubic B-spline is \(C\left(2\right)\) and can be written as \(f\left(u\right) = \dfrac{1}{6} \left(-u^{3} + 3 u^{2} - 3 u + 1\right) p_{1} + \dfrac{1}{6} \left(3 u^{3} - 6 u^{2} + 4\right) p_{2} + \dfrac{1}{6} \left(-3 u^{3} + 3 u^{2} + 3 u + 1\right) p_{3} + \dfrac{1}{6} u^{3} p_{4}\) (see Workbook readings for more details).
📗 Cubic B-spline can be converted into Bezier curves with different control points \(\dfrac{1}{6} \left(p_{1} + 4 p_{2} + p_{3}\right)\), \(\dfrac{1}{3} \left(2 p_{2} + p_{3}\right)\), \(\dfrac{1}{3} \left(p_{2} + 2 p_{3}\right)\), \(\dfrac{1}{6} \left(p_{2} + 4 p_{3} + p_{4}\right)\): Wikipedia.
📗 In general, a degree n B-spline is \(C\left(n - 1\right)\). Professor Gleicher's demo: Link and Link.



# Arc Length Parameterization

📗 Parameterization with \(u\) in the Hermite form is also called the natural parameterization.
📗 Changing \(u\) at a constant speed does not move \(f\left(u\right)\) along the curve at a constant speed.
📗 Arc-length parameterization is a reparameterization of a curve so that changing the parameter \(t\) at a constant speed moves \(f\left(u\right)\) along the curve at a constant speed.
➩ Analytically computing the arc-length parameterization is difficult.
➩ It can be approximated numerically by making a table of points with distances between them.

# Distance Table [ICA]

📗 Given the following curve, find the point that divides the curve into two parts with equal arc length.
Demo arc_length

# Bezier Curve Game [ICA]

📗 Enter the control points of a quadratic or cubic Bezier curve and try to maximize the length and minimize collision with other curves.
Demo curve_game



# Oriented Particles

📗 Boids: bird-like objects: Wikipedia.
➩ Keep a constant speed.
➩ Change direction (turn) slowly.
➩ Represented by a position and a velocity (unit vector) or orientation (angle).

# Velocity Updates

📗 Position is updated by \(p' = p + v\).
📗 Velocity is updated by \(v' = A v\), where \(A\) is a rotation matrix, and the rotation angle can be computed by \(arctan\left(\dfrac{v'_{y}}{v'_{x}}\right)\) or atan2(v'y, v'x).
📗 Velocity can also be updated by \(v' = \left\|v\right\| \begin{bmatrix} \cos\left(\theta + \Delta \theta\right) \\ \sin\left(\theta + \Delta \theta\right) \end{bmatrix}\), where \(\left\|v\right\|\) is the constant speed, and \(\theta + \Delta \theta\) is the updated the rotation angle.

# Local Models

📗 Decide how to turn by looking at neighbors and world.
📗 Each boid figures their neighbors and decides independently.
📗 Interesting behaviors emerge from simple rules (flock, chase, avoid, ...).
📗 More examples: (bugs) Link, (boxes) Link, (cows) Link.
📗 Another example: (race cars) Link.

# Lecture Summary

📗 Curve continuity.
📗 Polynomial fit.
📗 Hermite and Cardinal splines.
📗 Chaikin algorithm.
📗 B splines.
📗 Arc length parameterization.


📗 Notes and code adapted from the course taught by Professor Michael Gleicher.
📗 Please use Ctrl+F5 or Shift+F5 or Shift+Command+R or Incognito mode or Private Browsing to refresh the cached JavaScript: Code.
📗 You can expand all the examples and demos: , or print the notes: .
📗 If there is an issue with TopHat during the lectures, please submit your answers on paper (include your Wisc ID and answers) or this Google Form at the end of the lecture.

Prev: W4, Next: W6





Last Updated: November 06, 2026 at 3:38 AM