New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@turf/bezier-spline

Package Overview
Dependencies
Maintainers
6
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/bezier-spline - npm Package Compare versions

Comparing version 6.2.0-alpha.2 to 6.2.0-alpha.3

dist/es/package.json

2

dist/es/index.js

@@ -1,2 +0,2 @@

import { lineString, } from "@turf/helpers";
import { lineString } from "@turf/helpers";
import { getGeom } from "@turf/invariant";

@@ -3,0 +3,0 @@ import Spline from "./lib/spline";

@@ -52,19 +52,28 @@ /**

for (var i = 0; i < this.centers.length - 1; i++) {
var p1 = this.centers[i];
var p2 = this.centers[i + 1];
var dx = this.points[i + 1].x - (this.centers[i].x + this.centers[i + 1].x) / 2;
var dy = this.points[i + 1].y - (this.centers[i].y + this.centers[i + 1].y) / 2;
var dz = this.points[i + 1].z - (this.centers[i].y + this.centers[i + 1].z) / 2;
this.controls.push([{
x: (1.0 - this.sharpness) * this.points[i + 1].x + this.sharpness * (this.centers[i].x + dx),
y: (1.0 - this.sharpness) * this.points[i + 1].y + this.sharpness * (this.centers[i].y + dy),
z: (1.0 - this.sharpness) * this.points[i + 1].z + this.sharpness * (this.centers[i].z + dz)
this.controls.push([
{
x: (1.0 - this.sharpness) * this.points[i + 1].x +
this.sharpness * (this.centers[i].x + dx),
y: (1.0 - this.sharpness) * this.points[i + 1].y +
this.sharpness * (this.centers[i].y + dy),
z: (1.0 - this.sharpness) * this.points[i + 1].z +
this.sharpness * (this.centers[i].z + dz),
},
{
x: (1.0 - this.sharpness) * this.points[i + 1].x + this.sharpness * (this.centers[i + 1].x + dx),
y: (1.0 - this.sharpness) * this.points[i + 1].y + this.sharpness * (this.centers[i + 1].y + dy),
z: (1.0 - this.sharpness) * this.points[i + 1].z + this.sharpness * (this.centers[i + 1].z + dz)
}]);
x: (1.0 - this.sharpness) * this.points[i + 1].x +
this.sharpness * (this.centers[i + 1].x + dx),
y: (1.0 - this.sharpness) * this.points[i + 1].y +
this.sharpness * (this.centers[i + 1].y + dy),
z: (1.0 - this.sharpness) * this.points[i + 1].z +
this.sharpness * (this.centers[i + 1].z + dz),
},
]);
}
this.controls.push([this.points[this.length - 1], this.points[this.length - 1]]);
this.controls.push([
this.points[this.length - 1],
this.points[this.length - 1],
]);
this.steps = this.cacheSteps(this.stepLength);

@@ -99,3 +108,3 @@ return this;

return {
angle: 180 * Math.atan2(p1.y - p2.y, p1.x - p2.x) / 3.14,
angle: (180 * Math.atan2(p1.y - p2.y, p1.x - p2.x)) / 3.14,
speed: Math.sqrt((p2.x - p1.x) * (p2.x - p1.x) +

@@ -122,3 +131,3 @@ (p2.y - p1.y) * (p2.y - p1.y) +

// t = t-this.delay;
var t2 = (t) / this.duration;
var t2 = t / this.duration;
if (t2 >= 1) {

@@ -146,3 +155,8 @@ return this.points[this.length - 1];

var t3 = t2 * t;
return [(t3), (3 * t2 * (1 - t)), (3 * t * (1 - t) * (1 - t)), ((1 - t) * (1 - t) * (1 - t))];
return [
t3,
3 * t2 * (1 - t),
3 * t * (1 - t) * (1 - t),
(1 - t) * (1 - t) * (1 - t),
];
}

@@ -54,19 +54,28 @@ "use strict";

for (var i = 0; i < this.centers.length - 1; i++) {
var p1 = this.centers[i];
var p2 = this.centers[i + 1];
var dx = this.points[i + 1].x - (this.centers[i].x + this.centers[i + 1].x) / 2;
var dy = this.points[i + 1].y - (this.centers[i].y + this.centers[i + 1].y) / 2;
var dz = this.points[i + 1].z - (this.centers[i].y + this.centers[i + 1].z) / 2;
this.controls.push([{
x: (1.0 - this.sharpness) * this.points[i + 1].x + this.sharpness * (this.centers[i].x + dx),
y: (1.0 - this.sharpness) * this.points[i + 1].y + this.sharpness * (this.centers[i].y + dy),
z: (1.0 - this.sharpness) * this.points[i + 1].z + this.sharpness * (this.centers[i].z + dz)
this.controls.push([
{
x: (1.0 - this.sharpness) * this.points[i + 1].x +
this.sharpness * (this.centers[i].x + dx),
y: (1.0 - this.sharpness) * this.points[i + 1].y +
this.sharpness * (this.centers[i].y + dy),
z: (1.0 - this.sharpness) * this.points[i + 1].z +
this.sharpness * (this.centers[i].z + dz),
},
{
x: (1.0 - this.sharpness) * this.points[i + 1].x + this.sharpness * (this.centers[i + 1].x + dx),
y: (1.0 - this.sharpness) * this.points[i + 1].y + this.sharpness * (this.centers[i + 1].y + dy),
z: (1.0 - this.sharpness) * this.points[i + 1].z + this.sharpness * (this.centers[i + 1].z + dz)
}]);
x: (1.0 - this.sharpness) * this.points[i + 1].x +
this.sharpness * (this.centers[i + 1].x + dx),
y: (1.0 - this.sharpness) * this.points[i + 1].y +
this.sharpness * (this.centers[i + 1].y + dy),
z: (1.0 - this.sharpness) * this.points[i + 1].z +
this.sharpness * (this.centers[i + 1].z + dz),
},
]);
}
this.controls.push([this.points[this.length - 1], this.points[this.length - 1]]);
this.controls.push([
this.points[this.length - 1],
this.points[this.length - 1],
]);
this.steps = this.cacheSteps(this.stepLength);

@@ -101,3 +110,3 @@ return this;

return {
angle: 180 * Math.atan2(p1.y - p2.y, p1.x - p2.x) / 3.14,
angle: (180 * Math.atan2(p1.y - p2.y, p1.x - p2.x)) / 3.14,
speed: Math.sqrt((p2.x - p1.x) * (p2.x - p1.x) +

@@ -124,3 +133,3 @@ (p2.y - p1.y) * (p2.y - p1.y) +

// t = t-this.delay;
var t2 = (t) / this.duration;
var t2 = t / this.duration;
if (t2 >= 1) {

@@ -148,3 +157,8 @@ return this.points[this.length - 1];

var t3 = t2 * t;
return [(t3), (3 * t2 * (1 - t)), (3 * t * (1 - t) * (1 - t)), ((1 - t) * (1 - t) * (1 - t))];
return [
t3,
3 * t2 * (1 - t),
3 * t * (1 - t) * (1 - t),
(1 - t) * (1 - t) * (1 - t),
];
}
{
"name": "@turf/bezier-spline",
"version": "6.2.0-alpha.2",
"version": "6.2.0-alpha.3",
"description": "turf bezier-spline module",

@@ -27,2 +27,6 @@ "author": "Turf Authors",

"module": "dist/es/index.js",
"exports": {
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
},
"types": "dist/js/index.d.ts",

@@ -34,10 +38,9 @@ "sideEffects": false,

"scripts": {
"bench": "npm-run-all prepare bench:run",
"bench:run": "node bench.js",
"bench": "ts-node bench.js",
"build": "npm-run-all build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"docs": "node ../../scripts/generate-readmes",
"prepare": "npm-run-all prepare:*",
"prepare:es": "tsc --outDir dist/es --module esnext --declaration false",
"prepare:js": "tsc",
"test": "npm-run-all prepare test:*",
"test:tape": "node -r esm test.js"
"test": "npm-run-all test:*",
"test:tape": "ts-node -r esm test.js"
},

@@ -50,2 +53,3 @@ "devDependencies": {

"tape": "*",
"ts-node": "*",
"tslint": "*",

@@ -56,6 +60,6 @@ "typescript": "*",

"dependencies": {
"@turf/helpers": "^6.2.0-alpha.2",
"@turf/invariant": "^6.2.0-alpha.2"
"@turf/helpers": "^6.2.0-alpha.3",
"@turf/invariant": "^6.2.0-alpha.3"
},
"gitHead": "23d5cb91d77e0c1e2e903a2252f525797f1d0d09"
"gitHead": "dce9edfc705352e8cb9e0083c9330ba0e8d77409"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc