Ax = b
where you solve for x: x = (AT * A)-1 * AT * b
When fitting bsplines these are the values for A, x, and b.
/ Nd0(t0) ... Ndn(t0) \ | . . | A = | . . | | . . | \ Nd0(tk) ... Ndn(tk) /
/ C0 c / Q0 \ | . | | . | x = | . | b = | . | | . | | . | \ Cn / \ Qn /
where
Usualy we want the end points of the samples to be the end points of the curve. To fix a control point to a sample point, set Ci = Qj. Now our matrix A has extra rows and columns. Remove row i. Remove column j but save it in another matrix (lets call it R). This is because we need to modify the samples so least squares still takes the fixed points into account.
so the new modified formula is: x' = (A'T * A')-1 * A'T * (b' - R * q)
with
/ | | \ R = | Ai1| ...| Aim| \ | | / / bj1 \ | . | q = | . | | . | \ bjp /where
generic m x n matrix template class, yay!
"Distrotion Minimization and Continutit Preservation in Surface Pasting", Ricky Ying-Kei Leung