MCPcopy
hub / github.com/Lightricks/ComfyUI-LTXVideo / catmullRom

Function catmullRom

web/js/sparse_track_editor.js:7–24  ·  view source on GitHub ↗
(p0, p1, p2, p3, t)

Source from the content-addressed store, hash-verified

5// ---------------------------------------------------------------------------
6
7function catmullRom(p0, p1, p2, p3, t) {
8 const t2 = t * t;
9 const t3 = t2 * t;
10 return {
11 x:
12 0.5 *
13 (2 * p1.x +
14 (-p0.x + p2.x) * t +
15 (2 * p0.x - 5 * p1.x + 4 * p2.x - p3.x) * t2 +
16 (-p0.x + 3 * p1.x - 3 * p2.x + p3.x) * t3),
17 y:
18 0.5 *
19 (2 * p1.y +
20 (-p0.y + p2.y) * t +
21 (2 * p0.y - 5 * p1.y + 4 * p2.y - p3.y) * t2 +
22 (-p0.y + 3 * p1.y - 3 * p2.y + p3.y) * t3),
23 };
24}
25
26function interpolateSpline(controlPoints, numSamples) {
27 if (controlPoints.length === 0) return [];

Callers 1

interpolateSplineFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected