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

d3-polygon

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-polygon - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

10

dist/d3-polygon.js

@@ -1,7 +0,7 @@

// https://d3js.org/d3-polygon/ v1.0.5 Copyright 2018 Mike Bostock
// https://d3js.org/d3-polygon/ v1.0.6 Copyright 2019 Mike Bostock
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.d3 = global.d3 || {})));
}(this, (function (exports) { 'use strict';
(global = global || self, factory(global.d3 = global.d3 || {}));
}(this, function (exports) { 'use strict';

@@ -144,4 +144,4 @@ function area(polygon) {

exports.polygonCentroid = centroid;
exports.polygonContains = contains;
exports.polygonHull = hull;
exports.polygonContains = contains;
exports.polygonLength = length;

@@ -151,2 +151,2 @@

})));
}));

@@ -1,2 +0,2 @@

// https://d3js.org/d3-polygon/ v1.0.5 Copyright 2018 Mike Bostock
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(n.d3=n.d3||{})}(this,function(n){"use strict";function e(n,e){return n[0]-e[0]||n[1]-e[1]}function r(n){for(var e,r,t,o=n.length,f=[0,1],u=2,l=2;l<o;++l){for(;u>1&&(e=n[f[u-2]],r=n[f[u-1]],t=n[l],(r[0]-e[0])*(t[1]-e[1])-(r[1]-e[1])*(t[0]-e[0])<=0);)--u;f[u++]=l}return f.slice(0,u)}n.polygonArea=function(n){for(var e,r=-1,t=n.length,o=n[t-1],f=0;++r<t;)e=o,o=n[r],f+=e[1]*o[0]-e[0]*o[1];return f/2},n.polygonCentroid=function(n){for(var e,r,t=-1,o=n.length,f=0,u=0,l=n[o-1],i=0;++t<o;)e=l,l=n[t],i+=r=e[0]*l[1]-l[0]*e[1],f+=(e[0]+l[0])*r,u+=(e[1]+l[1])*r;return[f/(i*=3),u/i]},n.polygonHull=function(n){if((o=n.length)<3)return null;var t,o,f=new Array(o),u=new Array(o);for(t=0;t<o;++t)f[t]=[+n[t][0],+n[t][1],t];for(f.sort(e),t=0;t<o;++t)u[t]=[f[t][0],-f[t][1]];var l=r(f),i=r(u),g=i[0]===l[0],h=i[i.length-1]===l[l.length-1],a=[];for(t=l.length-1;t>=0;--t)a.push(n[f[l[t]][2]]);for(t=+g;t<i.length-h;++t)a.push(n[f[i[t]][2]]);return a},n.polygonContains=function(n,e){for(var r,t,o=n.length,f=n[o-1],u=e[0],l=e[1],i=f[0],g=f[1],h=!1,a=0;a<o;++a)r=(f=n[a])[0],(t=f[1])>l!=g>l&&u<(i-r)*(l-t)/(g-t)+r&&(h=!h),i=r,g=t;return h},n.polygonLength=function(n){for(var e,r,t=-1,o=n.length,f=n[o-1],u=f[0],l=f[1],i=0;++t<o;)e=u,r=l,e-=u=(f=n[t])[0],r-=l=f[1],i+=Math.sqrt(e*e+r*r);return i},Object.defineProperty(n,"__esModule",{value:!0})});
// https://d3js.org/d3-polygon/ v1.0.6 Copyright 2019 Mike Bostock
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((n=n||self).d3=n.d3||{})}(this,function(n){"use strict";function e(n,e){return n[0]-e[0]||n[1]-e[1]}function r(n){for(var e,r,t,o=n.length,f=[0,1],u=2,l=2;l<o;++l){for(;u>1&&(e=n[f[u-2]],r=n[f[u-1]],t=n[l],(r[0]-e[0])*(t[1]-e[1])-(r[1]-e[1])*(t[0]-e[0])<=0);)--u;f[u++]=l}return f.slice(0,u)}n.polygonArea=function(n){for(var e,r=-1,t=n.length,o=n[t-1],f=0;++r<t;)e=o,o=n[r],f+=e[1]*o[0]-e[0]*o[1];return f/2},n.polygonCentroid=function(n){for(var e,r,t=-1,o=n.length,f=0,u=0,l=n[o-1],i=0;++t<o;)e=l,l=n[t],i+=r=e[0]*l[1]-l[0]*e[1],f+=(e[0]+l[0])*r,u+=(e[1]+l[1])*r;return[f/(i*=3),u/i]},n.polygonContains=function(n,e){for(var r,t,o=n.length,f=n[o-1],u=e[0],l=e[1],i=f[0],g=f[1],h=!1,a=0;a<o;++a)r=(f=n[a])[0],(t=f[1])>l!=g>l&&u<(i-r)*(l-t)/(g-t)+r&&(h=!h),i=r,g=t;return h},n.polygonHull=function(n){if((o=n.length)<3)return null;var t,o,f=new Array(o),u=new Array(o);for(t=0;t<o;++t)f[t]=[+n[t][0],+n[t][1],t];for(f.sort(e),t=0;t<o;++t)u[t]=[f[t][0],-f[t][1]];var l=r(f),i=r(u),g=i[0]===l[0],h=i[i.length-1]===l[l.length-1],a=[];for(t=l.length-1;t>=0;--t)a.push(n[f[l[t]][2]]);for(t=+g;t<i.length-h;++t)a.push(n[f[i[t]][2]]);return a},n.polygonLength=function(n){for(var e,r,t=-1,o=n.length,f=n[o-1],u=f[0],l=f[1],i=0;++t<o;)e=u,r=l,e-=u=(f=n[t])[0],r-=l=f[1],i+=Math.sqrt(e*e+r*r);return i},Object.defineProperty(n,"__esModule",{value:!0})});
{
"name": "d3-polygon",
"version": "1.0.5",
"version": "1.0.6",
"description": "Operations for two-dimensional polygons.",

@@ -27,2 +27,6 @@ "keywords": [

},
"files": [
"dist/**/*.js",
"src/**/*.js"
],
"scripts": {

@@ -34,8 +38,9 @@ "pretest": "rollup -c",

},
"sideEffects": false,
"devDependencies": {
"eslint": "5",
"rollup": "0.64",
"rollup-plugin-terser": "1",
"eslint": "6",
"rollup": "1",
"rollup-plugin-terser": "5",
"tape": "4"
}
}

@@ -7,3 +7,3 @@ # d3-polygon

If you use NPM, `npm install d3-polygon`. Otherwise, download the [latest release](https://github.com/d3/d3-polygon/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-polygon.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:
If you use NPM, `npm install d3-polygon`. Otherwise, download the [latest release](https://github.com/d3/d3-polygon/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-polygon.v1.min.js) or as part of [D3](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported:

@@ -19,4 +19,2 @@ ```html

[Try d3-polygon in your browser.](https://tonicdev.com/npm/d3-polygon)
## API Reference

@@ -40,3 +38,3 @@

Returns true if and only if the specified *point* is [inside the specified *polygon*](https://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html).
Returns true if and only if the specified *point* is inside the specified *polygon*.

@@ -43,0 +41,0 @@ <a href="#polygonLength" name="polygonLength">#</a> d3.<b>polygonLength</b>(<i>polygon</i>) [<>](https://github.com/d3/d3-polygon/blob/master/src/length.js#L1 "Source Code")

@@ -1,2 +0,2 @@

import cross from "./cross";
import cross from "./cross.js";

@@ -3,0 +3,0 @@ function lexicographicOrder(a, b) {

@@ -1,5 +0,5 @@

export {default as polygonArea} from "./area";
export {default as polygonCentroid} from "./centroid";
export {default as polygonHull} from "./hull";
export {default as polygonContains} from "./contains";
export {default as polygonLength} from "./length";
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";
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc