pax_global_header00006660000000000000000000000064133400734710014514gustar00rootroot0000000000000052 comment=d31b27d797c141c2ec6e579e5950d075a705b836 d3-voronoi-1.1.4/000077500000000000000000000000001334007347100135165ustar00rootroot00000000000000d3-voronoi-1.1.4/.eslintrc.json000066400000000000000000000004021334007347100163060ustar00rootroot00000000000000{ "extends": "eslint:recommended", "parserOptions": { "sourceType": "module", "ecmaVersion": 8 }, "env": { "es6": true, "node": true, "browser": true }, "rules": { "no-cond-assign": 0, "no-constant-condition": 0 } } d3-voronoi-1.1.4/.gitignore000066400000000000000000000000771334007347100155120ustar00rootroot00000000000000*.sublime-workspace .DS_Store dist/ node_modules npm-debug.log d3-voronoi-1.1.4/.npmignore000066400000000000000000000000421334007347100155110ustar00rootroot00000000000000*.sublime-* dist/*.zip img/ test/ d3-voronoi-1.1.4/LICENSE000066400000000000000000000051401334007347100145230ustar00rootroot00000000000000Copyright 2010-2016 Mike Bostock All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Copyright (C) 2010-2013 Raymond Hill https://github.com/gorhill/Javascript-Voronoi Licensed under The MIT License http://en.wikipedia.org/wiki/MIT_License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. d3-voronoi-1.1.4/README.md000066400000000000000000000260051334007347100150000ustar00rootroot00000000000000# d3-voronoi **Deprecation notice**: Consider using the newer [d3-delaunay](https://github.com/d3/d3-delaunay) instead of d3-voronoi. Based on [Delaunator](https://github.com/mapbox/delaunator), d3-delaunay is 5-10× faster than d3-voronoi to construct the Delaunay triangulation or the Voronoi diagram, is more robust numerically, has Canvas rendering built-in, allows traversal of the Delaunay graph, and a variety of other improvements. --- This module implements [Steven J. Fortune’s algorithm](https://en.wikipedia.org/wiki/Fortune's_algorithm) for computing the [Voronoi diagram](https://en.wikipedia.org/wiki/Voronoi_diagram) or [Delaunay triangulation](https://en.wikipedia.org/wiki/Delaunay_triangulation) of a set of two-dimensional points. This implementation is largely based on [work by Raymond Hill](http://www.raymondhill.net/voronoi/rhill-voronoi.html). Voronoi diagrams are not only [visually](http://bl.ocks.org/mbostock/4360892) [attractive](http://bl.ocks.org/mbostock/4636377) but practical tools for interaction, such as to increase the target area of points in a scatterplot. See [“Strikeouts on the Rise”](http://www.nytimes.com/interactive/2013/03/29/sports/baseball/Strikeouts-Are-Still-Soaring.html) in *The New York Times* and this [multi-line chart](http://bl.ocks.org/mbostock/8033015) for examples; also see Tovi Grossman’s paper on [bubble cursors](http://www.tovigrossman.com/BubbleCursor) for a related technique. Voronoi diagrams can also be used to [automate label positioning](http://bl.ocks.org/mbostock/6909318), and Delaunay meshes are useful in computing adjacency or grouping of visual elements. ## Installing If you use NPM, `npm install d3-voronoi`. Otherwise, download the [latest release](https://github.com/d3/d3-voronoi/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-voronoi.v1.min.js) or as part of [D3 4.0](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported: ```html ``` [Try d3-voronoi in your browser.](https://tonicdev.com/npm/d3-voronoi) ## API Reference # d3.voronoi() [<>](https://github.com/d3/d3-voronoi/blob/master/src/voronoi.js "Source") Creates a new Voronoi layout with default [*x*-](#voronoi_x) and [*y*-](#voronoi_y) accessors and a null [extent](#voronoi_extent). # voronoi(data) [<>](https://github.com/d3/d3-voronoi/blob/master/src/voronoi.js#L10 "Source") Computes the [Voronoi diagram](#voronoi-diagrams) for the specified *data* points. # voronoi.x([x]) [<>](https://github.com/d3/d3-voronoi/blob/master/src/voronoi.js#L31 "Source") If *x* is specified, sets the *x*-coordinate accessor. If *x* is not specified, returns the current *x*-coordinate accessor, which defaults to: ```js function x(d) { return d[0]; } ``` # voronoi.y([y]) [<>](https://github.com/d3/d3-voronoi/blob/master/src/voronoi.js#L35 "Source") If *y* is specified, sets the *y*-coordinate accessor. If *y* is not specified, returns the current *y*-coordinate accessor, which defaults to: ```js function y(d) { return d[1]; } ``` # voronoi.extent([extent]) [<>](https://github.com/d3/d3-voronoi/blob/master/src/voronoi.js#L39 "Source") If *extent* is specified, sets the clip extent of the Voronoi layout to the specified bounds and returns the layout. The *extent* bounds are specified as an array \[\[x0, y0\], \[x1, y1\]\], where x0 is the left side of the extent, y0 is the top, x1 is the right and y1 is the bottom. If *extent* is not specified, returns the current clip extent which defaults to null. A clip extent is required when using [*voronoi*.polygons](#voronoi_polygons). # voronoi.size([size]) [<>](https://github.com/d3/d3-voronoi/blob/master/src/voronoi.js#L43 "Source") An alias for [*voronoi*.extent](#voronoi_extent) where the minimum *x* and *y* of the extent are ⟨0,0⟩. Equivalent to: ```js voronoi.extent([[0, 0], size]); ``` # voronoi.polygons(data) [<>](https://github.com/d3/d3-voronoi/blob/master/src/voronoi.js#L19 "Source") Returns a sparse array of polygons, one for each unique input point in the specified *data* points, corresponding to the cells in the computed Voronoi diagram. Equivalent to: ```js voronoi(data).polygons(); ``` See [*diagram*.polygons](#diagram_polygons) for more detail. Note: an [extent](#voronoi_extent) is required. # voronoi.triangles(data) [<>](https://github.com/d3/d3-voronoi/blob/master/src/voronoi.js#L27 "Source") Returns the Delaunay triangulation of the specified *data* array as an array of triangles. Each triangle is a three-element array of elements from *data*. Equivalent to: ```js voronoi(data).triangles(); ``` See [*diagram*.triangles](#diagram_triangles) for more detail. # voronoi.links(data) [<>](https://github.com/d3/d3-voronoi/blob/master/src/voronoi.js#L23 "Source") Returns the Delaunay triangulation of the specified *data* array as an array of links. Each link has `source` and `target` attributes referring to elements in *data*. Equivalent to: ```js voronoi(data).links(); ``` See [*diagram*.links](#diagram_links) for more detail. ### Voronoi Diagrams # diagram [<>](https://github.com/d3/d3-voronoi/blob/master/src/Diagram.js "Source") The computed Voronoi diagram returned by [*voronoi*](#_voronoi) has the following properties: * `edges` - an array of [edges](#diagram_edge). * `cells` - a sparse array of [cells](#diagram_cell), one for each unique input point. For each set of coincident input points, one of the points is chosen arbitrarily and assigned the associated cell; the other coincident input points’ entries are missing from the returned sparse array. # diagram.polygons() [<>](https://github.com/d3/d3-voronoi/blob/master/src/Diagram.js#L72 "Source") Returns a sparse array of polygons clipped to the [*extent*](#voronoi_extent), one for each cell (each unique input point) in the diagram. Each polygon is represented as an array of points \[*x*, *y*\] where *x* and *y* are the point coordinates, and a `data` field that refers to the corresponding element in *data*. Polygons are open: they do not contain a closing point that duplicates the first point; a triangle, for example, is an array of three points. Polygons are also counterclockwise, assuming the origin ⟨0,0⟩ is in the top-left corner. For each set of coincident input points, one of the points is chosen arbitrarily and assigned the associated polygon; the other coincident input points’ entries are missing from the returned sparse array. # diagram.triangles() [<>](https://github.com/d3/d3-voronoi/blob/master/src/Diagram.js#L82 "Source") Returns the Delaunay triangulation of the specified *data* array as an array of triangles. Each triangle is a three-element array of elements from *data*. Since the triangulation is computed as the dual of the Voronoi diagram, and the Voronoi diagram is clipped by the [extent](#voronoi_extent), a subset of the Delaunay triangulation is returned. # diagram.links() [<>](https://github.com/d3/d3-voronoi/blob/master/src/Diagram.js#L108 "Source") Returns the Delaunay triangulation of the specified *data* array as an array of links, one for each edge in the mesh. Each link has the following attributes: * `source` - the source node, an element in *data*. * `target` - the target node, an element in *data*. Since the triangulation is computed as the dual of the Voronoi diagram, and the Voronoi diagram is clipped by the [extent](#voronoi_extent), a subset of the Delaunay links is returned. # diagram.find(x, y[, radius]) [<>](https://github.com/d3/d3-voronoi/blob/master/src/Diagram.js#L119 "Source") Returns the nearest site to point \[*x*, *y*\]. If *radius* is specified, only sites within *radius* distance are considered. See Philippe Rivière’s [bl.ocks.org/1b7ddbcd71454d685d1259781968aefc](http://bl.ocks.org/Fil/1b7ddbcd71454d685d1259781968aefc) for an example. # cell Each cell in the diagram is an object with the following properties: * `site` - the [site](#site) of the cell’s associated input point. * `halfedges` - an array of indexes into [*diagram*.edges](#diagram) representing the cell’s polygon. # site Each site in the diagram is an array \[*x*, *y*\] with two additional properties: * `index` - the site’s index, corresponding to the associated input point. * `data` - the input data corresponding to this site. # edge Each edge in the diagram is an array \[\[*x0*, *y0*\], \[*x1*, *y1*\]\] with two additional properties: * `left` - the [site](#site) on the left side of the edge. * `right` - the [site](#site) on the right side of the edge; null for a clipped border edge. d3-voronoi-1.1.4/d3-voronoi.sublime-project000066400000000000000000000005241334007347100205440ustar00rootroot00000000000000{ "folders": [ { "path": ".", "file_exclude_patterns": ["*.sublime-workspace"], "folder_exclude_patterns": ["dist"] } ], "build_systems": [ { "name": "yarn test", "cmd": ["yarn", "test"], "file_regex": "\\((...*?):([0-9]*):([0-9]*)\\)", "working_dir": "$project_path" } ] } d3-voronoi-1.1.4/package.json000066400000000000000000000027341334007347100160120ustar00rootroot00000000000000{ "name": "d3-voronoi", "version": "1.1.4", "description": "Compute the Voronoi diagram of a set of two-dimensional points.", "keywords": [ "d3", "d3-module", "voronoi", "delaunay" ], "homepage": "https://d3js.org/d3-voronoi/", "license": "BSD-3-Clause", "author": { "name": "Mike Bostock", "url": "http://bost.ocks.org/mike" }, "main": "dist/d3-voronoi.js", "unpkg": "dist/d3-voronoi.min.js", "jsdelivr": "dist/d3-voronoi.min.js", "module": "src/index.js", "repository": { "type": "git", "url": "https://github.com/d3/d3-voronoi.git" }, "scripts": { "pretest": "rollup -c", "test": "tape 'test/**/*-test.js' && eslint src", "prepublishOnly": "rm -rf dist && yarn test", "postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../${npm_package_name}/dist/${npm_package_name}.js ${npm_package_name}.v${npm_package_version%%.*}.js && cp ../${npm_package_name}/dist/${npm_package_name}.min.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git add ${npm_package_name}.v${npm_package_version%%.*}.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git commit -m \"${npm_package_name} ${npm_package_version}\" && git push && cd - && zip -j dist/${npm_package_name}.zip -- LICENSE README.md dist/${npm_package_name}.js dist/${npm_package_name}.min.js" }, "devDependencies": { "eslint": "5", "rollup": "0.64", "rollup-plugin-terser": "1", "tape": "4" } } d3-voronoi-1.1.4/rollup.config.js000066400000000000000000000015451334007347100166420ustar00rootroot00000000000000import {terser} from "rollup-plugin-terser"; import * as meta from "./package.json"; const config = { input: "src/index.js", external: Object.keys(meta.dependencies || {}).filter(key => /^d3-/.test(key)), output: { file: `dist/${meta.name}.js`, name: "d3", format: "umd", indent: false, extend: true, banner: `// ${meta.homepage} v${meta.version} Copyright ${(new Date).getFullYear()} ${meta.author.name}`, globals: Object.assign({}, ...Object.keys(meta.dependencies || {}).filter(key => /^d3-/.test(key)).map(key => ({[key]: "d3"}))) }, plugins: [] }; export default [ config, { ...config, output: { ...config.output, file: `dist/${meta.name}.min.js` }, plugins: [ ...config.plugins, terser({ output: { preamble: config.output.banner } }) ] } ]; d3-voronoi-1.1.4/src/000077500000000000000000000000001334007347100143055ustar00rootroot00000000000000d3-voronoi-1.1.4/src/Beach.js000066400000000000000000000104351334007347100156500ustar00rootroot00000000000000import {RedBlackNode} from "./RedBlackTree"; import {createCell} from "./Cell"; import {attachCircle, detachCircle} from "./Circle"; import {createEdge, setEdgeEnd} from "./Edge"; import {beaches, epsilon} from "./Diagram"; var beachPool = []; function Beach() { RedBlackNode(this); this.edge = this.site = this.circle = null; } function createBeach(site) { var beach = beachPool.pop() || new Beach; beach.site = site; return beach; } function detachBeach(beach) { detachCircle(beach); beaches.remove(beach); beachPool.push(beach); RedBlackNode(beach); } export function removeBeach(beach) { var circle = beach.circle, x = circle.x, y = circle.cy, vertex = [x, y], previous = beach.P, next = beach.N, disappearing = [beach]; detachBeach(beach); var lArc = previous; while (lArc.circle && Math.abs(x - lArc.circle.x) < epsilon && Math.abs(y - lArc.circle.cy) < epsilon) { previous = lArc.P; disappearing.unshift(lArc); detachBeach(lArc); lArc = previous; } disappearing.unshift(lArc); detachCircle(lArc); var rArc = next; while (rArc.circle && Math.abs(x - rArc.circle.x) < epsilon && Math.abs(y - rArc.circle.cy) < epsilon) { next = rArc.N; disappearing.push(rArc); detachBeach(rArc); rArc = next; } disappearing.push(rArc); detachCircle(rArc); var nArcs = disappearing.length, iArc; for (iArc = 1; iArc < nArcs; ++iArc) { rArc = disappearing[iArc]; lArc = disappearing[iArc - 1]; setEdgeEnd(rArc.edge, lArc.site, rArc.site, vertex); } lArc = disappearing[0]; rArc = disappearing[nArcs - 1]; rArc.edge = createEdge(lArc.site, rArc.site, null, vertex); attachCircle(lArc); attachCircle(rArc); } export function addBeach(site) { var x = site[0], directrix = site[1], lArc, rArc, dxl, dxr, node = beaches._; while (node) { dxl = leftBreakPoint(node, directrix) - x; if (dxl > epsilon) node = node.L; else { dxr = x - rightBreakPoint(node, directrix); if (dxr > epsilon) { if (!node.R) { lArc = node; break; } node = node.R; } else { if (dxl > -epsilon) { lArc = node.P; rArc = node; } else if (dxr > -epsilon) { lArc = node; rArc = node.N; } else { lArc = rArc = node; } break; } } } createCell(site); var newArc = createBeach(site); beaches.insert(lArc, newArc); if (!lArc && !rArc) return; if (lArc === rArc) { detachCircle(lArc); rArc = createBeach(lArc.site); beaches.insert(newArc, rArc); newArc.edge = rArc.edge = createEdge(lArc.site, newArc.site); attachCircle(lArc); attachCircle(rArc); return; } if (!rArc) { // && lArc newArc.edge = createEdge(lArc.site, newArc.site); return; } // else lArc !== rArc detachCircle(lArc); detachCircle(rArc); var lSite = lArc.site, ax = lSite[0], ay = lSite[1], bx = site[0] - ax, by = site[1] - ay, rSite = rArc.site, cx = rSite[0] - ax, cy = rSite[1] - ay, d = 2 * (bx * cy - by * cx), hb = bx * bx + by * by, hc = cx * cx + cy * cy, vertex = [(cy * hb - by * hc) / d + ax, (bx * hc - cx * hb) / d + ay]; setEdgeEnd(rArc.edge, lSite, rSite, vertex); newArc.edge = createEdge(lSite, site, null, vertex); rArc.edge = createEdge(site, rSite, null, vertex); attachCircle(lArc); attachCircle(rArc); } function leftBreakPoint(arc, directrix) { var site = arc.site, rfocx = site[0], rfocy = site[1], pby2 = rfocy - directrix; if (!pby2) return rfocx; var lArc = arc.P; if (!lArc) return -Infinity; site = lArc.site; var lfocx = site[0], lfocy = site[1], plby2 = lfocy - directrix; if (!plby2) return lfocx; var hl = lfocx - rfocx, aby2 = 1 / pby2 - 1 / plby2, b = hl / plby2; if (aby2) return (-b + Math.sqrt(b * b - 2 * aby2 * (hl * hl / (-2 * plby2) - lfocy + plby2 / 2 + rfocy - pby2 / 2))) / aby2 + rfocx; return (rfocx + lfocx) / 2; } function rightBreakPoint(arc, directrix) { var rArc = arc.N; if (rArc) return leftBreakPoint(rArc, directrix); var site = arc.site; return site[1] === directrix ? site[0] : Infinity; } d3-voronoi-1.1.4/src/Cell.js000066400000000000000000000077671334007347100155430ustar00rootroot00000000000000import {createBorderEdge} from "./Edge"; import {cells, edges, epsilon} from "./Diagram"; export function createCell(site) { return cells[site.index] = { site: site, halfedges: [] }; } function cellHalfedgeAngle(cell, edge) { var site = cell.site, va = edge.left, vb = edge.right; if (site === vb) vb = va, va = site; if (vb) return Math.atan2(vb[1] - va[1], vb[0] - va[0]); if (site === va) va = edge[1], vb = edge[0]; else va = edge[0], vb = edge[1]; return Math.atan2(va[0] - vb[0], vb[1] - va[1]); } export function cellHalfedgeStart(cell, edge) { return edge[+(edge.left !== cell.site)]; } export function cellHalfedgeEnd(cell, edge) { return edge[+(edge.left === cell.site)]; } export function sortCellHalfedges() { for (var i = 0, n = cells.length, cell, halfedges, j, m; i < n; ++i) { if ((cell = cells[i]) && (m = (halfedges = cell.halfedges).length)) { var index = new Array(m), array = new Array(m); for (j = 0; j < m; ++j) index[j] = j, array[j] = cellHalfedgeAngle(cell, edges[halfedges[j]]); index.sort(function(i, j) { return array[j] - array[i]; }); for (j = 0; j < m; ++j) array[j] = halfedges[index[j]]; for (j = 0; j < m; ++j) halfedges[j] = array[j]; } } } export function clipCells(x0, y0, x1, y1) { var nCells = cells.length, iCell, cell, site, iHalfedge, halfedges, nHalfedges, start, startX, startY, end, endX, endY, cover = true; for (iCell = 0; iCell < nCells; ++iCell) { if (cell = cells[iCell]) { site = cell.site; halfedges = cell.halfedges; iHalfedge = halfedges.length; // Remove any dangling clipped edges. while (iHalfedge--) { if (!edges[halfedges[iHalfedge]]) { halfedges.splice(iHalfedge, 1); } } // Insert any border edges as necessary. iHalfedge = 0, nHalfedges = halfedges.length; while (iHalfedge < nHalfedges) { end = cellHalfedgeEnd(cell, edges[halfedges[iHalfedge]]), endX = end[0], endY = end[1]; start = cellHalfedgeStart(cell, edges[halfedges[++iHalfedge % nHalfedges]]), startX = start[0], startY = start[1]; if (Math.abs(endX - startX) > epsilon || Math.abs(endY - startY) > epsilon) { halfedges.splice(iHalfedge, 0, edges.push(createBorderEdge(site, end, Math.abs(endX - x0) < epsilon && y1 - endY > epsilon ? [x0, Math.abs(startX - x0) < epsilon ? startY : y1] : Math.abs(endY - y1) < epsilon && x1 - endX > epsilon ? [Math.abs(startY - y1) < epsilon ? startX : x1, y1] : Math.abs(endX - x1) < epsilon && endY - y0 > epsilon ? [x1, Math.abs(startX - x1) < epsilon ? startY : y0] : Math.abs(endY - y0) < epsilon && endX - x0 > epsilon ? [Math.abs(startY - y0) < epsilon ? startX : x0, y0] : null)) - 1); ++nHalfedges; } } if (nHalfedges) cover = false; } } // If there weren’t any edges, have the closest site cover the extent. // It doesn’t matter which corner of the extent we measure! if (cover) { var dx, dy, d2, dc = Infinity; for (iCell = 0, cover = null; iCell < nCells; ++iCell) { if (cell = cells[iCell]) { site = cell.site; dx = site[0] - x0; dy = site[1] - y0; d2 = dx * dx + dy * dy; if (d2 < dc) dc = d2, cover = cell; } } if (cover) { var v00 = [x0, y0], v01 = [x0, y1], v11 = [x1, y1], v10 = [x1, y0]; cover.halfedges.push( edges.push(createBorderEdge(site = cover.site, v00, v01)) - 1, edges.push(createBorderEdge(site, v01, v11)) - 1, edges.push(createBorderEdge(site, v11, v10)) - 1, edges.push(createBorderEdge(site, v10, v00)) - 1 ); } } // Lastly delete any cells with no edges; these were entirely clipped. for (iCell = 0; iCell < nCells; ++iCell) { if (cell = cells[iCell]) { if (!cell.halfedges.length) { delete cells[iCell]; } } } } d3-voronoi-1.1.4/src/Circle.js000066400000000000000000000031401334007347100160420ustar00rootroot00000000000000import {RedBlackNode} from "./RedBlackTree"; import {circles, epsilon2} from "./Diagram"; var circlePool = []; export var firstCircle; function Circle() { RedBlackNode(this); this.x = this.y = this.arc = this.site = this.cy = null; } export function attachCircle(arc) { var lArc = arc.P, rArc = arc.N; if (!lArc || !rArc) return; var lSite = lArc.site, cSite = arc.site, rSite = rArc.site; if (lSite === rSite) return; var bx = cSite[0], by = cSite[1], ax = lSite[0] - bx, ay = lSite[1] - by, cx = rSite[0] - bx, cy = rSite[1] - by; var d = 2 * (ax * cy - ay * cx); if (d >= -epsilon2) return; var ha = ax * ax + ay * ay, hc = cx * cx + cy * cy, x = (cy * ha - ay * hc) / d, y = (ax * hc - cx * ha) / d; var circle = circlePool.pop() || new Circle; circle.arc = arc; circle.site = cSite; circle.x = x + bx; circle.y = (circle.cy = y + by) + Math.sqrt(x * x + y * y); // y bottom arc.circle = circle; var before = null, node = circles._; while (node) { if (circle.y < node.y || (circle.y === node.y && circle.x <= node.x)) { if (node.L) node = node.L; else { before = node.P; break; } } else { if (node.R) node = node.R; else { before = node; break; } } } circles.insert(before, circle); if (!before) firstCircle = circle; } export function detachCircle(arc) { var circle = arc.circle; if (circle) { if (!circle.P) firstCircle = circle.N; circles.remove(circle); circlePool.push(circle); RedBlackNode(circle); arc.circle = null; } } d3-voronoi-1.1.4/src/Diagram.js000066400000000000000000000067571334007347100162260ustar00rootroot00000000000000import {addBeach, removeBeach} from "./Beach"; import {sortCellHalfedges, cellHalfedgeStart, clipCells} from "./Cell"; import {firstCircle} from "./Circle"; import {clipEdges} from "./Edge"; import RedBlackTree from "./RedBlackTree"; export var epsilon = 1e-6; export var epsilon2 = 1e-12; export var beaches; export var cells; export var circles; export var edges; function triangleArea(a, b, c) { return (a[0] - c[0]) * (b[1] - a[1]) - (a[0] - b[0]) * (c[1] - a[1]); } function lexicographic(a, b) { return b[1] - a[1] || b[0] - a[0]; } export default function Diagram(sites, extent) { var site = sites.sort(lexicographic).pop(), x, y, circle; edges = []; cells = new Array(sites.length); beaches = new RedBlackTree; circles = new RedBlackTree; while (true) { circle = firstCircle; if (site && (!circle || site[1] < circle.y || (site[1] === circle.y && site[0] < circle.x))) { if (site[0] !== x || site[1] !== y) { addBeach(site); x = site[0], y = site[1]; } site = sites.pop(); } else if (circle) { removeBeach(circle.arc); } else { break; } } sortCellHalfedges(); if (extent) { var x0 = +extent[0][0], y0 = +extent[0][1], x1 = +extent[1][0], y1 = +extent[1][1]; clipEdges(x0, y0, x1, y1); clipCells(x0, y0, x1, y1); } this.edges = edges; this.cells = cells; beaches = circles = edges = cells = null; } Diagram.prototype = { constructor: Diagram, polygons: function() { var edges = this.edges; return this.cells.map(function(cell) { var polygon = cell.halfedges.map(function(i) { return cellHalfedgeStart(cell, edges[i]); }); polygon.data = cell.site.data; return polygon; }); }, triangles: function() { var triangles = [], edges = this.edges; this.cells.forEach(function(cell, i) { if (!(m = (halfedges = cell.halfedges).length)) return; var site = cell.site, halfedges, j = -1, m, s0, e1 = edges[halfedges[m - 1]], s1 = e1.left === site ? e1.right : e1.left; while (++j < m) { s0 = s1; e1 = edges[halfedges[j]]; s1 = e1.left === site ? e1.right : e1.left; if (s0 && s1 && i < s0.index && i < s1.index && triangleArea(site, s0, s1) < 0) { triangles.push([site.data, s0.data, s1.data]); } } }); return triangles; }, links: function() { return this.edges.filter(function(edge) { return edge.right; }).map(function(edge) { return { source: edge.left.data, target: edge.right.data }; }); }, find: function(x, y, radius) { var that = this, i0, i1 = that._found || 0, n = that.cells.length, cell; // Use the previously-found cell, or start with an arbitrary one. while (!(cell = that.cells[i1])) if (++i1 >= n) return null; var dx = x - cell.site[0], dy = y - cell.site[1], d2 = dx * dx + dy * dy; // Traverse the half-edges to find a closer cell, if any. do { cell = that.cells[i0 = i1], i1 = null; cell.halfedges.forEach(function(e) { var edge = that.edges[e], v = edge.left; if ((v === cell.site || !v) && !(v = edge.right)) return; var vx = x - v[0], vy = y - v[1], v2 = vx * vx + vy * vy; if (v2 < d2) d2 = v2, i1 = v.index; }); } while (i1 !== null); that._found = i0; return radius == null || d2 <= radius * radius ? cell.site : null; } } d3-voronoi-1.1.4/src/Edge.js000066400000000000000000000070621334007347100155140ustar00rootroot00000000000000import {cells, edges, epsilon} from "./Diagram"; export function createEdge(left, right, v0, v1) { var edge = [null, null], index = edges.push(edge) - 1; edge.left = left; edge.right = right; if (v0) setEdgeEnd(edge, left, right, v0); if (v1) setEdgeEnd(edge, right, left, v1); cells[left.index].halfedges.push(index); cells[right.index].halfedges.push(index); return edge; } export function createBorderEdge(left, v0, v1) { var edge = [v0, v1]; edge.left = left; return edge; } export function setEdgeEnd(edge, left, right, vertex) { if (!edge[0] && !edge[1]) { edge[0] = vertex; edge.left = left; edge.right = right; } else if (edge.left === right) { edge[1] = vertex; } else { edge[0] = vertex; } } // Liang–Barsky line clipping. function clipEdge(edge, x0, y0, x1, y1) { var a = edge[0], b = edge[1], ax = a[0], ay = a[1], bx = b[0], by = b[1], t0 = 0, t1 = 1, dx = bx - ax, dy = by - ay, r; r = x0 - ax; if (!dx && r > 0) return; r /= dx; if (dx < 0) { if (r < t0) return; if (r < t1) t1 = r; } else if (dx > 0) { if (r > t1) return; if (r > t0) t0 = r; } r = x1 - ax; if (!dx && r < 0) return; r /= dx; if (dx < 0) { if (r > t1) return; if (r > t0) t0 = r; } else if (dx > 0) { if (r < t0) return; if (r < t1) t1 = r; } r = y0 - ay; if (!dy && r > 0) return; r /= dy; if (dy < 0) { if (r < t0) return; if (r < t1) t1 = r; } else if (dy > 0) { if (r > t1) return; if (r > t0) t0 = r; } r = y1 - ay; if (!dy && r < 0) return; r /= dy; if (dy < 0) { if (r > t1) return; if (r > t0) t0 = r; } else if (dy > 0) { if (r < t0) return; if (r < t1) t1 = r; } if (!(t0 > 0) && !(t1 < 1)) return true; // TODO Better check? if (t0 > 0) edge[0] = [ax + t0 * dx, ay + t0 * dy]; if (t1 < 1) edge[1] = [ax + t1 * dx, ay + t1 * dy]; return true; } function connectEdge(edge, x0, y0, x1, y1) { var v1 = edge[1]; if (v1) return true; var v0 = edge[0], left = edge.left, right = edge.right, lx = left[0], ly = left[1], rx = right[0], ry = right[1], fx = (lx + rx) / 2, fy = (ly + ry) / 2, fm, fb; if (ry === ly) { if (fx < x0 || fx >= x1) return; if (lx > rx) { if (!v0) v0 = [fx, y0]; else if (v0[1] >= y1) return; v1 = [fx, y1]; } else { if (!v0) v0 = [fx, y1]; else if (v0[1] < y0) return; v1 = [fx, y0]; } } else { fm = (lx - rx) / (ry - ly); fb = fy - fm * fx; if (fm < -1 || fm > 1) { if (lx > rx) { if (!v0) v0 = [(y0 - fb) / fm, y0]; else if (v0[1] >= y1) return; v1 = [(y1 - fb) / fm, y1]; } else { if (!v0) v0 = [(y1 - fb) / fm, y1]; else if (v0[1] < y0) return; v1 = [(y0 - fb) / fm, y0]; } } else { if (ly < ry) { if (!v0) v0 = [x0, fm * x0 + fb]; else if (v0[0] >= x1) return; v1 = [x1, fm * x1 + fb]; } else { if (!v0) v0 = [x1, fm * x1 + fb]; else if (v0[0] < x0) return; v1 = [x0, fm * x0 + fb]; } } } edge[0] = v0; edge[1] = v1; return true; } export function clipEdges(x0, y0, x1, y1) { var i = edges.length, edge; while (i--) { if (!connectEdge(edge = edges[i], x0, y0, x1, y1) || !clipEdge(edge, x0, y0, x1, y1) || !(Math.abs(edge[0][0] - edge[1][0]) > epsilon || Math.abs(edge[0][1] - edge[1][1]) > epsilon)) { delete edges[i]; } } } d3-voronoi-1.1.4/src/RedBlackTree.js000066400000000000000000000122661334007347100171410ustar00rootroot00000000000000function RedBlackTree() { this._ = null; // root node } export function RedBlackNode(node) { node.U = // parent node node.C = // color - true for red, false for black node.L = // left node node.R = // right node node.P = // previous node node.N = null; // next node } RedBlackTree.prototype = { constructor: RedBlackTree, insert: function(after, node) { var parent, grandpa, uncle; if (after) { node.P = after; node.N = after.N; if (after.N) after.N.P = node; after.N = node; if (after.R) { after = after.R; while (after.L) after = after.L; after.L = node; } else { after.R = node; } parent = after; } else if (this._) { after = RedBlackFirst(this._); node.P = null; node.N = after; after.P = after.L = node; parent = after; } else { node.P = node.N = null; this._ = node; parent = null; } node.L = node.R = null; node.U = parent; node.C = true; after = node; while (parent && parent.C) { grandpa = parent.U; if (parent === grandpa.L) { uncle = grandpa.R; if (uncle && uncle.C) { parent.C = uncle.C = false; grandpa.C = true; after = grandpa; } else { if (after === parent.R) { RedBlackRotateLeft(this, parent); after = parent; parent = after.U; } parent.C = false; grandpa.C = true; RedBlackRotateRight(this, grandpa); } } else { uncle = grandpa.L; if (uncle && uncle.C) { parent.C = uncle.C = false; grandpa.C = true; after = grandpa; } else { if (after === parent.L) { RedBlackRotateRight(this, parent); after = parent; parent = after.U; } parent.C = false; grandpa.C = true; RedBlackRotateLeft(this, grandpa); } } parent = after.U; } this._.C = false; }, remove: function(node) { if (node.N) node.N.P = node.P; if (node.P) node.P.N = node.N; node.N = node.P = null; var parent = node.U, sibling, left = node.L, right = node.R, next, red; if (!left) next = right; else if (!right) next = left; else next = RedBlackFirst(right); if (parent) { if (parent.L === node) parent.L = next; else parent.R = next; } else { this._ = next; } if (left && right) { red = next.C; next.C = node.C; next.L = left; left.U = next; if (next !== right) { parent = next.U; next.U = node.U; node = next.R; parent.L = node; next.R = right; right.U = next; } else { next.U = parent; parent = next; node = next.R; } } else { red = node.C; node = next; } if (node) node.U = parent; if (red) return; if (node && node.C) { node.C = false; return; } do { if (node === this._) break; if (node === parent.L) { sibling = parent.R; if (sibling.C) { sibling.C = false; parent.C = true; RedBlackRotateLeft(this, parent); sibling = parent.R; } if ((sibling.L && sibling.L.C) || (sibling.R && sibling.R.C)) { if (!sibling.R || !sibling.R.C) { sibling.L.C = false; sibling.C = true; RedBlackRotateRight(this, sibling); sibling = parent.R; } sibling.C = parent.C; parent.C = sibling.R.C = false; RedBlackRotateLeft(this, parent); node = this._; break; } } else { sibling = parent.L; if (sibling.C) { sibling.C = false; parent.C = true; RedBlackRotateRight(this, parent); sibling = parent.L; } if ((sibling.L && sibling.L.C) || (sibling.R && sibling.R.C)) { if (!sibling.L || !sibling.L.C) { sibling.R.C = false; sibling.C = true; RedBlackRotateLeft(this, sibling); sibling = parent.L; } sibling.C = parent.C; parent.C = sibling.L.C = false; RedBlackRotateRight(this, parent); node = this._; break; } } sibling.C = true; node = parent; parent = parent.U; } while (!node.C); if (node) node.C = false; } }; function RedBlackRotateLeft(tree, node) { var p = node, q = node.R, parent = p.U; if (parent) { if (parent.L === p) parent.L = q; else parent.R = q; } else { tree._ = q; } q.U = parent; p.U = q; p.R = q.L; if (p.R) p.R.U = p; q.L = p; } function RedBlackRotateRight(tree, node) { var p = node, q = node.L, parent = p.U; if (parent) { if (parent.L === p) parent.L = q; else parent.R = q; } else { tree._ = q; } q.U = parent; p.U = q; p.L = q.R; if (p.L) p.L.U = p; q.R = p; } function RedBlackFirst(node) { while (node.L) node = node.L; return node; } export default RedBlackTree; d3-voronoi-1.1.4/src/constant.js000066400000000000000000000001101334007347100164640ustar00rootroot00000000000000export default function(x) { return function() { return x; }; } d3-voronoi-1.1.4/src/index.js000066400000000000000000000000561334007347100157530ustar00rootroot00000000000000export {default as voronoi} from "./voronoi"; d3-voronoi-1.1.4/src/point.js000066400000000000000000000001211334007347100157660ustar00rootroot00000000000000export function x(d) { return d[0]; } export function y(d) { return d[1]; } d3-voronoi-1.1.4/src/voronoi.js000066400000000000000000000026141334007347100163410ustar00rootroot00000000000000import constant from "./constant"; import {x as pointX, y as pointY} from "./point"; import Diagram, {epsilon} from "./Diagram"; export default function() { var x = pointX, y = pointY, extent = null; function voronoi(data) { return new Diagram(data.map(function(d, i) { var s = [Math.round(x(d, i, data) / epsilon) * epsilon, Math.round(y(d, i, data) / epsilon) * epsilon]; s.index = i; s.data = d; return s; }), extent); } voronoi.polygons = function(data) { return voronoi(data).polygons(); }; voronoi.links = function(data) { return voronoi(data).links(); }; voronoi.triangles = function(data) { return voronoi(data).triangles(); }; voronoi.x = function(_) { return arguments.length ? (x = typeof _ === "function" ? _ : constant(+_), voronoi) : x; }; voronoi.y = function(_) { return arguments.length ? (y = typeof _ === "function" ? _ : constant(+_), voronoi) : y; }; voronoi.extent = function(_) { return arguments.length ? (extent = _ == null ? null : [[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]], voronoi) : extent && [[extent[0][0], extent[0][1]], [extent[1][0], extent[1][1]]]; }; voronoi.size = function(_) { return arguments.length ? (extent = _ == null ? null : [[0, 0], [+_[0], +_[1]]], voronoi) : extent && [extent[1][0] - extent[0][0], extent[1][1] - extent[0][1]]; }; return voronoi; } d3-voronoi-1.1.4/test/000077500000000000000000000000001334007347100144755ustar00rootroot00000000000000d3-voronoi-1.1.4/test/asArray.js000066400000000000000000000001521334007347100164330ustar00rootroot00000000000000module.exports = function asArray(array) { return Array.isArray(array) ? array.map(asArray) : array; }; d3-voronoi-1.1.4/test/polygonArea.js000066400000000000000000000003671334007347100173210ustar00rootroot00000000000000module.exports = function(polygon) { var i = -1, n = polygon.length, a, b = polygon[n - 1], area = 0; while (++i < n) { a = b; b = polygon[i]; area += a[1] * b[0] - a[0] * b[1]; } return area * .5; }; d3-voronoi-1.1.4/test/voronoi-find-test.js000066400000000000000000000022121334007347100204160ustar00rootroot00000000000000var tape = require("tape"), asArray = require("./asArray"), voronoi = require("../"); tape("voronoi(points).find(x, y) returns the closest site", function(test) { var v = voronoi.voronoi(); test.deepEqual(asArray(v([[200, 200], [500, 250], [760, 300]]).find(0, 0)), [200, 200]); test.deepEqual(asArray(v([[200, 200], [500, 250], [760, 300]]).find(600, 0)), [500, 250]); test.end(); }); tape("voronoi(points).find(x, y, radius) returns the closest site within radius", function(test) { var v = voronoi.voronoi(); test.strictEqual(v([[200, 200], [500, 250], [760, 300]]).find(0, 0, 10), null); test.deepEqual(asArray(v([[200, 200], [500, 250], [760, 300]]).find(0, 0, 300)), [200, 200]); test.end(); }); tape("voronoi(points).find(x, y, 0) returns the site at the position [x, y]", function(test) { var v = voronoi.voronoi(); test.deepEqual(asArray(v([[200, 200], [500, 250], [760, 300]]).find(200, 200, 0)), [200, 200]); test.end(); }); tape("voronoi(points).find(x, y) handles coincident points", function(test) { var v = voronoi.voronoi(); test.deepEqual(asArray(v([[0, 0], [0, 0]]).find(0, 0)), [0, 0]); test.end(); }); d3-voronoi-1.1.4/test/voronoi-links-test.js000066400000000000000000000021251334007347100206210ustar00rootroot00000000000000var tape = require("tape"), voronoi = require("../"); tape("voronoi.links(points) returns the Delaunay mesh for the specified points", function(test) { var v = voronoi.voronoi(); test.deepEqual(v.links([[200, 200], [760, 300]]), [ {source: [200, 200], target: [760, 300]} ]); test.deepEqual(v.links([[200, 200], [500, 250], [760, 300]]), [ {source: [200, 200], target: [500, 250]}, {source: [500, 250], target: [760, 300]}, {source: [760, 300], target: [200, 200]} ]); test.end(); }); tape("voronoi.links(points) observes the specified x- and y-accessors", function(test) { var v = voronoi.voronoi().x(function(d) { return d.x; }).y(function(d) { return d.y; }); test.deepEqual(v.links([{x: 200, y: 200}, {x: 760, y: 300}]), [ {source: {x: 200, y: 200}, target: {x: 760, y: 300}} ]); test.deepEqual(v.links([{x: 200, y: 200}, {x: 500, y: 250}, {x: 760, y: 300}]), [ {source: {x: 200, y: 200}, target: {x: 500, y: 250}}, {source: {x: 500, y: 250}, target: {x: 760, y: 300}}, {source: {x: 760, y: 300}, target: {x: 200, y: 200}} ]); test.end(); }); d3-voronoi-1.1.4/test/voronoi-test.js000066400000000000000000000225521334007347100175110ustar00rootroot00000000000000var tape = require("tape"), d3 = require("../"), asArray = require("./asArray"), polygonArea = require("./polygonArea"); var infinity = 1e6, // For sufficiently small values of Infinity. infinite = [[-infinity, -infinity], [infinity, infinity]]; tape("voronoi() has the expected defaults", function(test) { var voronoi = d3.voronoi(); test.equal(voronoi.extent(), null); test.equal(voronoi.size(), null); test.equal(voronoi.x()([1, 2]), 1); test.equal(voronoi.y()([1, 2]), 2); test.end(); }); tape("voronoi.size([x, y]) is an alias for voronoi.extent([[0, 0], [x, y]])", function(test) { var voronoi = d3.voronoi(); test.equal(voronoi.size([3, 4]), voronoi); test.deepEqual(voronoi.size(), [3, 4]); test.deepEqual(voronoi.extent(), [[0, 0], [3, 4]]); voronoi.size([960, 500]); test.deepEqual(voronoi.size(), [960, 500]); test.deepEqual(voronoi.extent(), [[0, 0], [960, 500]]); test.deepEqual(asArray(voronoi.polygons([[200, 200]])), [ [[0, 0], [0, 500], [960, 500], [960, 0]] ]); test.deepEqual(asArray(voronoi.polygons([[200, 200], [760, 300]])), [ [[435.3571428571429, 500], [524.6428571428572, 0], [0, 0], [0, 500]], [[524.6428571428572, 0], [435.3571428571429, 500], [960, 500], [960, 0]] ]); test.end(); }); tape("voronoi.size() returns the width and height of the extent", function(test) { var voronoi = d3.voronoi().extent([[1, 2], [34, 56]]); test.deepEqual(voronoi.size(), [33, 54]); test.end(); }); tape("voronoi.extent([[x1, y1], [x2, y2]]) sets the specified extent", function(test) { var voronoi = d3.voronoi(); test.equal(voronoi.extent([[1, 2], [3, 4]]), voronoi); test.deepEqual(voronoi.extent(), [[1, 2], [3, 4]]); voronoi.extent([[0, 0], [960, 500]]); test.deepEqual(voronoi.size(), [960, 500]); test.deepEqual(voronoi.extent(), [[0, 0], [960, 500]]); test.deepEqual(asArray(voronoi.polygons([[200, 200], [760, 300]])), [ [[435.3571428571429, 500], [524.6428571428572, 0], [0, 0], [0, 500]], [[524.6428571428572, 0], [435.3571428571429, 500], [960, 500], [960, 0]] ]); test.end(); }); tape("voronoi.x(x) sets the specified x-accessor", function(test) { var voronoi = d3.voronoi().extent(infinite); test.equal(voronoi.x(function(d) { return d.x; }), voronoi); test.equal(voronoi.x()({x: 1}), 1); test.deepEqual(asArray(voronoi.polygons([{x: 200, 1: 200}, {x: 760, 1: 300}])), [ [[-178046.78571428574, infinity], [179096.07142857145, -infinity], [-infinity, -infinity], [-infinity, infinity]], [[179096.07142857145, -infinity], [-178046.78571428574, infinity], [infinity, infinity], [infinity, -infinity]] ]); test.end(); }); tape("voronoi.y(y) sets the specified y-accessor", function(test) { var voronoi = d3.voronoi().extent(infinite); test.equal(voronoi.y(function(d) { return d.y; }), voronoi); test.equal(voronoi.y()({y: 1}), 1); test.deepEqual(asArray(voronoi.polygons([{0: 200, y: 200}, {0: 760, y: 300}])), [ [[-178046.78571428574, infinity], [179096.07142857145, -infinity], [-infinity, -infinity], [-infinity, infinity]], [[179096.07142857145, -infinity], [-178046.78571428574, infinity], [infinity, infinity], [infinity, -infinity]] ]); test.end(); }); tape("voronoi.x(x) allows the specified x-accessor to be a constant", function(test) { var voronoi = d3.voronoi().extent(infinite).y(function(d) { return d; }); test.equal(voronoi.x(42), voronoi); test.equal(voronoi.x()(), 42); test.deepEqual(asArray(voronoi.polygons([200, 760])), [ [[-infinity, 480], [infinity, 480], [infinity, -infinity], [-infinity, -infinity]], [[infinity, 480], [-infinity, 480], [-infinity, infinity], [infinity, infinity]] ]); test.end(); }); tape("voronoi.y(y) allows the specified y-accessor to be a constant", function(test) { var voronoi = d3.voronoi().extent(infinite).x(function(d) { return d; }); test.equal(voronoi.y(43), voronoi); test.equal(voronoi.y()(), 43); test.deepEqual(asArray(voronoi.polygons([200, 760])), [ [[480, infinity], [480, -infinity], [-infinity, -infinity], [-infinity, infinity]], [[480, -infinity], [480, infinity], [infinity, infinity], [infinity, -infinity]] ]); test.end(); }); tape("voronoi.polygons(points) returns an array of polygons for the specified points", function(test) { test.deepEqual(asArray(d3.voronoi().extent(infinite).polygons([[200, 200], [760, 300]])), [ [[-178046.78571428574, infinity], [179096.07142857145, -infinity], [-infinity, -infinity], [-infinity, infinity]], [[179096.07142857145, -infinity], [-178046.78571428574, infinity], [infinity, infinity], [infinity, -infinity]] ]); test.end(); }); tape("voronoi.polygons(points) returns open, counterclockwise polygons", function(test) { d3.voronoi().extent(infinite).polygons([[200, 200], [760, 300]]).forEach(function(cell) { test.ok(cell.length > 2); test.ok(cell[0][0] !== cell[cell.length - 1][0] || cell[0][1] !== cell[cell.length - 1][1]); test.ok(polygonArea(cell) > 0); }); test.end(); }); tape("voronoi.polygons(points) returns polygons where polygons[i].data is equal to points[i]", function(test) { var points = [[200, 200], [760, 300]]; d3.voronoi().extent(infinite).polygons(points).forEach(function(cell, i) { test.equal(cell.data, points[i]); }); test.end(); }); tape("voronoi.polygons(points) can handle no points", function(test) { test.deepEqual(asArray(d3.voronoi().size([960, 500]).polygons([])), []); test.end(); }); tape("voronoi.polygons(points) handles coincident points", function(test) { var voronoi = d3.voronoi(); test.equal(voronoi.polygons([[0, 0], [0, 0]])[1].length, 0); test.end(); }); tape("voronoi.polygons(points) can handle a single point", function(test) { test.deepEqual(asArray(d3.voronoi().size([960, 500]).polygons([[100, 100]])), [ [[0, 0], [0, 500], [960, 500], [960, 0]] ]); test.deepEqual(asArray(d3.voronoi().size([960, 500]).polygons([[-100, -100]])), [ [[0, 0], [0, 500], [960, 500], [960, 0]] ]); test.end(); }); tape("voronoi.polygons(points) can handle a two points whose cells do not intersect the extent", function(test) { test.deepEqual(asArray(d3.voronoi().size([960, 500]).polygons([[480, -200], [480, 100]])), [ , [[0, 0], [0, 500], [960, 500], [960, 0]] ]); test.deepEqual(asArray(d3.voronoi().size([960, 500]).polygons([[480, 100], [480, -200]])), [ [[0, 0], [0, 500], [960, 500], [960, 0]] , ]); test.deepEqual(asArray(d3.voronoi().size([960, 500]).polygons([[480, 1000], [480, -2000]])), [ [[0, 0], [0, 500], [960, 500], [960, 0]] , ]); test.deepEqual(asArray(d3.voronoi().size([960, 500]).polygons([[480, -2000], [480, 1000]])), [ , [[0, 0], [0, 500], [960, 500], [960, 0]] ]); test.end(); }); tape("voronoi.polygons(points) can separate two points with a horizontal line", function(test) { test.deepEqual(asArray(d3.voronoi().extent(infinite).polygons([[0, -100], [0, 100]])), [ [[-infinity, 0], [infinity, 0], [infinity, -infinity], [-infinity, -infinity]], [[infinity, 0], [-infinity, 0], [-infinity, infinity], [infinity, infinity]] ]); test.deepEqual(asArray(d3.voronoi().extent(infinite).polygons([[0, 100], [0, -100]])), [ [[infinity, 0], [-infinity, 0], [-infinity, infinity], [infinity, infinity]], [[-infinity, 0], [infinity, 0], [infinity, -infinity], [-infinity, -infinity]] ]); test.end(); }); tape("voronoi.polygons(points) can separate two points with a vertical line", function(test) { test.deepEqual(asArray(d3.voronoi().extent(infinite).polygons([[100, 0], [-100, 0]])), [ [[0, -infinity], [0, infinity], [infinity, infinity], [infinity, -infinity]], [[0, infinity], [0, -infinity], [-infinity, -infinity], [-infinity, infinity]] ]); test.deepEqual(asArray(d3.voronoi().extent(infinite).polygons([[-100, 0], [100, 0]])), [ [[0, infinity], [0, -infinity], [-infinity, -infinity], [-infinity, infinity]], [[0, -infinity], [0, infinity], [infinity, infinity], [infinity, -infinity]] ]); test.end(); }); tape("voronoi.polygons(points) can separate two points with a diagonal line", function(test) { test.deepEqual(asArray(d3.voronoi().extent(infinite).polygons([[-100, -100], [100, 100]])), [ [[-infinity, infinity], [infinity, -infinity], [-infinity, -infinity]], [[infinity, -infinity], [-infinity, infinity], [infinity, infinity]] ]); test.deepEqual(asArray(d3.voronoi().extent(infinite).polygons([[100, 100], [-100, -100]])), [ [[infinity, -infinity], [-infinity, infinity], [infinity, infinity]], [[-infinity, infinity], [infinity, -infinity], [-infinity, -infinity]] ]); test.end(); }); tape("voronoi.polygons(points) can separate two points with an arbitrary diagonal", function(test) { test.deepEqual(asArray(d3.voronoi().extent(infinite).polygons([[-100, -100], [100, 0]])), [ [[-500025, infinity], [499975, -infinity], [-infinity, -infinity], [-infinity, infinity]], [ [499975, -infinity], [-500025, infinity], [infinity, infinity], [infinity, -infinity]] ]); test.end(); }); tape("voronoi.polygons(points) can handle three collinear points", function(test) { test.deepEqual(asArray(d3.voronoi().extent(infinite).polygons([[-100, -100], [0, 0], [100, 100]])), [ [[-infinity, 999900], [999900, -infinity], [-infinity, -infinity]], [[-999900, infinity], [infinity, -999900], [infinity, -infinity], [999900, -infinity], [-infinity, 999900], [-infinity, infinity]], [[infinity, -999900], [-999900, infinity], [infinity, infinity]] ]); test.end(); }); d3-voronoi-1.1.4/test/voronoi-triangles-test.js000066400000000000000000000022671334007347100215000ustar00rootroot00000000000000var tape = require("tape"), d3 = require("../"); tape("voronoi.triangles(points) returns the Delaunay triangulation for the specified points", function(test) { var voronoi = d3.voronoi(); test.deepEqual(voronoi.triangles([[200, 200], [500, 250], [760, 300]]), [ [[200, 200], [760, 300], [500, 250]] ]); test.end(); }); tape("voronoi.triangles(points) observes the specified x- and y-accessors", function(test) { var voronoi = d3.voronoi().x(function(d) { return d.x; }).y(function(d) { return d.y; }); test.deepEqual(voronoi.triangles([{x: 200, y: 200}, {x: 500, y: 250}, {x: 760, y: 300}]), [ [{x: 200, y: 200}, {x: 760, y: 300}, {x: 500, y: 250}] ]); test.end(); }); tape("voronoi.extent(extent).triangles(points) returns a limited triangulation", function(test) { var voronoi = d3.voronoi().extent([[0, 0], [800, 600]]); test.deepEqual(voronoi.triangles([[100, 100], [100, 200], [200, 200], [500, 250], [760, 300]]), [ [[100, 100], [100, 200], [200, 200]] ]); test.end(); }); tape("voronoi.triangles(points) handles coincident points", function(test) { var voronoi = d3.voronoi(); test.deepEqual(voronoi.triangles([[0, 0], [0, 0]]), []); test.end(); }); d3-voronoi-1.1.4/yarn.lock000066400000000000000000000765141334007347100153560ustar00rootroot00000000000000# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1 "@babel/code-frame@^7.0.0-beta.47": version "7.0.0-rc.3" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-rc.3.tgz#d77a587401f818a3168700f596e41cd6905947b2" dependencies: "@babel/highlight" "7.0.0-rc.3" "@babel/highlight@7.0.0-rc.3": version "7.0.0-rc.3" resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-rc.3.tgz#c2ee83f8e5c0c387279a8c48e06fef2e32027004" dependencies: chalk "^2.0.0" esutils "^2.0.2" js-tokens "^4.0.0" "@types/estree@0.0.39": version "0.0.39" resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" "@types/node@*": version "10.9.1" resolved "https://registry.yarnpkg.com/@types/node/-/node-10.9.1.tgz#06f002136fbcf51e730995149050bb3c45ee54e6" acorn-jsx@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-4.1.1.tgz#e8e41e48ea2fe0c896740610ab6a4ffd8add225e" dependencies: acorn "^5.0.3" acorn@^5.0.3, acorn@^5.6.0: version "5.7.2" resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.2.tgz#91fa871883485d06708800318404e72bfb26dcc5" ajv-keywords@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.2.0.tgz#e86b819c602cf8821ad637413698f1dec021847a" ajv@^6.0.1, ajv@^6.5.0: version "6.5.3" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.5.3.tgz#71a569d189ecf4f4f321224fecb166f071dd90f9" dependencies: fast-deep-equal "^2.0.1" fast-json-stable-stringify "^2.0.0" json-schema-traverse "^0.4.1" uri-js "^4.2.2" ansi-escapes@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.1.0.tgz#f73207bb81207d75fd6c83f125af26eea378ca30" ansi-regex@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" ansi-regex@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" dependencies: color-convert "^1.9.0" argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" dependencies: sprintf-js "~1.0.2" array-union@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" dependencies: array-uniq "^1.0.1" array-uniq@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" arrify@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" babel-code-frame@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" dependencies: chalk "^1.1.3" esutils "^2.0.2" js-tokens "^3.0.2" balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" dependencies: balanced-match "^1.0.0" concat-map "0.0.1" buffer-from@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" caller-path@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" dependencies: callsites "^0.2.0" callsites@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" dependencies: ansi-styles "^2.2.1" escape-string-regexp "^1.0.2" has-ansi "^2.0.0" strip-ansi "^3.0.0" supports-color "^2.0.0" chalk@^2.0.0, chalk@^2.1.0: version "2.4.1" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e" dependencies: ansi-styles "^3.2.1" escape-string-regexp "^1.0.5" supports-color "^5.3.0" chardet@^0.4.0: version "0.4.2" resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2" circular-json@^0.3.1: version "0.3.3" resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66" cli-cursor@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" dependencies: restore-cursor "^2.0.0" cli-width@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" color-convert@^1.9.0: version "1.9.2" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.2.tgz#49881b8fba67df12a96bdf3f56c0aab9e7913147" dependencies: color-name "1.1.1" color-name@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.1.tgz#4b1415304cf50028ea81643643bd82ea05803689" commander@~2.16.0: version "2.16.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.16.0.tgz#f16390593996ceb4f3eeb020b31d78528f7f8a50" concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" cross-spawn@^6.0.5: version "6.0.5" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" dependencies: nice-try "^1.0.4" path-key "^2.0.1" semver "^5.5.0" shebang-command "^1.2.0" which "^1.2.9" debug@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" dependencies: ms "2.0.0" deep-equal@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.0.1.tgz#f5d260292b660e084eff4cdbc9f08ad3247448b5" deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" define-properties@^1.1.2: version "1.1.3" resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" dependencies: object-keys "^1.0.12" defined@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/defined/-/defined-1.0.0.tgz#c98d9bcef75674188e110969151199e39b1fa693" del@^2.0.2: version "2.2.2" resolved "https://registry.yarnpkg.com/del/-/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8" dependencies: globby "^5.0.0" is-path-cwd "^1.0.0" is-path-in-cwd "^1.0.0" object-assign "^4.0.1" pify "^2.0.0" pinkie-promise "^2.0.0" rimraf "^2.2.8" doctrine@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" dependencies: esutils "^2.0.2" es-abstract@^1.5.0: version "1.12.0" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.12.0.tgz#9dbbdd27c6856f0001421ca18782d786bf8a6165" dependencies: es-to-primitive "^1.1.1" function-bind "^1.1.1" has "^1.0.1" is-callable "^1.1.3" is-regex "^1.0.4" es-to-primitive@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.1.1.tgz#45355248a88979034b6792e19bb81f2b7975dd0d" dependencies: is-callable "^1.1.1" is-date-object "^1.0.1" is-symbol "^1.0.1" escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" eslint-scope@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.0.tgz#50bf3071e9338bcdc43331794a0cb533f0136172" dependencies: esrecurse "^4.1.0" estraverse "^4.1.1" eslint-utils@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.3.1.tgz#9a851ba89ee7c460346f97cf8939c7298827e512" eslint-visitor-keys@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" eslint@5: version "5.4.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.4.0.tgz#d068ec03006bb9e06b429dc85f7e46c1b69fac62" dependencies: ajv "^6.5.0" babel-code-frame "^6.26.0" chalk "^2.1.0" cross-spawn "^6.0.5" debug "^3.1.0" doctrine "^2.1.0" eslint-scope "^4.0.0" eslint-utils "^1.3.1" eslint-visitor-keys "^1.0.0" espree "^4.0.0" esquery "^1.0.1" esutils "^2.0.2" file-entry-cache "^2.0.0" functional-red-black-tree "^1.0.1" glob "^7.1.2" globals "^11.7.0" ignore "^4.0.2" imurmurhash "^0.1.4" inquirer "^5.2.0" is-resolvable "^1.1.0" js-yaml "^3.11.0" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.3.0" lodash "^4.17.5" minimatch "^3.0.4" mkdirp "^0.5.1" natural-compare "^1.4.0" optionator "^0.8.2" path-is-inside "^1.0.2" pluralize "^7.0.0" progress "^2.0.0" regexpp "^2.0.0" require-uncached "^1.0.3" semver "^5.5.0" strip-ansi "^4.0.0" strip-json-comments "^2.0.1" table "^4.0.3" text-table "^0.2.0" espree@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/espree/-/espree-4.0.0.tgz#253998f20a0f82db5d866385799d912a83a36634" dependencies: acorn "^5.6.0" acorn-jsx "^4.1.1" esprima@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" esquery@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.1.tgz#406c51658b1f5991a5f9b62b1dc25b00e3e5c708" dependencies: estraverse "^4.0.0" esrecurse@^4.1.0: version "4.2.1" resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" dependencies: estraverse "^4.1.0" estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1: version "4.2.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" esutils@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" external-editor@^2.1.0: version "2.2.0" resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.2.0.tgz#045511cfd8d133f3846673d1047c154e214ad3d5" dependencies: chardet "^0.4.0" iconv-lite "^0.4.17" tmp "^0.0.33" fast-deep-equal@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" fast-json-stable-stringify@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" fast-levenshtein@~2.0.4: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" figures@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" dependencies: escape-string-regexp "^1.0.5" file-entry-cache@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361" dependencies: flat-cache "^1.2.1" object-assign "^4.0.1" flat-cache@^1.2.1: version "1.3.0" resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.0.tgz#d3030b32b38154f4e3b7e9c709f490f7ef97c481" dependencies: circular-json "^0.3.1" del "^2.0.2" graceful-fs "^4.1.2" write "^0.2.1" for-each@~0.3.3: version "0.3.3" resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e" dependencies: is-callable "^1.1.3" fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" function-bind@^1.0.2, function-bind@^1.1.1, function-bind@~1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" functional-red-black-tree@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" glob@^7.0.3, glob@^7.0.5, glob@^7.1.2, glob@~7.1.2: version "7.1.2" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" inherits "2" minimatch "^3.0.4" once "^1.3.0" path-is-absolute "^1.0.0" globals@^11.7.0: version "11.7.0" resolved "https://registry.yarnpkg.com/globals/-/globals-11.7.0.tgz#a583faa43055b1aca771914bf68258e2fc125673" globby@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/globby/-/globby-5.0.0.tgz#ebd84667ca0dbb330b99bcfc68eac2bc54370e0d" dependencies: array-union "^1.0.1" arrify "^1.0.0" glob "^7.0.3" object-assign "^4.0.1" pify "^2.0.0" pinkie-promise "^2.0.0" graceful-fs@^4.1.2: version "4.1.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" has-ansi@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" dependencies: ansi-regex "^2.0.0" has-flag@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" has@^1.0.1, has@~1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" dependencies: function-bind "^1.1.1" iconv-lite@^0.4.17: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" dependencies: safer-buffer ">= 2.1.2 < 3" ignore@^4.0.2: version "4.0.6" resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" dependencies: once "^1.3.0" wrappy "1" inherits@2, inherits@~2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" inquirer@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-5.2.0.tgz#db350c2b73daca77ff1243962e9f22f099685726" dependencies: ansi-escapes "^3.0.0" chalk "^2.0.0" cli-cursor "^2.1.0" cli-width "^2.0.0" external-editor "^2.1.0" figures "^2.0.0" lodash "^4.3.0" mute-stream "0.0.7" run-async "^2.2.0" rxjs "^5.5.2" string-width "^2.1.0" strip-ansi "^4.0.0" through "^2.3.6" is-callable@^1.1.1, is-callable@^1.1.3: version "1.1.4" resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75" is-date-object@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" is-fullwidth-code-point@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" is-path-cwd@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" is-path-in-cwd@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz#5ac48b345ef675339bd6c7a48a912110b241cf52" dependencies: is-path-inside "^1.0.0" is-path-inside@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.1.tgz#8ef5b7de50437a3fdca6b4e865ef7aa55cb48036" dependencies: path-is-inside "^1.0.1" is-promise@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" is-regex@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" dependencies: has "^1.0.1" is-resolvable@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.1.0.tgz#fb18f87ce1feb925169c9a407c19318a3206ed88" is-symbol@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572" isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" js-tokens@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" js-yaml@^3.11.0: version "3.12.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1" dependencies: argparse "^1.0.7" esprima "^4.0.0" json-schema-traverse@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" levn@^0.3.0, levn@~0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" dependencies: prelude-ls "~1.1.2" type-check "~0.3.2" lodash@^4.17.4, lodash@^4.17.5, lodash@^4.3.0: version "4.17.10" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7" mimic-fn@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" dependencies: brace-expansion "^1.1.7" minimist@0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" minimist@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" mkdirp@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" dependencies: minimist "0.0.8" ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" mute-stream@0.0.7: version "0.0.7" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" nice-try@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.4.tgz#d93962f6c52f2c1558c0fbda6d512819f1efe1c4" object-assign@^4.0.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" object-inspect@~1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.6.0.tgz#c70b6cbf72f274aab4c34c0c82f5167bf82cf15b" object-keys@^1.0.12: version "1.0.12" resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.12.tgz#09c53855377575310cca62f55bb334abff7b3ed2" once@^1.3.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" dependencies: wrappy "1" onetime@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" dependencies: mimic-fn "^1.0.0" optionator@^0.8.2: version "0.8.2" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" dependencies: deep-is "~0.1.3" fast-levenshtein "~2.0.4" levn "~0.3.0" prelude-ls "~1.1.2" type-check "~0.3.2" wordwrap "~1.0.0" os-tmpdir@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" path-is-absolute@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" path-is-inside@^1.0.1, path-is-inside@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" path-key@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" path-parse@^1.0.5: version "1.0.6" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" pify@^2.0.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" pinkie-promise@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" dependencies: pinkie "^2.0.0" pinkie@^2.0.0: version "2.0.4" resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" pluralize@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777" prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" progress@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f" punycode@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" regexpp@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.0.tgz#b2a7534a85ca1b033bcf5ce9ff8e56d4e0755365" require-uncached@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" dependencies: caller-path "^0.1.0" resolve-from "^1.0.0" resolve-from@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" resolve@~1.7.1: version "1.7.1" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.7.1.tgz#aadd656374fd298aee895bc026b8297418677fd3" dependencies: path-parse "^1.0.5" restore-cursor@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" dependencies: onetime "^2.0.0" signal-exit "^3.0.2" resumer@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/resumer/-/resumer-0.0.0.tgz#f1e8f461e4064ba39e82af3cdc2a8c893d076759" dependencies: through "~2.3.4" rimraf@^2.2.8: version "2.6.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" dependencies: glob "^7.0.5" rollup-plugin-terser@1: version "1.0.1" resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-1.0.1.tgz#ba5f497cbc9aa38ba19d3ee2167c04ea3ed279af" dependencies: "@babel/code-frame" "^7.0.0-beta.47" terser "^3.7.5" rollup@0.64: version "0.64.1" resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.64.1.tgz#9188ee368e5fcd43ffbc00ec414e72eeb5de87ba" dependencies: "@types/estree" "0.0.39" "@types/node" "*" run-async@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" dependencies: is-promise "^2.1.0" rxjs@^5.5.2: version "5.5.11" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.5.11.tgz#f733027ca43e3bec6b994473be4ab98ad43ced87" dependencies: symbol-observable "1.0.1" "safer-buffer@>= 2.1.2 < 3": version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" semver@^5.5.0: version "5.5.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.1.tgz#7dfdd8814bdb7cabc7be0fb1d734cfb66c940477" shebang-command@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" dependencies: shebang-regex "^1.0.0" shebang-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" slice-ansi@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-1.0.0.tgz#044f1a49d8842ff307aad6b505ed178bd950134d" dependencies: is-fullwidth-code-point "^2.0.0" source-map-support@~0.5.6: version "0.5.9" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.9.tgz#41bc953b2534267ea2d605bccfa7bfa3111ced5f" dependencies: buffer-from "^1.0.0" source-map "^0.6.0" source-map@^0.6.0, source-map@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" string-width@^2.1.0, string-width@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" dependencies: is-fullwidth-code-point "^2.0.0" strip-ansi "^4.0.0" string.prototype.trim@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.1.2.tgz#d04de2c89e137f4d7d206f086b5ed2fae6be8cea" dependencies: define-properties "^1.1.2" es-abstract "^1.5.0" function-bind "^1.0.2" strip-ansi@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" dependencies: ansi-regex "^2.0.0" strip-ansi@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" dependencies: ansi-regex "^3.0.0" strip-json-comments@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" supports-color@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" dependencies: has-flag "^3.0.0" symbol-observable@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.1.tgz#8340fc4702c3122df5d22288f88283f513d3fdd4" table@^4.0.3: version "4.0.3" resolved "https://registry.yarnpkg.com/table/-/table-4.0.3.tgz#00b5e2b602f1794b9acaf9ca908a76386a7813bc" dependencies: ajv "^6.0.1" ajv-keywords "^3.0.0" chalk "^2.1.0" lodash "^4.17.4" slice-ansi "1.0.0" string-width "^2.1.1" tape@4: version "4.9.1" resolved "https://registry.yarnpkg.com/tape/-/tape-4.9.1.tgz#1173d7337e040c76fbf42ec86fcabedc9b3805c9" dependencies: deep-equal "~1.0.1" defined "~1.0.0" for-each "~0.3.3" function-bind "~1.1.1" glob "~7.1.2" has "~1.0.3" inherits "~2.0.3" minimist "~1.2.0" object-inspect "~1.6.0" resolve "~1.7.1" resumer "~0.0.0" string.prototype.trim "~1.1.2" through "~2.3.8" terser@^3.7.5: version "3.8.1" resolved "https://registry.yarnpkg.com/terser/-/terser-3.8.1.tgz#cb70070ac9e0a71add169dfb63c0a64fca2738ac" dependencies: commander "~2.16.0" source-map "~0.6.1" source-map-support "~0.5.6" text-table@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" through@^2.3.6, through@~2.3.4, through@~2.3.8: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" tmp@^0.0.33: version "0.0.33" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" dependencies: os-tmpdir "~1.0.2" type-check@~0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" dependencies: prelude-ls "~1.1.2" uri-js@^4.2.2: version "4.2.2" resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" dependencies: punycode "^2.1.0" which@^1.2.9: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" dependencies: isexe "^2.0.0" wordwrap@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" write@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/write/-/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757" dependencies: mkdirp "^0.5.1"