Algorithm Search⌘K

Techniquecore

Energy-based surface fairing

Also called variational surface fairing, thin plate energy fairing.

Smooths a B-spline curve or surface by minimising a quadratic energy such as the thin plate energy plus a fitting term, so it is fair and close to the data.

Energy-based fairing makes a curve or a surface smooth by choosing its control points to minimize an energy. The energy measures how much the surface bends, and a second term, if there is one, measures how far it is from the data. The usual choice is the linearized thin plate energy ∬∣Suu∣2+2∣Suv∣2+∣Svv∣2 du dv\iint |S_{uu}|^2 + 2 |S_{uv}|^2 + |S_{vv}|^2 \, du \, dv. It is a quadratic form in the control points, so with linear constraints, such as fixed boundary curves or points to interpolate, the best control points solve one linear system. That is the main reason for its use: the fairest surface in this sense costs one sparse linear solve. The nonlinear energies of minimum variation surfaces give better shapes at a much higher cost.

In plain words

Think of a thin sheet of steel. Pin it at some points, or clamp its edges, and it settles into the shape that bends least. That shape is smooth and calm, with no bumps that the pins do not force. Energy-based fairing imitates this sheet. It writes down a number that is large when the surface bends a lot, and it moves the control points to make that number as small as possible, while the surface still meets the conditions the designer set. If the surface must also follow measured points, a second number counts the misfit, and a weight says how much smoothness may cost in accuracy. Because both numbers are simple sums of squares, the best control points come from one system of linear equations.

When it applies

Use it when a surface is given by a control net and some linear conditions, and the shape between the conditions is free: a patch with fixed boundary curves, a surface through scattered points, a surface fitted to noisy measured points, or a surface whose control net was edited by hand and has bumps. It applies to B-spline and Bezier curves and surfaces, to subdivision surfaces and, in discrete form, to meshes. It needs a parametrization that is not too far from uniform in arc length, since the linearized energy measures parameter derivatives, not curvature.

The template

The energies. Let S(u,v)=∑i,jNi(u)Mj(v)PijS(u, v) = \sum_{i, j} N_i(u) M_j(v) P_{ij} be a tensor product B-spline surface on [a,b]×[c,d][a, b] \times [c, d]. The membrane energy and the linearized thin plate energy are

Em(P)=∬∣Su∣2+∣Sv∣2 du dv,Et(P)=∬∣Suu∣2+2∣Suv∣2+∣Svv∣2 du dv.E_m(P) = \iint |S_u|^2 + |S_v|^2 \, du \, dv, \qquad E_t(P) = \iint |S_{uu}|^2 + 2 |S_{uv}|^2 + |S_{vv}|^2 \, du \, dv.

The true bending energy of a thin plate is ∬κ12+κ22 dA\iint \kappa_1^2 + \kappa_2^2 \, dA, with the principal curvatures κ1,κ2\kappa_1, \kappa_2. For a height field z(x,y)z(x, y) with small slopes, κ12+κ22=(κ1+κ2)2−2κ1κ2≈(zxx+zyy)2−2(zxxzyy−zxy2)=zxx2+2zxy2+zyy2\kappa_1^2 + \kappa_2^2 = (\kappa_1 + \kappa_2)^2 - 2 \kappa_1 \kappa_2 \approx (z_{xx} + z_{yy})^2 - 2 (z_{xx} z_{yy} - z_{xy}^2) = z_{xx}^2 + 2 z_{xy}^2 + z_{yy}^2, which is EtE_t. For a parametric surface EtE_t is close to the bending energy only where the parametrization is close to an isometry. The fitting term for data points QkQ_k at parameters (uk,vk)(u_k, v_k) is D(P)=∑k∣S(uk,vk)−Qk∣2D(P) = \sum_k |S(u_k, v_k) - Q_k|^2.

  1. FAIR(knots, degrees, data Q_k at (u_k, v_k), weights λ, α, β, constraints C p = r)
  2. 1G_a ← the Gram matrix of the a-th derivatives in u, (G_a)_{ik} = ∫ N_i^{(a)} N_k^{(a)} du, for a = 0, 1, 2; H_a the same in v
  3. 2K ← α (G_1 ⊗ H_0 + G_0 ⊗ H_1) + β (G_2 ⊗ H_0 + 2 G_1 ⊗ H_1 + G_0 ⊗ H_2)
  4. 3A ← the collocation matrix, A_{k,(ij)} = N_i(u_k) M_j(v_k)
  5. 4M ← AᵀA + λ K; b ← AᵀQ, one column for each coordinate
  6. 5solve [M Cᵀ; C 0] [p; μ] = [b; r] for each coordinate ▷ hole: a sparse symmetric solver
  7. 6return the surface with the control net p

Line L2 is the energy matrix KK of αEm+βEt\alpha E_m + \beta E_t, and line L4 adds the fitting term. The constraints Cp=rC p = r are any linear conditions: fixed control points, points the surface must interpolate, or tangent conditions along a boundary. Line L5 is the system of the KKT conditions, with Lagrange multipliers μ\mu. With no constraints it is Mp=bM p = b, and with fixed control points only, it is Mp=bM p = b restricted to the free points. Each coordinate is solved with the same matrix, so one factorization serves all three.

Theorem 1 (the energies are quadratic forms). For each coordinate, write pp for the vector of that coordinate of the control points. Then Et(P)=∑coordinatespTKtpE_t(P) = \sum_{\text{coordinates}} p^{\mathsf T} K_t p with Kt=G2⊗H0+2G1⊗H1+G0⊗H2K_t = G_2 \otimes H_0 + 2 G_1 \otimes H_1 + G_0 \otimes H_2, and KtK_t is symmetric and positive semidefinite. The same holds for EmE_m with Km=G1⊗H0+G0⊗H1K_m = G_1 \otimes H_0 + G_0 \otimes H_1.

Proof. The surface is linear in the control points, and so are its derivatives: Suu=∑i,jNi′′(u)Mj(v)PijS_{uu} = \sum_{i, j} N_i''(u) M_j(v) P_{ij}. For one coordinate,

∬Suu2 du dv=∑i,j∑k,lpijpkl∫Ni′′Nk′′ du∫MjMl dv=∑(i,j),(k,l)pij(G2)ik(H0)jl pkl,\iint S_{uu}^2 \, du \, dv = \sum_{i, j} \sum_{k, l} p_{ij} p_{kl} \int N_i'' N_k'' \, du \int M_j M_l \, dv = \sum_{(i, j), (k, l)} p_{ij} (G_2)_{ik} (H_0)_{jl} \, p_{kl},

because the integrand is a product of a function of uu and a function of vv. The matrix with the entries (G2)ik(H0)jl(G_2)_{ik} (H_0)_{jl} is the Kronecker product G2⊗H0G_2 \otimes H_0. The terms with SuvS_{uv} and SvvS_{vv} give G1⊗H1G_1 \otimes H_1 and G0⊗H2G_0 \otimes H_2 in the same way, and the sum over the coordinates gives ∣Suu∣2|S_{uu}|^2 and the rest. Each Gram matrix is symmetric, so KtK_t is symmetric. Since Et≥0E_t \ge 0 for every pp, KtK_t is positive semidefinite. □\square

The kernel of KtK_t is the set of nets with Et=0E_t = 0, that is with Suu=Suv=Svv=0S_{uu} = S_{uv} = S_{vv} = 0, which are the nets of the affine maps S=a+bu+cvS = a + b u + c v. So EtE_t alone does not fix a surface: the constraints or the data must rule out the affine motions.

Theorem 2 (the minimizer solves a linear system). Let M=ATA+λKM = A^{\mathsf T} A + \lambda K with λ≥0\lambda \ge 0, so that the objective is F(p)=∣Ap−Q∣2+λpTKp=pTMp−2bTp+∣Q∣2F(p) = |A p - Q|^2 + \lambda p^{\mathsf T} K p = p^{\mathsf T} M p - 2 b^{\mathsf T} p + |Q|^2. A vector p∗p^\ast with Cp∗=rC p^\ast = r minimizes FF over {p:Cp=r}\{p : C p = r\} if and only if there is a μ\mu with Mp∗+CTμ=bM p^\ast + C^{\mathsf T} \mu = b. If CC has full row rank and hTMh>0h^{\mathsf T} M h > 0 for every h≠0h \ne 0 with Ch=0C h = 0, the system of line L5 is nonsingular, and the minimizer is unique.

Proof. Every feasible point is p=p∗+hp = p^\ast + h with Ch=0C h = 0, and

F(p∗+h)−F(p∗)=2hT(Mp∗−b)+hTMh.F(p^\ast + h) - F(p^\ast) = 2 h^{\mathsf T} (M p^\ast - b) + h^{\mathsf T} M h.

If Mp∗−b=−CTμM p^\ast - b = -C^{\mathsf T} \mu, the first term is −2(Ch)Tμ=0-2 (C h)^{\mathsf T} \mu = 0, and the second is at least 00 because MM is positive semidefinite (Theorem 1, and ATAA^{\mathsf T} A is a Gram matrix). So p∗p^\ast is a minimizer. Conversely, if p∗p^\ast is a minimizer, then for each hh with Ch=0C h = 0 the function t↦F(p∗+th)t \mapsto F(p^\ast + t h) has its minimum at t=0t = 0, so its derivative 2hT(Mp∗−b)2 h^{\mathsf T}(M p^\ast - b) there is 00. Hence Mp∗−bM p^\ast - b is orthogonal to the null space of CC, so it is in the range of CTC^{\mathsf T}, which gives μ\mu. For the last claim, let Mh+CTν=0M h + C^{\mathsf T} \nu = 0 and Ch=0C h = 0. Then 0=hTMh+(Ch)Tν=hTMh0 = h^{\mathsf T} M h + (C h)^{\mathsf T} \nu = h^{\mathsf T} M h, so h=0h = 0, then CTν=0C^{\mathsf T} \nu = 0, and ν=0\nu = 0 because CC has full row rank. □\square

Worked example. Take a bicubic Bezier patch, so each NiN_i and MjM_j is a cubic Bernstein polynomial on [0,1][0, 1], with the control points (i3,j3,zij)(\frac i3, \frac j3, z_{ij}). Fix the twelve boundary points, with the heights 0,1,1,00, 1, 1, 0 along each edge, and let the four inner points be free. Use EtE_t alone (λ=0\lambda = 0, α=0\alpha = 0, β=1\beta = 1). The xx and yy coordinates of the net are affine, so they have zero energy and stay on the grid, and only the four inner heights are unknown. For the cubic Bernstein basis G0G_0 has the entries 17(3i)(3k)/(6i+k)\frac{1}{7} \binom{3}{i} \binom{3}{k} / \binom{6}{i + k}, and G2G_2 is

G2=(12−1806−1836−1800−1836−1860−1812).G_2 = \begin{pmatrix} 12 & -18 & 0 & 6 \\ -18 & 36 & -18 & 0 \\ 0 & -18 & 36 & -18 \\ 6 & 0 & -18 & 12 \end{pmatrix}.

The 4×44 \times 4 system of line L5 has the same right side 545\frac{54}{5} in each row, and its solution is z11=z12=z21=z22=1211z_{11} = z_{12} = z_{21} = z_{22} = \frac{12}{11}. On the line where the four inner heights are equal to ss, the energy is Et=15(198s2−432s+432)E_t = \frac15 (198 s^2 - 432 s + 432), with its minimum 43211≈39.27\frac{432}{11} \approx 39.27 at s=1211s = \frac{12}{11}. The obvious guess s=1s = 1 gives 1985=39.6\frac{198}{5} = 39.6, and s=0s = 0 gives 86.486.4. At the centre the fair patch has height 8788\frac{87}{88}, against 1516\frac{15}{16} for s=1s = 1. The fair surface lifts the inner points a little above the edge points, to round off the top, as a bent plate does.

Classic examples

  • Variational design. Welch and Witkin show the user a surface with no fixed control points: within the constraints that the user places, the shape is the one that minimizes a smoothness energy, so the user edits by constraints and not by control points.
  • Deformable finite elements. Celniker and Gossard build curve and surface elements that deform to minimize an energy functional under geometric constraints and loads that the user controls.
  • Data dependent energies. Greiner keeps the energy quadratic but measures the derivatives with the help of a reference surface, so that the functional is a simplified form of the geometric thin plate energy and is still cheap to minimize.
  • Smoothing splines. For curves, ∑k∣c(tk)−Qk∣2+λ∫∣c′′∣2\sum_k |c(t_k) - Q_k|^2 + \lambda \int |c''|^2 is the smoothing spline functional, and its minimizer over all functions is a natural cubic spline.
  • Mesh fairing. On a mesh, the cotangent Laplacian gives discrete membrane and thin plate energies, and implicit fairing solves the same kind of sparse system.

Variations

  • Other quadratic energies. Third derivative energies, such as ∬∣Suuu∣2+3∣Suuv∣2+3∣Suvv∣2+∣Svvv∣2\iint |S_{uuu}|^2 + 3 |S_{uuv}|^2 + 3 |S_{uvv}|^2 + |S_{vvv}|^2, measure the change of curvature and are still quadratic.
  • Hard and soft constraints. A condition can be a row of CC, which holds exactly, or a term of the fitting sum, which holds approximately with a weight.
  • Fairing within a tolerance. Minimize the energy subject to ∣S(uk,vk)−Qk∣≤ε|S(u_k, v_k) - Q_k| \le \varepsilon. The constraints are then quadratic inequalities, and the problem is a convex program, not a linear system.
  • Nonlinear energies. The exact thin plate energy ∬κ12+κ22 dA\iint \kappa_1^2 + \kappa_2^2 \, dA and the curvature variation energy of minimum variation surfaces depend on the geometry, not on the parametrization, and need nonlinear optimization.
  • Local fairing. Minimize the energy over the control points of one region only, with the rest fixed, to remove a local defect.

Pitfalls

  • The measure is a design criterion. No energy defines fairness. A minimum of EtE_t is the fairest surface only in the sense of EtE_t, and designers judge the result by reflection lines and curvature plots, which can disagree with the energy.
  • Parametrization dependence. EtE_t measures parameter derivatives. A surface with uneven parameter speed is faired toward even speed, which can move the surface in ways that are not wanted, and the same shape with another parametrization gives another result.
  • Too few constraints. Without data or enough fixed points the affine nets have zero energy, and MM is singular on the null space of CC.
  • Weights. The result depends on λ\lambda, α\alpha and β\beta. A large weight on smoothness pulls the surface away from the data, and a small one keeps the noise. The weights also depend on the units of the data.
  • Shrinking. With the membrane energy alone, the surface pulls inward like a soap film and flattens bumps that should stay.
  • Dense assembly. The matrix MM is sparse and banded for B-splines, with bandwidth set by the degrees. Assembling it as a dense matrix wastes time and memory for large nets. Use a sparse Cholesky factorization or the conjugate gradient method.

Exercises

  1. Show that for a cubic Bezier curve with control values b0,…,b3b_0, \dots, b_3 on [0,1][0, 1], ∫01(c′′)2 dt=12(a02+a0a1+a12)\int_0^1 (c'')^2 \, dt = 12 (a_0^2 + a_0 a_1 + a_1^2) with a0=b0−2b1+b2a_0 = b_0 - 2 b_1 + b_2 and a1=b1−2b2+b3a_1 = b_1 - 2 b_2 + b_3.
  2. In the worked example, verify Et(s)=15(198s2−432s+432)E_t(s) = \frac15 (198 s^2 - 432 s + 432) from the matrices G0G_0, G1G_1 and G2G_2, and explain by symmetry and Theorem 2 why the four inner heights of the minimizer are equal.
  3. Show that the bilinear surface S=(u,v,uv)S = (u, v, u v) written as a bicubic Bezier patch minimizes EtE_t among all bicubic patches with its boundary. Hint: check that Suu=Svv=0S_{uu} = S_{vv} = 0 and compute the derivative of EtE_t along any change of the inner points.
  4. Let the constraints fix some control points, with ff the indices of the free points and cc those of the fixed ones. Show that the system of line L5 reduces to Mffpf=bf−MfcrM_{ff} p_f = b_f - M_{fc} r, and that MffM_{ff} is positive definite when the minimizer is unique.

References

  1. Günther Greiner, Variational design and fairing of spline surfaces, Computer Graphics Forum 13(3), 143 to 154, 1994, fairness functionals as simplified thin plate energies for parametric surfaces, made quadratic by a reference parametrization
  2. George Celniker and Dave Gossard, Deformable curve and surface finite-elements for free-form shape design, SIGGRAPH 1991, 257 to 266, surfaces that minimize a stretching and bending energy under geometric constraints and loads
  3. Welch and Witkin 1992, free-form surfaces whose shape, within the constraints set by the user, is fixed by a smoothness criterion
  4. Henry P. Moreton and Carlo H. Séquin, Functional optimization for fair surface design, Computer Graphics 26(2), 167 to 176, 1992, the comparison of the thin plate energy with the curvature variation functional

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW3 standard
  • five exercises