curve-interpolator
Advanced tools
Comparing version
@@ -571,4 +571,4 @@ 'use strict'; | ||
}, { | ||
key: 'getYfromX', | ||
value: function getYfromX(x) { | ||
key: 'y', | ||
value: function y(x) { | ||
var isNormalized = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
@@ -594,4 +594,4 @@ | ||
}, { | ||
key: 'getXfromY', | ||
value: function getXfromY(y) { | ||
key: 'x', | ||
value: function x(y) { | ||
var isNormalized = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
@@ -617,2 +617,16 @@ | ||
}, { | ||
key: 'getYfromX', | ||
value: function getYfromX(x) { | ||
var isNormalized = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
return this.y(x, isNormalized); | ||
} | ||
}, { | ||
key: 'getXfromY', | ||
value: function getXfromY(y) { | ||
var isNormalized = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
return this.x(y, isNormalized); | ||
} | ||
}, { | ||
key: 'normalizeX', | ||
@@ -619,0 +633,0 @@ value: function normalizeX(x) { |
@@ -569,4 +569,4 @@ function createCommonjsModule(fn, module) { | ||
}, { | ||
key: 'getYfromX', | ||
value: function getYfromX(x) { | ||
key: 'y', | ||
value: function y(x) { | ||
var isNormalized = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
@@ -592,4 +592,4 @@ | ||
}, { | ||
key: 'getXfromY', | ||
value: function getXfromY(y) { | ||
key: 'x', | ||
value: function x(y) { | ||
var isNormalized = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
@@ -615,2 +615,16 @@ | ||
}, { | ||
key: 'getYfromX', | ||
value: function getYfromX(x) { | ||
var isNormalized = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
return this.y(x, isNormalized); | ||
} | ||
}, { | ||
key: 'getXfromY', | ||
value: function getXfromY(y) { | ||
var isNormalized = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
return this.x(y, isNormalized); | ||
} | ||
}, { | ||
key: 'normalizeX', | ||
@@ -617,0 +631,0 @@ value: function normalizeX(x) { |
@@ -575,4 +575,4 @@ (function (global, factory) { | ||
}, { | ||
key: 'getYfromX', | ||
value: function getYfromX(x) { | ||
key: 'y', | ||
value: function y(x) { | ||
var isNormalized = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
@@ -598,4 +598,4 @@ | ||
}, { | ||
key: 'getXfromY', | ||
value: function getXfromY(y) { | ||
key: 'x', | ||
value: function x(y) { | ||
var isNormalized = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
@@ -621,2 +621,16 @@ | ||
}, { | ||
key: 'getYfromX', | ||
value: function getYfromX(x) { | ||
var isNormalized = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
return this.y(x, isNormalized); | ||
} | ||
}, { | ||
key: 'getXfromY', | ||
value: function getXfromY(y) { | ||
var isNormalized = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
return this.x(y, isNormalized); | ||
} | ||
}, { | ||
key: 'normalizeX', | ||
@@ -623,0 +637,0 @@ value: function normalizeX(x) { |
{ | ||
"private": false, | ||
"name": "curve-interpolator", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Interpolate values on a Cardinal/Catmull-Rom spline curve", | ||
@@ -6,0 +6,0 @@ "repository": "https://github.com/kjerandp/curve-interpolator", |
@@ -41,5 +41,7 @@ # Curve Interpolator | ||
const y = interp.getYfromX(6); | ||
// returns: 3.5265251581944383 | ||
// y | ||
const x = interp.getXfromY(3.5); | ||
// returns: 0.15314137299769218 | ||
@@ -50,6 +52,7 @@ // t - a value between 0 and 1, where | ||
const point = interp.getPointAt(0.75); | ||
// returns: { x: 0.7138444744653691, y: 0.4656188255412083 } | ||
// get a number of equally spaced points along the curve | ||
const pointsOnCurve = interp.getPoints(500); | ||
// returns 501 points on the curve | ||
``` | ||
@@ -56,0 +59,0 @@  |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
159738
1.46%1747
2.1%88
3.53%