0.0.8 • Published 7 years ago

cat-rom-spline-es6 v0.0.8

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

Catmull Rom spline interpolation made easy (ES6 repackage).

##This is just a repackage please visit the original if you're not wanting es6 exports: cat-rom-spline

Install

$ npm install --save cat-rom-spline

Usage

var catRomSpline = require('cat-rom-spline');

// Points are arrays in the form of [x, y]
var p0 = [0, 0];
var p1 = [5, 5];
var p2 = [5, 10];
var p3 = [15, 20];

// At least 4 points are needed to interpolate
var points = [p0, p1, p2, p3];

// There are optional configurations that you can make but they aren't required
// If 'samples' is not passed in the interpolation will sample a sensible amount
// of points based on how far away control points are
var options = {
  samples: 50,
  knot: 0.5 // Default is 0.5, Ranges from 0 - 1, 1 being stiffer curves.
};

var interpolatedPoints = catRomSpline(points, options);

License

MIT © Nick Schaubeck

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago