Comparing version 0.2.10 to 0.2.11
@@ -1,2 +0,2 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.hull=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.hull = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ | ||
function _cross(o, a, b) { | ||
@@ -287,3 +287,3 @@ return (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0]); | ||
midPoint = _midPoint(edge, grid.rangePoints(bBoxAround), convex); | ||
midPoint = _midPoint(edge, grid.rangePoints(bBoxAround), convex); | ||
scaleFactor++; | ||
@@ -320,8 +320,8 @@ } while (midPoint === null && (maxSearchArea[0] > bBoxWidth || maxSearchArea[1] > bBoxHeight)); | ||
if (pointset.length < 4) { | ||
return pointset.slice(); | ||
points = _filterDuplicates(_sortByX(formatUtil.toXy(pointset, format))); | ||
if (points.length < 4) { | ||
return points.concat([points[0]]); | ||
} | ||
points = _filterDuplicates(_sortByX(formatUtil.toXy(pointset, format))); | ||
occupiedArea = _occupiedArea(points); | ||
@@ -343,3 +343,3 @@ maxSearchArea = [ | ||
maxSearchArea, grid(innerPoints, cellSize), {}); | ||
return formatUtil.fromXy(concave, format); | ||
@@ -352,2 +352,3 @@ } | ||
module.exports = hull; | ||
},{"./convex.js":1,"./format.js":2,"./grid.js":3,"./intersect.js":5}],5:[function(require,module,exports){ | ||
@@ -370,2 +371,2 @@ function ccw(x1, y1, x2, y2, x3, y3) { | ||
},{}]},{},[4])(4) | ||
}); | ||
}); |
{ | ||
"name": "hull.js", | ||
"version": "0.2.10", | ||
"version": "0.2.11", | ||
"description": "JavaScript library that builds concave hulls (shapes) by set of points", | ||
@@ -20,6 +20,6 @@ "homepage": "https://github.com/AndriiHeonia/hull", | ||
"devDependencies": { | ||
"nodemon": "~1.9.0", | ||
"mocha": "~1.18.2", | ||
"jshint": "~2.5.0", | ||
"browserify": "~5.11.0" | ||
"nodemon": "~1.18.0", | ||
"mocha": "~6.0.2", | ||
"jshint": "~2.10.2", | ||
"browserify": "~16.2.3" | ||
}, | ||
@@ -26,0 +26,0 @@ "scripts": { |
@@ -72,2 +72,4 @@ Hull.js - JavaScript library that builds concave hull by set of points. | ||
### 0.2.11 — 05.05.2019 | ||
Return the first point as the last point when fewer than 4 unique points are provided. | ||
### 0.2.10 — 04.09.2016 | ||
@@ -74,0 +76,0 @@ Fixed missing "var" declaration |
@@ -142,3 +142,3 @@ /* | ||
midPoint = _midPoint(edge, grid.rangePoints(bBoxAround), convex); | ||
midPoint = _midPoint(edge, grid.rangePoints(bBoxAround), convex); | ||
scaleFactor++; | ||
@@ -175,8 +175,8 @@ } while (midPoint === null && (maxSearchArea[0] > bBoxWidth || maxSearchArea[1] > bBoxHeight)); | ||
if (pointset.length < 4) { | ||
return pointset.slice(); | ||
points = _filterDuplicates(_sortByX(formatUtil.toXy(pointset, format))); | ||
if (points.length < 4) { | ||
return points.concat([points[0]]); | ||
} | ||
points = _filterDuplicates(_sortByX(formatUtil.toXy(pointset, format))); | ||
occupiedArea = _occupiedArea(points); | ||
@@ -198,3 +198,3 @@ maxSearchArea = [ | ||
maxSearchArea, grid(innerPoints, cellSize), {}); | ||
return formatUtil.fromXy(concave, format); | ||
@@ -206,2 +206,2 @@ } | ||
module.exports = hull; | ||
module.exports = hull; |
@@ -22,2 +22,20 @@ var assert = require("assert"), | ||
}); | ||
} | ||
it('should append the first point', function() { | ||
var points = [[141, 408], [160, 400], [177, 430]]; | ||
var expected = [[141, 408], [160, 400], [177, 430], [141, 408]]; | ||
assert.deepEqual(hull(points, 50), expected); | ||
}); | ||
it('should not append the first point', function() { | ||
var points = [[141, 408], [160, 400], [141, 408]]; | ||
var expected = [[141, 408], [160, 400], [141, 408]]; | ||
assert.deepEqual(hull(points, 50), expected); | ||
}); | ||
it('should not append the first point', function() { | ||
var points = [[141, 408], [160, 400], [177, 430], [141, 408]]; | ||
var expected = [[141, 408], [160, 400], [177, 430], [141, 408]]; | ||
assert.deepEqual(hull(points, 50), expected); | ||
}); | ||
} |
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
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
17011986
434544
98