npm.io
1.0.0 • Published 7 years ago

linterpol

Licence
MIT
Version
1.0.0
Deps
0
Size
3 kB
Vulns
0
Weekly
0

Linterpol

Linear interpolation. No international criminal police organization.

API

const linterpol = require('linterpol');

const points = [
//	[ x,  y]
	[01, 16],
	[09, 16],
	[11, 18],
	[23, 18]
];

// Interpolate value within given points
linterpol(08, points) // == 16
linterpol(10, points) // == 17
linterpol(12, points) // == 18

// Interpolate without wrap around
linterpol(00, points) // == 16
linterpol(24, points) // == 18

// Interpolate with wrap around
linterpol(00, points, 24) // == 17
linterpol(24, points, 24) // == 17