cubic-hermite-spline
Advanced tools
Comparing version 1.0.0 to 1.0.1
function interpolate(t, points, tangents, knots, derivative) { | ||
function interpolate(t, points, tangents, knots, derivative, result) { | ||
var n = points.length; // number or points / tangents / knots | ||
var d = points[0].length; // vector dimensionality | ||
var v = new Array(d); // destination vector | ||
var v = result || new Array(d); // destination vector | ||
@@ -25,3 +25,3 @@ if(knots) { | ||
var t = (t - k0) / scale; | ||
t = (t - k0) / scale; | ||
@@ -28,0 +28,0 @@ } else { |
{ | ||
"name": "cubic-hermite-spline", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Cubic Hermite spline interpolation", | ||
@@ -14,3 +14,9 @@ "main": "index.js", | ||
"url": "git://github.com/thibauts/cubic-hermite-spline.git" | ||
} | ||
}, | ||
"keywords": [ | ||
"cubic", | ||
"hermite", | ||
"spline", | ||
"interpolation" | ||
] | ||
} |
@@ -5,3 +5,3 @@ cubic-hermite-spline | ||
Cubic Hermite spline interpolation of points / tangeants in any dimension with optional derivative computation. The interpolator can also take a knot-like vector as an optional parameter, which may be useful to enforce time at control points when used for position / velocity interpolation. | ||
[Cubic Hermite spline](http://en.wikipedia.org/wiki/Cubic_Hermite_spline) interpolation of points / tangeants in any dimension with optional derivative computation. The interpolator can also take a knot-like vector as an optional parameter, which may be useful to enforce time at control points when used for position / velocity interpolation. | ||
@@ -78,3 +78,3 @@ | ||
### `hermite(t, points, tangents[, knots, derivative])` | ||
### `hermite(t, points, tangents[, knots, derivative, result])` | ||
@@ -88,1 +88,4 @@ Computes the interpolation at `t` for the provided set of points and tangents, and optional knots. | ||
* `derivative` if true return the tangeant at `t` instead of the position | ||
* `result` preallocated array in which the result will be stored (avoid GC) | ||
**Returns** the interpolated vector |
4885
88