Implemented 2D visualization for notes using Vue Flow
This commit is contained in:
19
node_modules/d3-interpolate/src/basis.js
generated
vendored
Normal file
19
node_modules/d3-interpolate/src/basis.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
export function basis(t1, v0, v1, v2, v3) {
|
||||
var t2 = t1 * t1, t3 = t2 * t1;
|
||||
return ((1 - 3 * t1 + 3 * t2 - t3) * v0
|
||||
+ (4 - 6 * t2 + 3 * t3) * v1
|
||||
+ (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2
|
||||
+ t3 * v3) / 6;
|
||||
}
|
||||
|
||||
export default function(values) {
|
||||
var n = values.length - 1;
|
||||
return function(t) {
|
||||
var i = t <= 0 ? (t = 0) : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n),
|
||||
v1 = values[i],
|
||||
v2 = values[i + 1],
|
||||
v0 = i > 0 ? values[i - 1] : 2 * v1 - v2,
|
||||
v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;
|
||||
return basis((t - i / n) * n, v0, v1, v2, v3);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user