mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 16:31:52 +01:00
config redirect
This commit is contained in:
13
node_modules/d3-polygon/LICENSE
generated
vendored
Normal file
13
node_modules/d3-polygon/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
Copyright 2010-2021 Mike Bostock
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose
|
||||
with or without fee is hereby granted, provided that the above copyright notice
|
||||
and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
THIS SOFTWARE.
|
||||
52
node_modules/d3-polygon/README.md
generated
vendored
Normal file
52
node_modules/d3-polygon/README.md
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
# d3-polygon
|
||||
|
||||
This module provides a few basic geometric operations for two-dimensional polygons. Each polygon is represented as an array of two-element arrays [[<i>x1</i>, <i>y1</i>], [<i>x2</i>, <i>y2</i>], …], and may either be closed (wherein the first and last point are the same) or open (wherein they are not). Typically polygons are in counterclockwise order, assuming a coordinate system where the origin ⟨0,0⟩ is in the top-left corner.
|
||||
|
||||
## Installing
|
||||
|
||||
If you use npm, `npm install d3-polygon`. You can also download the [latest release on GitHub](https://github.com/d3/d3-polygon/releases/latest). For vanilla HTML in modern browsers, import d3-polygon from Skypack:
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
|
||||
import {polygonHull} from "https://cdn.skypack.dev/d3-polygon@3";
|
||||
|
||||
const hull = polygonHull(points);
|
||||
|
||||
</script>
|
||||
```
|
||||
|
||||
For legacy environments, you can load d3-polygon’s UMD bundle from an npm-based CDN such as jsDelivr; a `d3` global is exported:
|
||||
|
||||
```html
|
||||
<script src="https://cdn.jsdelivr.net/npm/d3-polygon@3"></script>
|
||||
<script>
|
||||
|
||||
const hull = d3.polygonHull(points);
|
||||
|
||||
</script>
|
||||
```
|
||||
|
||||
## API Reference
|
||||
|
||||
<a href="#polygonArea" name="polygonArea">#</a> d3.<b>polygonArea</b>(<i>polygon</i>) [<>](https://github.com/d3/d3-polygon/blob/master/src/area.js "Source Code")
|
||||
|
||||
Returns the signed area of the specified *polygon*. If the vertices of the polygon are in counterclockwise order (assuming a coordinate system where the origin ⟨0,0⟩ is in the top-left corner), the returned area is positive; otherwise it is negative, or zero.
|
||||
|
||||
<a href="#polygonCentroid" name="polygonCentroid">#</a> d3.<b>polygonCentroid</b>(<i>polygon</i>) [<>](https://github.com/d3/d3-polygon/blob/master/src/centroid.js "Source Code")
|
||||
|
||||
Returns the [centroid](https://en.wikipedia.org/wiki/Centroid) of the specified *polygon*.
|
||||
|
||||
<a href="#polygonHull" name="polygonHull">#</a> d3.<b>polygonHull</b>(<i>points</i>) [<>](https://github.com/d3/d3-polygon/blob/master/src/hull.js#L23 "Source Code")
|
||||
|
||||
<a href="http://bl.ocks.org/mbostock/6f14f7b7f267a85f7cdc"><img src="https://raw.githubusercontent.com/d3/d3-polygon/master/img/hull.png" width="250" height="250"></a>
|
||||
|
||||
Returns the [convex hull](https://en.wikipedia.org/wiki/Convex_hull) of the specified *points* using [Andrew’s monotone chain algorithm](http://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain). The returned hull is represented as an array containing a subset of the input *points* arranged in counterclockwise order. Returns null if *points* has fewer than three elements.
|
||||
|
||||
<a href="#polygonContains" name="polygonContains">#</a> d3.<b>polygonContains</b>(<i>polygon</i>, <i>point</i>) [<>](https://github.com/d3/d3-polygon/blob/master/src/contains.js "Source Code")
|
||||
|
||||
Returns true if and only if the specified *point* is inside the specified *polygon*.
|
||||
|
||||
<a href="#polygonLength" name="polygonLength">#</a> d3.<b>polygonLength</b>(<i>polygon</i>) [<>](https://github.com/d3/d3-polygon/blob/master/src/length.js "Source Code")
|
||||
|
||||
Returns the length of the perimeter of the specified *polygon*.
|
||||
150
node_modules/d3-polygon/dist/d3-polygon.js
generated
vendored
Normal file
150
node_modules/d3-polygon/dist/d3-polygon.js
generated
vendored
Normal file
@@ -0,0 +1,150 @@
|
||||
// https://d3js.org/d3-polygon/ v3.0.1 Copyright 2010-2021 Mike Bostock
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.d3 = global.d3 || {}));
|
||||
}(this, (function (exports) { 'use strict';
|
||||
|
||||
function area(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 / 2;
|
||||
}
|
||||
|
||||
function centroid(polygon) {
|
||||
var i = -1,
|
||||
n = polygon.length,
|
||||
x = 0,
|
||||
y = 0,
|
||||
a,
|
||||
b = polygon[n - 1],
|
||||
c,
|
||||
k = 0;
|
||||
|
||||
while (++i < n) {
|
||||
a = b;
|
||||
b = polygon[i];
|
||||
k += c = a[0] * b[1] - b[0] * a[1];
|
||||
x += (a[0] + b[0]) * c;
|
||||
y += (a[1] + b[1]) * c;
|
||||
}
|
||||
|
||||
return k *= 3, [x / k, y / k];
|
||||
}
|
||||
|
||||
// Returns the 2D cross product of AB and AC vectors, i.e., the z-component of
|
||||
// the 3D cross product in a quadrant I Cartesian coordinate system (+x is
|
||||
// right, +y is up). Returns a positive value if ABC is counter-clockwise,
|
||||
// negative if clockwise, and zero if the points are collinear.
|
||||
function cross(a, b, c) {
|
||||
return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]);
|
||||
}
|
||||
|
||||
function lexicographicOrder(a, b) {
|
||||
return a[0] - b[0] || a[1] - b[1];
|
||||
}
|
||||
|
||||
// Computes the upper convex hull per the monotone chain algorithm.
|
||||
// Assumes points.length >= 3, is sorted by x, unique in y.
|
||||
// Returns an array of indices into points in left-to-right order.
|
||||
function computeUpperHullIndexes(points) {
|
||||
const n = points.length,
|
||||
indexes = [0, 1];
|
||||
let size = 2, i;
|
||||
|
||||
for (i = 2; i < n; ++i) {
|
||||
while (size > 1 && cross(points[indexes[size - 2]], points[indexes[size - 1]], points[i]) <= 0) --size;
|
||||
indexes[size++] = i;
|
||||
}
|
||||
|
||||
return indexes.slice(0, size); // remove popped points
|
||||
}
|
||||
|
||||
function hull(points) {
|
||||
if ((n = points.length) < 3) return null;
|
||||
|
||||
var i,
|
||||
n,
|
||||
sortedPoints = new Array(n),
|
||||
flippedPoints = new Array(n);
|
||||
|
||||
for (i = 0; i < n; ++i) sortedPoints[i] = [+points[i][0], +points[i][1], i];
|
||||
sortedPoints.sort(lexicographicOrder);
|
||||
for (i = 0; i < n; ++i) flippedPoints[i] = [sortedPoints[i][0], -sortedPoints[i][1]];
|
||||
|
||||
var upperIndexes = computeUpperHullIndexes(sortedPoints),
|
||||
lowerIndexes = computeUpperHullIndexes(flippedPoints);
|
||||
|
||||
// Construct the hull polygon, removing possible duplicate endpoints.
|
||||
var skipLeft = lowerIndexes[0] === upperIndexes[0],
|
||||
skipRight = lowerIndexes[lowerIndexes.length - 1] === upperIndexes[upperIndexes.length - 1],
|
||||
hull = [];
|
||||
|
||||
// Add upper hull in right-to-l order.
|
||||
// Then add lower hull in left-to-right order.
|
||||
for (i = upperIndexes.length - 1; i >= 0; --i) hull.push(points[sortedPoints[upperIndexes[i]][2]]);
|
||||
for (i = +skipLeft; i < lowerIndexes.length - skipRight; ++i) hull.push(points[sortedPoints[lowerIndexes[i]][2]]);
|
||||
|
||||
return hull;
|
||||
}
|
||||
|
||||
function contains(polygon, point) {
|
||||
var n = polygon.length,
|
||||
p = polygon[n - 1],
|
||||
x = point[0], y = point[1],
|
||||
x0 = p[0], y0 = p[1],
|
||||
x1, y1,
|
||||
inside = false;
|
||||
|
||||
for (var i = 0; i < n; ++i) {
|
||||
p = polygon[i], x1 = p[0], y1 = p[1];
|
||||
if (((y1 > y) !== (y0 > y)) && (x < (x0 - x1) * (y - y1) / (y0 - y1) + x1)) inside = !inside;
|
||||
x0 = x1, y0 = y1;
|
||||
}
|
||||
|
||||
return inside;
|
||||
}
|
||||
|
||||
function length(polygon) {
|
||||
var i = -1,
|
||||
n = polygon.length,
|
||||
b = polygon[n - 1],
|
||||
xa,
|
||||
ya,
|
||||
xb = b[0],
|
||||
yb = b[1],
|
||||
perimeter = 0;
|
||||
|
||||
while (++i < n) {
|
||||
xa = xb;
|
||||
ya = yb;
|
||||
b = polygon[i];
|
||||
xb = b[0];
|
||||
yb = b[1];
|
||||
xa -= xb;
|
||||
ya -= yb;
|
||||
perimeter += Math.hypot(xa, ya);
|
||||
}
|
||||
|
||||
return perimeter;
|
||||
}
|
||||
|
||||
exports.polygonArea = area;
|
||||
exports.polygonCentroid = centroid;
|
||||
exports.polygonContains = contains;
|
||||
exports.polygonHull = hull;
|
||||
exports.polygonLength = length;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
})));
|
||||
2
node_modules/d3-polygon/dist/d3-polygon.min.js
generated
vendored
Normal file
2
node_modules/d3-polygon/dist/d3-polygon.min.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
// https://d3js.org/d3-polygon/ v3.0.1 Copyright 2010-2021 Mike Bostock
|
||||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((n="undefined"!=typeof globalThis?globalThis:n||self).d3=n.d3||{})}(this,(function(n){"use strict";function e(n,e){return n[0]-e[0]||n[1]-e[1]}function t(n){const e=n.length,t=[0,1];let o,r=2;for(o=2;o<e;++o){for(;r>1&&(f=n[t[r-2]],l=n[t[r-1]],u=n[o],(l[0]-f[0])*(u[1]-f[1])-(l[1]-f[1])*(u[0]-f[0])<=0);)--r;t[r++]=o}var f,l,u;return t.slice(0,r)}n.polygonArea=function(n){for(var e,t=-1,o=n.length,r=n[o-1],f=0;++t<o;)e=r,r=n[t],f+=e[1]*r[0]-e[0]*r[1];return f/2},n.polygonCentroid=function(n){for(var e,t,o=-1,r=n.length,f=0,l=0,u=n[r-1],i=0;++o<r;)e=u,u=n[o],i+=t=e[0]*u[1]-u[0]*e[1],f+=(e[0]+u[0])*t,l+=(e[1]+u[1])*t;return[f/(i*=3),l/i]},n.polygonContains=function(n,e){for(var t,o,r=n.length,f=n[r-1],l=e[0],u=e[1],i=f[0],g=f[1],h=!1,a=0;a<r;++a)t=(f=n[a])[0],(o=f[1])>u!=g>u&&l<(i-t)*(u-o)/(g-o)+t&&(h=!h),i=t,g=o;return h},n.polygonHull=function(n){if((r=n.length)<3)return null;var o,r,f=new Array(r),l=new Array(r);for(o=0;o<r;++o)f[o]=[+n[o][0],+n[o][1],o];for(f.sort(e),o=0;o<r;++o)l[o]=[f[o][0],-f[o][1]];var u=t(f),i=t(l),g=i[0]===u[0],h=i[i.length-1]===u[u.length-1],a=[];for(o=u.length-1;o>=0;--o)a.push(n[f[u[o]][2]]);for(o=+g;o<i.length-h;++o)a.push(n[f[i[o]][2]]);return a},n.polygonLength=function(n){for(var e,t,o=-1,r=n.length,f=n[r-1],l=f[0],u=f[1],i=0;++o<r;)e=l,t=u,e-=l=(f=n[o])[0],t-=u=f[1],i+=Math.hypot(e,t);return i},Object.defineProperty(n,"__esModule",{value:!0})}));
|
||||
51
node_modules/d3-polygon/package.json
generated
vendored
Normal file
51
node_modules/d3-polygon/package.json
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"name": "d3-polygon",
|
||||
"version": "3.0.1",
|
||||
"description": "Operations for two-dimensional polygons.",
|
||||
"homepage": "https://d3js.org/d3-polygon/",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/d3/d3-polygon.git"
|
||||
},
|
||||
"keywords": [
|
||||
"d3",
|
||||
"d3-module",
|
||||
"polygon",
|
||||
"hull",
|
||||
"geometry",
|
||||
"graphics"
|
||||
],
|
||||
"license": "ISC",
|
||||
"author": {
|
||||
"name": "Mike Bostock",
|
||||
"url": "http://bost.ocks.org/mike"
|
||||
},
|
||||
"type": "module",
|
||||
"files": [
|
||||
"dist/**/*.js",
|
||||
"src/**/*.js"
|
||||
],
|
||||
"module": "src/index.js",
|
||||
"main": "src/index.js",
|
||||
"jsdelivr": "dist/d3-polygon.min.js",
|
||||
"unpkg": "dist/d3-polygon.min.js",
|
||||
"exports": {
|
||||
"umd": "./dist/d3-polygon.min.js",
|
||||
"default": "./src/index.js"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"devDependencies": {
|
||||
"eslint": "7",
|
||||
"mocha": "8",
|
||||
"rollup": "2",
|
||||
"rollup-plugin-terser": "7"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha 'test/**/*-test.js' && eslint src test",
|
||||
"prepublishOnly": "rm -rf dist && yarn test && rollup -c",
|
||||
"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 -"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
}
|
||||
15
node_modules/d3-polygon/src/area.js
generated
vendored
Normal file
15
node_modules/d3-polygon/src/area.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
export default 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 / 2;
|
||||
}
|
||||
20
node_modules/d3-polygon/src/centroid.js
generated
vendored
Normal file
20
node_modules/d3-polygon/src/centroid.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
export default function(polygon) {
|
||||
var i = -1,
|
||||
n = polygon.length,
|
||||
x = 0,
|
||||
y = 0,
|
||||
a,
|
||||
b = polygon[n - 1],
|
||||
c,
|
||||
k = 0;
|
||||
|
||||
while (++i < n) {
|
||||
a = b;
|
||||
b = polygon[i];
|
||||
k += c = a[0] * b[1] - b[0] * a[1];
|
||||
x += (a[0] + b[0]) * c;
|
||||
y += (a[1] + b[1]) * c;
|
||||
}
|
||||
|
||||
return k *= 3, [x / k, y / k];
|
||||
}
|
||||
16
node_modules/d3-polygon/src/contains.js
generated
vendored
Normal file
16
node_modules/d3-polygon/src/contains.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
export default function(polygon, point) {
|
||||
var n = polygon.length,
|
||||
p = polygon[n - 1],
|
||||
x = point[0], y = point[1],
|
||||
x0 = p[0], y0 = p[1],
|
||||
x1, y1,
|
||||
inside = false;
|
||||
|
||||
for (var i = 0; i < n; ++i) {
|
||||
p = polygon[i], x1 = p[0], y1 = p[1];
|
||||
if (((y1 > y) !== (y0 > y)) && (x < (x0 - x1) * (y - y1) / (y0 - y1) + x1)) inside = !inside;
|
||||
x0 = x1, y0 = y1;
|
||||
}
|
||||
|
||||
return inside;
|
||||
}
|
||||
7
node_modules/d3-polygon/src/cross.js
generated
vendored
Normal file
7
node_modules/d3-polygon/src/cross.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// Returns the 2D cross product of AB and AC vectors, i.e., the z-component of
|
||||
// the 3D cross product in a quadrant I Cartesian coordinate system (+x is
|
||||
// right, +y is up). Returns a positive value if ABC is counter-clockwise,
|
||||
// negative if clockwise, and zero if the points are collinear.
|
||||
export default function(a, b, c) {
|
||||
return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]);
|
||||
}
|
||||
49
node_modules/d3-polygon/src/hull.js
generated
vendored
Normal file
49
node_modules/d3-polygon/src/hull.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
import cross from "./cross.js";
|
||||
|
||||
function lexicographicOrder(a, b) {
|
||||
return a[0] - b[0] || a[1] - b[1];
|
||||
}
|
||||
|
||||
// Computes the upper convex hull per the monotone chain algorithm.
|
||||
// Assumes points.length >= 3, is sorted by x, unique in y.
|
||||
// Returns an array of indices into points in left-to-right order.
|
||||
function computeUpperHullIndexes(points) {
|
||||
const n = points.length,
|
||||
indexes = [0, 1];
|
||||
let size = 2, i;
|
||||
|
||||
for (i = 2; i < n; ++i) {
|
||||
while (size > 1 && cross(points[indexes[size - 2]], points[indexes[size - 1]], points[i]) <= 0) --size;
|
||||
indexes[size++] = i;
|
||||
}
|
||||
|
||||
return indexes.slice(0, size); // remove popped points
|
||||
}
|
||||
|
||||
export default function(points) {
|
||||
if ((n = points.length) < 3) return null;
|
||||
|
||||
var i,
|
||||
n,
|
||||
sortedPoints = new Array(n),
|
||||
flippedPoints = new Array(n);
|
||||
|
||||
for (i = 0; i < n; ++i) sortedPoints[i] = [+points[i][0], +points[i][1], i];
|
||||
sortedPoints.sort(lexicographicOrder);
|
||||
for (i = 0; i < n; ++i) flippedPoints[i] = [sortedPoints[i][0], -sortedPoints[i][1]];
|
||||
|
||||
var upperIndexes = computeUpperHullIndexes(sortedPoints),
|
||||
lowerIndexes = computeUpperHullIndexes(flippedPoints);
|
||||
|
||||
// Construct the hull polygon, removing possible duplicate endpoints.
|
||||
var skipLeft = lowerIndexes[0] === upperIndexes[0],
|
||||
skipRight = lowerIndexes[lowerIndexes.length - 1] === upperIndexes[upperIndexes.length - 1],
|
||||
hull = [];
|
||||
|
||||
// Add upper hull in right-to-l order.
|
||||
// Then add lower hull in left-to-right order.
|
||||
for (i = upperIndexes.length - 1; i >= 0; --i) hull.push(points[sortedPoints[upperIndexes[i]][2]]);
|
||||
for (i = +skipLeft; i < lowerIndexes.length - skipRight; ++i) hull.push(points[sortedPoints[lowerIndexes[i]][2]]);
|
||||
|
||||
return hull;
|
||||
}
|
||||
5
node_modules/d3-polygon/src/index.js
generated
vendored
Normal file
5
node_modules/d3-polygon/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export {default as polygonArea} from "./area.js";
|
||||
export {default as polygonCentroid} from "./centroid.js";
|
||||
export {default as polygonHull} from "./hull.js";
|
||||
export {default as polygonContains} from "./contains.js";
|
||||
export {default as polygonLength} from "./length.js";
|
||||
23
node_modules/d3-polygon/src/length.js
generated
vendored
Normal file
23
node_modules/d3-polygon/src/length.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
export default function(polygon) {
|
||||
var i = -1,
|
||||
n = polygon.length,
|
||||
b = polygon[n - 1],
|
||||
xa,
|
||||
ya,
|
||||
xb = b[0],
|
||||
yb = b[1],
|
||||
perimeter = 0;
|
||||
|
||||
while (++i < n) {
|
||||
xa = xb;
|
||||
ya = yb;
|
||||
b = polygon[i];
|
||||
xb = b[0];
|
||||
yb = b[1];
|
||||
xa -= xb;
|
||||
ya -= yb;
|
||||
perimeter += Math.hypot(xa, ya);
|
||||
}
|
||||
|
||||
return perimeter;
|
||||
}
|
||||
Reference in New Issue
Block a user