marching-squares
Advanced tools
Comparing version 0.1.0 to 0.2.0
11
index.js
@@ -74,5 +74,6 @@ 'use strict'; | ||
* @returns {array[object]} array of point objects with x & y properties tracing | ||
* a closed polygon around the region. This polygon consists entirely | ||
* of one-unit-long horizontal or vertical segments. Use a polygon | ||
* simplification routine on the results to simplify and/or smooth it. | ||
* a closed polygon around the region. The first point is NOT repeated | ||
* as the last point. The polygon consists entirely of one-unit-long | ||
* horizontal or vertical segments. Use a polygon simplification routine on | ||
* the results to simplify and/or smooth it. | ||
* (Might I suggest https://www.npmjs.com/package/line-simplify-rdp ?) | ||
@@ -98,5 +99,7 @@ */ | ||
y += dir[1]; | ||
ret.push({x:x, y:y}); | ||
if (x === startX && y === startY) | ||
return ret; | ||
ret.push({x:x, y:y}); | ||
@@ -103,0 +106,0 @@ if (dir === DOWN) |
{ | ||
"name": "marching-squares", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Outline a region in a two-dimensional grid using a marching squares algorithm", | ||
@@ -11,3 +11,3 @@ "main": "index.js", | ||
"validate": "npm ls", | ||
"prepublish": "npm run lint && npm run validate && npm test" | ||
"prepublish": "npm run lint && npm run validate && npm test" | ||
}, | ||
@@ -14,0 +14,0 @@ "author": "Scott Glazer", |
@@ -35,3 +35,3 @@ var test = require("tape"); | ||
var results = trace(1,1,grid.get.bind(grid)); | ||
t.deepEquals(minimizePts(results), [1,1, 2,1, 2,2, 1,2, 1,1]); | ||
t.deepEquals(minimizePts(results), [1,1, 2,1, 2,2, 1,2]); | ||
}); | ||
@@ -52,3 +52,3 @@ | ||
t.deepEquals(minimizePts(results), [0,0, 1,0, 1,1, 2,1, 2,2, 3,2, 4,2, 4,1, 5,1, 5,0, 6,0, 6,1, 5,1, 5,2, 4,2, 4,3, 4,4, 5,4, 5,5, 6,5, 6,6, 5,6, 5,5, 4,5, 4,4, 3,4, 2,4, 2,5, | ||
1,5, 1,6, 0,6, 0,5, 1,5, 1,4, 2,4, 2,3, 2,2, 1,2, 1,1, 0,1, 0,0]); | ||
1,5, 1,6, 0,6, 0,5, 1,5, 1,4, 2,4, 2,3, 2,2, 1,2, 1,1, 0,1]); | ||
@@ -71,5 +71,5 @@ | ||
t.deepEquals(minimizePts(results), [1,1, 1,0, 2,0, 3,0, 4,0, 5,0, 5,1, 6,1, 6,2, 6,3, 5,3, 4,3, 4,2, 4,1, 3,1, 3,2, 2,2, 2,3, 2,4, 3,4, 4,4, 5,4, 6,4, 6,5, 5,5, 5,6, 4,6, 3,6, 2,6, 1,6, 1,5, | ||
0,5, 0,4, 0,3, 0,2, 0,1, 1,1]); | ||
0,5, 0,4, 0,3, 0,2, 0,1]); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6455
6
168