CS184 Lecture 19 summary

Parametric and Geometric Continuity

The point of modeling with smooth curves and surfaces is to create realistic smooth shapes. But what exactly do we mean by "smooth"? How precisely do we determine if a given curve or surface is smooth? The simplest way to answer this question is to look at continuity.

Recall that a parametric curve is defined as:

x(s)
y(s)
z(s)

Now the functions x(s) will need to satisfy a lot of geometric constraints typically (think of a curve that represents a hand-written word or a spiral). Rather than trying to do this with a single smooth function, its more often done with many smooth functions (polynomials or rational functions) that are smoothly joined.

Generally a function is smooth if its derivatives are well-defined up to some order. There are actually two definitions for curves and surfaces, depending on whether the curve or surface is viewed as a function or purely a shape.

Parametric Continuity

For parametric continuity, we view the curve or surface as a function rather than a shape. Parametric continuity cannot be defined given only the shape of the curve. You need a parametrization of it.

A junction between two curves is said to be C0-continuous if the (x, y, z)-values of the two curves agree. Alternatively, this is called zeroth-order parametric continuity.

A junction between two curves is said to be C1-continuous if the (x, y, z)-values of the two curves agree, and all their first derivates (dx/ds, dy/ds, dz/ds) agree at their junction. Alternatively, this is called first-order parametric continuity.

A junction between two curves is said to be C2-continuous if the (x, y, z)-values of the two curves agree, and their first and second parametric derivates all agree at their junction. Alternatively, this is called second-order parametric continuity.

Similarly, we define nth-order parametric continuity (Cn continuity) by requiring that all derivatives up to nth order agree at the junction.

Geometric Continuity

Geometric continuity can be defined using only the shape of the curve. It is usually defined in terms of parametrizations, but the choice of parametrization does not affect the outcome.

A junction between two curves is said to be G0-continuous if the (x, y, z)-values of the two curves agree. Alternatively, this is called zeroth-order geometric continuity. It is exactly the same as  C0 continuity.

A junction between two curves is said to be G1-continuous if the (x, y, z)-values of the two curves agree, and all their first derivates (dx/ds, dy/ds, dz/ds) are proportional (the tangent vectors are parallel) at their junction. Alternatively, this is called first-order geometric continuity.

Higher order geometric continuity is a bit tricky to define. One way to do it is to use arclength-based definitions of derivatives. That is, if the nth-order derivatives of the two curves wrt an arclength parameter s, then the curve is Gn continuous at the junction.

Graph of the Curve

One way to relate the two sets of definitions is to think about the graph of a parametric curve. The graph of the curve (x(s), y(s), z(s)) is the plot of its values in (x, y, z, s) space.

Then a curve is Cn continuous if and only if its graph is Gn continuous in 4-space.

Generally, we care more about geometric continuity than parametric continuity. But it is harder to compute. While the conditions for parametric continuity seem stronger than geometric continuity, they are not. There are C1 curves that are not G1.

Cubic Interpolating Splines

Consider the simplest task of passing a cubic polynomial

x(u) = au3 + bu2 + cu + d

Through a series of points. There are 4 parameters (a, b, c, d) and we could either make this curve pass through 4 points, or make it pass through 2 points and specify the first derivative at those points.

Each of those is a linear equation in (a, b, c, d). E.g. specifying x(1) gives

x(1) = a + b + c + d

Specifying x'(1) gives:

x'(1) = 3a + 2b + c

etc.

So the vector of initial values (x(1), x(0), x'(1), x'(0)) is a linear function of the vector (a, b, c, d), given by a 4x4 matrix M. By inverting M, we can write (a, b, c, d) as a linear function of the vector (x(1), x(0), x'(1), x'(0)).

In fact, we can think of the rows of the matrix M as defining a new polynomial basis. That basis gives the polynomial equation directly in terms of the constraints:

x(u) = (2u3 - 3u2 + 1) x(0)
       + (-2u3 + 3u2) x(1)
       + (u3 - 2u2 + u) x'(0)
       + ( u3 - u2) x'(1)

The old basis was just the power basis, where the basis polynomials are powers of u. The new basis consists of polynomials which  are

H0(u) = (2u3 - 3u2 + 1)
H1(u) = (-2u3 + 3u2)
H2(u) = (u3 - 2u2 + u)
H3(u) = (u3 - u2)

This is called a Hermite basis. Its the natural basis to use when you want to interpolate through known points with known first derivatives. Once you have compute the Hermite polynomials, there is almost no work to do to derive an interpolating curve from the endpoint constraints. Its simply a sum of the basis polynomials weighted by the constraints x(0), x(1), x'(0) and x'(1).

The shape of the Hermite polynomials is intuitive. Look at the graphs in Hearn and Baker to see how their values and derivatives support their role in interpolation.

Natural Cubic Splines

Often you dont want to specify the derivatives at all intermediate pointsalong a curve, you simply want them to be the same for the curve on both sides of a via point. If you add the condition that derivatives agree, you get equations like

x1(1) = x2(0) = p1
x1'(1) = x2'(0)
x1''(1) = x2''(0)

That is, 4 equations for each intermediate point. At the two endpoints, if you specify the point location and the first derivative, you get exactly 4n-4 equations, which is enough to specify the parameters of n-1 cubic curves to interpolate all the points. Solving this system yields a natural cubic spline to interpolate the points with C2 continuity.

Its disadvantage is the the entire curve shape depends on all of the via point positions. Changing any one of them changes the entire curve.