You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

curve-interpolator

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

curve-interpolator - npm Package Compare versions

Comparing version

to
0.1.4

23

dist/curve-interpolator.cjs.js

@@ -546,7 +546,12 @@ 'use strict';

var t = this._getUtoTmapping(u);
return this._getPoint(t, optionalTarget);
var p = this._getPoint(t, optionalTarget);
return {
x: this.denormalizeX(p.x),
y: this.denormalizeY(p.y)
};
}
}, {
key: 'getNormalizedPoints',
value: function getNormalizedPoints(divisions) {
key: 'getPoints',
value: function getPoints(divisions) {
if (divisions === undefined) divisions = 5;

@@ -560,14 +565,2 @@ var points = [];

}, {
key: 'getPoints',
value: function getPoints(divisions) {
var _this2 = this;
return this.getNormalizedPoints(divisions).map(function (p) {
return {
x: _this2.denormalizeX(p.x),
y: _this2.denormalizeY(p.y)
};
});
}
}, {
key: 'y',

@@ -574,0 +567,0 @@ value: function y(x) {

@@ -544,7 +544,12 @@ function createCommonjsModule(fn, module) {

var t = this._getUtoTmapping(u);
return this._getPoint(t, optionalTarget);
var p = this._getPoint(t, optionalTarget);
return {
x: this.denormalizeX(p.x),
y: this.denormalizeY(p.y)
};
}
}, {
key: 'getNormalizedPoints',
value: function getNormalizedPoints(divisions) {
key: 'getPoints',
value: function getPoints(divisions) {
if (divisions === undefined) divisions = 5;

@@ -558,14 +563,2 @@ var points = [];

}, {
key: 'getPoints',
value: function getPoints(divisions) {
var _this2 = this;
return this.getNormalizedPoints(divisions).map(function (p) {
return {
x: _this2.denormalizeX(p.x),
y: _this2.denormalizeY(p.y)
};
});
}
}, {
key: 'y',

@@ -572,0 +565,0 @@ value: function y(x) {

@@ -550,7 +550,12 @@ (function (global, factory) {

var t = this._getUtoTmapping(u);
return this._getPoint(t, optionalTarget);
var p = this._getPoint(t, optionalTarget);
return {
x: this.denormalizeX(p.x),
y: this.denormalizeY(p.y)
};
}
}, {
key: 'getNormalizedPoints',
value: function getNormalizedPoints(divisions) {
key: 'getPoints',
value: function getPoints(divisions) {
if (divisions === undefined) divisions = 5;

@@ -564,14 +569,2 @@ var points = [];

}, {
key: 'getPoints',
value: function getPoints(divisions) {
var _this2 = this;
return this.getNormalizedPoints(divisions).map(function (p) {
return {
x: _this2.denormalizeX(p.x),
y: _this2.denormalizeY(p.y)
};
});
}
}, {
key: 'y',

@@ -578,0 +571,0 @@ value: function y(x) {

{
"private": false,
"name": "curve-interpolator",
"version": "0.1.3",
"version": "0.1.4",
"description": "Interpolate values on a Cardinal/Catmull-Rom spline curve",

@@ -6,0 +6,0 @@ "repository": "https://github.com/kjerandp/curve-interpolator",

@@ -44,4 +44,4 @@ # Curve Interpolator

// y
const x = interp.getXfromY(3.5);
// returns: 0.15314137299769218
const x = interp.getXfromY(4.5);
// returns: 2.1747870209623072

@@ -51,4 +51,4 @@ // t - a value between 0 and 1, where

// t=1 is at the end of the curve
const point = interp.getPointAt(0.75);
// returns: { x: 0.7138444744653691, y: 0.4656188255412083 }
const point = interp.getPointAt(0.9);
// returns: { x: 7.475143644790929, y: 1.7870044081993317 }

@@ -61,5 +61,4 @@ // get a number of equally spaced points along the curve

In this graph the control points are plotted as black dots and connected with a blue line. The red curve is made out of the 500 equally spaced points from the example above.
This is a simple graph showing a linear line drawn in blue between the control points and interpolated values as colored dots using the various interpolation functions.
## Methods

@@ -66,0 +65,0 @@ | Method | Parameters | Description

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