Skip to content

Instantly share code, notes, and snippets.

/catmull-rom.nb

Created Jun 23, 2014
Embed
What would you like to do?
(* Barry-Goldman recursive algorithm for Catmull-Rom splines *)
L[i_, j_, \[Tau]_] := (t[j] - \[Tau])/(t[j] - t[i])
P[i] + (\[Tau] - t[i])/(t[j] - t[i]) P[j]
L[i_, j_,
k_, \[Tau]_] := (t[k] - \[Tau])/(t[k] - t[i])
L[i, j, \[Tau]] + (\[Tau] - t[i])/(t[k] - t[i]) L[j, k, \[Tau]]
S[i_, j_, \[Tau]_] := (t[j] - \[Tau])/(t[j] - t[i])
L[i - 1, i, j, \[Tau]] + (\[Tau] - t[i])/(t[j] - t[i])
L[j - 1, j, j + 1, \[Tau]]
S[1, 2, \[Tau]] /. {\[Tau] -> t[1]} // FullSimplify
S[1, 2, \[Tau]] /. {\[Tau] -> t[2]} // FullSimplify
D[S[1, 2, \[Tau]], \[Tau]] /. {\[Tau] -> t[1]} // FullSimplify
D[S[1, 2, \[Tau]], \[Tau]] /. {\[Tau] -> t[2]} // FullSimplify
P[1]
P[2]
(P[0] - P[1])/(t[0] - t[1]) + (-P[0] + P[2])/(t[0] - t[2]) + (
P[1] - P[2])/(t[1] - t[2])
(P[1] - P[2])/(t[1] - t[2]) + (-P[1] + P[3])/(t[1] - t[3]) + (
P[2] - P[3])/(t[2] - t[3])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.