Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

line-simplify-rdp

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

line-simplify-rdp - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

16

index.js

@@ -19,18 +19,18 @@ 'use strict';

var minDist = Number.POSITIVE_INFINITY,
minDistIdx = -1;
var maxDist = Number.NEGATIVE_INFINITY,
maxDistIdx = -1;
for (var i=idx1+1; i < idx2; i++) {
var pointBetween = points[i];
var dist = distanceToLineSegment2(x1, y1, dx, dy, lineLengthSquared, pointBetween.x, pointBetween.y);
if (dist < minDist) {
minDist = dist;
minDistIdx = i;
if (dist > maxDist) {
maxDist = dist;
maxDistIdx = i;
}
}
if (minDist <= threshold)
if (maxDist <= threshold)
return;
simplifyInternal(points, idx1, minDistIdx, threshold, keepers);
simplifyInternal(points, minDistIdx, idx2, threshold, keepers);
simplifyInternal(points, idx1, maxDistIdx, threshold, keepers);
simplifyInternal(points, maxDistIdx, idx2, threshold, keepers);

@@ -37,0 +37,0 @@

{
"name": "line-simplify-rdp",
"version": "0.2.0",
"version": "0.3.0",
"description": "Simplify lines using the Ramer–Douglas–Peucker algorithm",

@@ -8,6 +8,6 @@ "repository": "https://github.com/scottglz/line-simplify-rdp",

"scripts": {
"test": "tape test/*.js",
"test": "tape test.js",
"lint": "jshint index.js",
"validate": "npm ls",
"preflight": "npm run lint && npm run validate && npm run test"
"prepublish": "npm run lint && npm run validate && npm run test"
},

@@ -14,0 +14,0 @@ "keywords": [

@@ -15,3 +15,3 @@ 'use strict';

var simplified = simplify(stairstep, 1);
t.deepEquals(simplified, [stairstep[0],stairstep[i]], (i+1) + " points")
t.deepEquals(simplified, [stairstep[0],stairstep[i]], (i+1) + " points");
}

@@ -25,3 +25,3 @@

}
t.deepEquals(simplify(stairstep, 1 ), [stairstep[0],stairstep[999]], "1000 points")
t.deepEquals(simplify(stairstep, 1 ), [stairstep[0],stairstep[999]], "1000 points");
});

@@ -28,0 +28,0 @@

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