polygon-clipping
Advanced tools
Comparing version 0.15.1 to 0.15.2
@@ -5,2 +5,6 @@ # Changelog | ||
## v0.15.2 (2020-12-15) | ||
* Update dependencies [#109](https://github.com/mfogel/polygon-clipping/pull/109) | ||
## v0.15.1 (2020-07-08) | ||
@@ -7,0 +11,0 @@ |
'use strict'; | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var SplayTree = require('splaytree'); | ||
var SplayTree = _interopDefault(require('splaytree')); | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var SplayTree__default = /*#__PURE__*/_interopDefaultLegacy(SplayTree); | ||
function _classCallCheck(instance, Constructor) { | ||
@@ -137,3 +139,3 @@ if (!(instance instanceof Constructor)) { | ||
this.tree = new SplayTree(); // preseed with 0 so we don't end up with values < Number.EPSILON | ||
this.tree = new SplayTree__default['default'](); // preseed with 0 so we don't end up with values < Number.EPSILON | ||
@@ -1506,3 +1508,3 @@ this.round(0); | ||
this.queue = queue; | ||
this.tree = new SplayTree(comparator); | ||
this.tree = new SplayTree__default['default'](comparator); | ||
this.segments = []; | ||
@@ -1721,3 +1723,3 @@ } | ||
var queue = new SplayTree(SweepEvent.compare); | ||
var queue = new SplayTree__default['default'](SweepEvent.compare); | ||
@@ -1724,0 +1726,0 @@ for (var _i3 = 0, _iMax2 = multipolys.length; _i3 < _iMax2; _i3++) { |
@@ -1,2 +0,10 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).polygonClipping=e()}(this,function(){"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function n(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}var r=function e(n,r){t(this,e),this.next=null,this.key=n,this.data=r,this.left=null,this.right=null};function i(t,e){return t>e?1:t<e?-1:0}function o(t,e,n){for(var i=new r(null,null),o=i,s=i;;){var u=n(t,e.key);if(u<0){if(null===e.left)break;if(n(t,e.left.key)<0){var l=e.left;if(e.left=l.right,l.right=e,null===(e=l).left)break}s.left=e,s=e,e=e.left}else{if(!(u>0))break;if(null===e.right)break;if(n(t,e.right.key)>0){var h=e.right;if(e.right=h.left,h.left=e,null===(e=h).right)break}o.right=e,o=e,e=e.right}}return o.right=e.left,s.left=e.right,e.left=i.right,e.right=i.left,e}function s(t,e,n,i){var s=new r(t,e);if(null===n)return s.left=s.right=null,s;var u=i(t,(n=o(t,n,i)).key);return u<0?(s.left=n.left,s.right=n,n.left=null):u>=0&&(s.right=n.right,s.left=n,n.right=null),s}function u(t,e,n){var r=null,i=null;if(e){var s=n((e=o(t,e,n)).key,t);0===s?(r=e.left,i=e.right):s<0?(i=e.right,e.right=null,r=e):(r=e.left,e.left=null,i=e)}return{left:r,right:i}}var l=function(){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i;t(this,e),this._root=null,this._size=0,this._comparator=n}return n(e,[{key:"insert",value:function(t,e){return this._size++,this._root=s(t,e,this._root,this._comparator)}},{key:"add",value:function(t,e){var n=new r(t,e);null===this._root&&(n.left=n.right=null,this._size++,this._root=n);var i=this._comparator,s=o(t,this._root,i),u=i(t,s.key);return 0===u?this._root=s:(u<0?(n.left=s.left,n.right=s,s.left=null):u>0&&(n.right=s.right,n.left=s,s.right=null),this._size++,this._root=n),this._root}},{key:"remove",value:function(t){this._root=this._remove(t,this._root,this._comparator)}},{key:"_remove",value:function(t,e,n){var r;return null===e?null:0===n(t,(e=o(t,e,n)).key)?(null===e.left?r=e.right:(r=o(t,e.left,n)).right=e.right,this._size--,r):e}},{key:"pop",value:function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=o(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null}},{key:"findStatic",value:function(t){for(var e=this._root,n=this._comparator;e;){var r=n(t,e.key);if(0===r)return e;e=r<0?e.left:e.right}return null}},{key:"find",value:function(t){return this._root&&(this._root=o(t,this._root,this._comparator),0!==this._comparator(t,this._root.key))?null:this._root}},{key:"contains",value:function(t){for(var e=this._root,n=this._comparator;e;){var r=n(t,e.key);if(0===r)return!0;e=r<0?e.left:e.right}return!1}},{key:"forEach",value:function(t,e){for(var n=this._root,r=[],i=!1;!i;)null!==n?(r.push(n),n=n.left):0!==r.length?(n=r.pop(),t.call(e,n),n=n.right):i=!0;return this}},{key:"range",value:function(t,e,n,r){for(var i=[],o=this._comparator,s=this._root;0!==i.length||s;)if(s)i.push(s),s=s.left;else{if(o((s=i.pop()).key,e)>0)break;if(o(s.key,t)>=0&&n.call(r,s))return this;s=s.right}return this}},{key:"keys",value:function(){var t=[];return this.forEach(function(e){var n=e.key;return t.push(n)}),t}},{key:"values",value:function(){var t=[];return this.forEach(function(e){var n=e.data;return t.push(n)}),t}},{key:"min",value:function(){return this._root?this.minNode(this._root).key:null}},{key:"max",value:function(){return this._root?this.maxNode(this._root).key:null}},{key:"minNode",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._root;if(t)for(;t.left;)t=t.left;return t}},{key:"maxNode",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._root;if(t)for(;t.right;)t=t.right;return t}},{key:"at",value:function(t){for(var e=this._root,n=!1,r=0,i=[];!n;)if(e)i.push(e),e=e.left;else if(i.length>0){if(e=i.pop(),r===t)return e;r++,e=e.right}else n=!0;return null}},{key:"next",value:function(t){var e=this._root,n=null;if(t.right){for(n=t.right;n.left;)n=n.left;return n}for(var r=this._comparator;e;){var i=r(t.key,e.key);if(0===i)break;i<0?(n=e,e=e.left):e=e.right}return n}},{key:"prev",value:function(t){var e=this._root,n=null;if(null!==t.left){for(n=t.left;n.right;)n=n.right;return n}for(var r=this._comparator;e;){var i=r(t.key,e.key);if(0===i)break;i<0?e=e.left:(n=e,e=e.right)}return n}},{key:"clear",value:function(){return this._root=null,this._size=0,this}},{key:"toList",value:function(){return function(t){var e=t,n=[],i=!1,o=new r(null,null),s=o;for(;!i;)e?(n.push(e),e=e.left):n.length>0?e=(e=s=s.next=n.pop()).right:i=!0;return s.next=null,o.next}(this._root)}},{key:"load",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=t.length,o=this._comparator;if(n&&function t(e,n,r,i,o){if(r>=i)return;var s=e[r+i>>1];var u=r-1;var l=i+1;for(;;){do{u++}while(o(e[u],s)<0);do{l--}while(o(e[l],s)>0);if(u>=l)break;var h=e[u];e[u]=e[l],e[l]=h,h=n[u],n[u]=n[l],n[l]=h}t(e,n,r,l,o);t(e,n,l+1,i,o)}(t,e,0,i-1,o),null===this._root)this._root=function t(e,n,i,o){var s=o-i;if(s>0){var u=i+Math.floor(s/2),l=e[u],h=n[u],f=new r(l,h);return f.left=t(e,n,i,u),f.right=t(e,n,u+1,o),f}return null}(t,e,0,i),this._size=i;else{var s=function(t,e,n){var i=new r(null,null),o=i,s=t,u=e;for(;null!==s&&null!==u;)n(s.key,u.key)<0?(o.next=s,s=s.next):(o.next=u,u=u.next),o=o.next;null!==s?o.next=s:null!==u&&(o.next=u);return i.next}(this.toList(),function(t,e){for(var n=new r(null,null),i=n,o=0;o<t.length;o++)i=i.next=new r(t[o],e[o]);return i.next=null,n.next}(t,e),o);i=this._size+i,this._root=function t(e,n,r){var i=r-n;if(i>0){var o=n+Math.floor(i/2),s=t(e,n,o),u=e.head;return u.left=s,e.head=e.head.next,u.right=t(e,o+1,r),u}return null}({head:s},0,i)}return this}},{key:"isEmpty",value:function(){return null===this._root}},{key:"toString",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return String(t.key)},e=[];return function t(e,n,r,i,o){if(e){i("".concat(n).concat(r?"└── ":"├── ").concat(o(e),"\n"));var s=n+(r?" ":"│ ");e.left&&t(e.left,s,!1,i,o),e.right&&t(e.right,s,!0,i,o)}}(this._root,"",!0,function(t){return e.push(t)},t),e.join("")}},{key:"update",value:function(t,e,n){var r=this._comparator,i=u(t,this._root,r),l=i.left,h=i.right;r(t,e)<0?h=s(e,n,h,r):l=s(e,n,l,r),this._root=function(t,e,n){return null===e?t:null===t?e:((e=o(t.key,e,n)).left=t,e)}(l,h,r)}},{key:"split",value:function(t){return u(t,this._root,this._comparator)}},{key:"size",get:function(){return this._size}},{key:"root",get:function(){return this._root}}]),e}();var h=function(t,e){return t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y},f=function(t,e){if(e.ur.x<t.ll.x||t.ur.x<e.ll.x||e.ur.y<t.ll.y||t.ur.y<e.ll.y)return null;var n=t.ll.x<e.ll.x?e.ll.x:t.ll.x,r=t.ur.x<e.ur.x?t.ur.x:e.ur.x;return{ll:{x:n,y:t.ll.y<e.ll.y?e.ll.y:t.ll.y},ur:{x:r,y:t.ur.y<e.ur.y?t.ur.y:e.ur.y}}},a=Number.EPSILON;void 0===a&&(a=Math.pow(2,-52));var v=a*a,g=function(t,e){if(-a<t&&t<a&&-a<e&&e<a)return 0;var n=t-e;return n*n<v*t*e?0:t<e?-1:1},y=function(){function e(){t(this,e),this.reset()}return n(e,[{key:"reset",value:function(){this.xRounder=new c,this.yRounder=new c}},{key:"round",value:function(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}]),e}(),c=function(){function e(){t(this,e),this.tree=new l,this.round(0)}return n(e,[{key:"round",value:function(t){var e=this.tree.add(t),n=this.tree.prev(e);if(null!==n&&0===g(e.key,n.key))return this.tree.remove(t),n.key;var r=this.tree.next(e);return null!==r&&0===g(e.key,r.key)?(this.tree.remove(t),r.key):t}}]),e}(),p=new y,x=function(t,e){return t.x*e.y-t.y*e.x},b=function(t,e){return t.x*e.x+t.y*e.y},m=function(t,e,n){var r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y},o=x(r,i);return g(o,0)},d=function(t){return Math.sqrt(b(t,t))},E=function(t,e,n){var r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y};return b(i,r)/d(i)/d(r)},k=function(t,e,n){return 0===e.y?null:{x:t.x+e.x/e.y*(n-t.y),y:n}},S=function(t,e,n){return 0===e.x?null:{x:n,y:t.y+e.y/e.x*(n-t.x)}},_=function(){function e(n,r){t(this,e),void 0===n.events?n.events=[this]:n.events.push(this),this.point=n,this.isLeft=r}return n(e,null,[{key:"compare",value:function(t,n){var r=e.comparePoints(t.point,n.point);return 0!==r?r:(t.point!==n.point&&t.link(n),t.isLeft!==n.isLeft?t.isLeft?1:-1:R.compare(t.segment,n.segment))}},{key:"comparePoints",value:function(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y<e.y?-1:t.y>e.y?1:0}}]),n(e,[{key:"link",value:function(t){if(t.point===this.point)throw new Error("Tried to link already linked events");for(var e=t.point.events,n=0,r=e.length;n<r;n++){var i=e[n];this.point.events.push(i),i.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var t=this.point.events.length,e=0;e<t;e++){var n=this.point.events[e];if(void 0===n.segment.consumedBy)for(var r=e+1;r<t;r++){var i=this.point.events[r];void 0===i.consumedBy&&(n.otherSE.point.events===i.otherSE.point.events&&n.segment.consume(i.segment))}}}},{key:"getAvailableLinkedEvents",value:function(){for(var t=[],e=0,n=this.point.events.length;e<n;e++){var r=this.point.events[e];r!==this&&!r.segment.ringOut&&r.segment.isInResult()&&t.push(r)}return t}},{key:"getLeftmostComparator",value:function(t){var e=this,n=new Map,r=function(r){var i,o,s,u,l,h=r.otherSE;n.set(r,{sine:(i=e.point,o=t.point,s=h.point,u={x:o.x-i.x,y:o.y-i.y},l={x:s.x-i.x,y:s.y-i.y},x(l,u)/d(l)/d(u)),cosine:E(e.point,t.point,h.point)})};return function(t,e){n.has(t)||r(t),n.has(e)||r(e);var i=n.get(t),o=i.sine,s=i.cosine,u=n.get(e),l=u.sine,h=u.cosine;return o>=0&&l>=0?s<h?1:s>h?-1:0:o<0&&l<0?s<h?-1:s>h?1:0:l<o?-1:l>o?1:0}}}]),e}(),w=0,R=function(){function e(n,r,i,o){t(this,e),this.id=++w,this.leftSE=n,n.segment=this,n.otherSE=r,this.rightSE=r,r.segment=this,r.otherSE=n,this.rings=i,this.windings=o}return n(e,null,[{key:"compare",value:function(t,e){var n=t.leftSE.point.x,r=e.leftSE.point.x,i=t.rightSE.point.x,o=e.rightSE.point.x;if(o<n)return 1;if(i<r)return-1;var s=t.leftSE.point.y,u=e.leftSE.point.y,l=t.rightSE.point.y,h=e.rightSE.point.y;if(n<r){if(u<s&&u<l)return 1;if(u>s&&u>l)return-1;var f=t.comparePoint(e.leftSE.point);if(f<0)return 1;if(f>0)return-1;var a=e.comparePoint(t.rightSE.point);return 0!==a?a:-1}if(n>r){if(s<u&&s<h)return-1;if(s>u&&s>h)return 1;var v=e.comparePoint(t.leftSE.point);if(0!==v)return v;var g=t.comparePoint(e.rightSE.point);return g<0?1:g>0?-1:1}if(s<u)return-1;if(s>u)return 1;if(i<o){var y=e.comparePoint(t.rightSE.point);if(0!==y)return y}if(i>o){var c=t.comparePoint(e.rightSE.point);if(c<0)return 1;if(c>0)return-1}if(i!==o){var p=l-s,x=i-n,b=h-u,m=o-r;if(p>x&&b<m)return 1;if(p<x&&b>m)return-1}return i>o?1:i<o?-1:l<h?-1:l>h?1:t.id<e.id?-1:t.id>e.id?1:0}}]),n(e,[{key:"replaceRightSE",value:function(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var t=this.leftSE.point.y,e=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t<e?t:e},ur:{x:this.rightSE.point.x,y:t>e?t:e}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}},{key:"comparePoint",value:function(t){if(this.isAnEndpoint(t))return 0;var e=this.leftSE.point,n=this.rightSE.point,r=this.vector();if(e.x===n.x)return t.x===e.x?0:t.x<e.x?1:-1;var i=(t.y-e.y)/r.y,o=e.x+i*r.x;if(t.x===o)return 0;var s=(t.x-e.x)/r.x,u=e.y+s*r.y;return t.y===u?0:t.y<u?-1:1}},{key:"getIntersection",value:function(t){var e=this.bbox(),n=t.bbox(),r=f(e,n);if(null===r)return null;var i=this.leftSE.point,o=this.rightSE.point,s=t.leftSE.point,u=t.rightSE.point,l=h(e,s)&&0===this.comparePoint(s),a=h(n,i)&&0===t.comparePoint(i),v=h(e,u)&&0===this.comparePoint(u),g=h(n,o)&&0===t.comparePoint(o);if(a&&l)return g&&!v?o:!g&&v?u:null;if(a)return v&&i.x===u.x&&i.y===u.y?null:i;if(l)return g&&o.x===s.x&&o.y===s.y?null:s;if(g&&v)return null;if(g)return o;if(v)return u;var y=function(t,e,n,r){if(0===e.x)return S(n,r,t.x);if(0===r.x)return S(t,e,n.x);if(0===e.y)return k(n,r,t.y);if(0===r.y)return k(t,e,n.y);var i=x(e,r);if(0==i)return null;var o={x:n.x-t.x,y:n.y-t.y},s=x(o,e)/i,u=x(o,r)/i;return{x:(t.x+u*e.x+(n.x+s*r.x))/2,y:(t.y+u*e.y+(n.y+s*r.y))/2}}(i,this.vector(),s,t.vector());return null===y?null:h(r,y)?p.round(y.x,y.y):null}},{key:"split",value:function(t){var n=[],r=void 0!==t.events,i=new _(t,!0),o=new _(t,!1),s=this.rightSE;this.replaceRightSE(o),n.push(o),n.push(i);var u=new e(i,s,this.rings.slice(),this.windings.slice());return _.comparePoints(u.leftSE.point,u.rightSE.point)>0&&u.swapEvents(),_.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(i.checkForConsuming(),o.checkForConsuming()),n}},{key:"swapEvents",value:function(){var t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var e=0,n=this.windings.length;e<n;e++)this.windings[e]*=-1}},{key:"consume",value:function(t){for(var n=this,r=t;n.consumedBy;)n=n.consumedBy;for(;r.consumedBy;)r=r.consumedBy;var i=e.compare(n,r);if(0!==i){if(i>0){var o=n;n=r,r=o}if(n.prev===r){var s=n;n=r,r=s}for(var u=0,l=r.rings.length;u<l;u++){var h=r.rings[u],f=r.windings[u],a=n.rings.indexOf(h);-1===a?(n.rings.push(h),n.windings.push(f)):n.windings[a]+=f}r.rings=null,r.windings=null,r.consumedBy=n,r.leftSE.consumedBy=n.leftSE,r.rightSE.consumedBy=n.rightSE}}},{key:"prevInResult",value:function(){return void 0!==this._prevInResult?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}},{key:"beforeState",value:function(){if(void 0!==this._beforeState)return this._beforeState;if(this.prev){var t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}else this._beforeState={rings:[],windings:[],multiPolys:[]};return this._beforeState}},{key:"afterState",value:function(){if(void 0!==this._afterState)return this._afterState;var t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};for(var e=this._afterState.rings,n=this._afterState.windings,r=this._afterState.multiPolys,i=0,o=this.rings.length;i<o;i++){var s=this.rings[i],u=this.windings[i],l=e.indexOf(s);-1===l?(e.push(s),n.push(u)):n[l]+=u}for(var h=[],f=[],a=0,v=e.length;a<v;a++)if(0!==n[a]){var g=e[a],y=g.poly;if(-1===f.indexOf(y))if(g.isExterior)h.push(y);else{-1===f.indexOf(y)&&f.push(y);var c=h.indexOf(g.poly);-1!==c&&h.splice(c,1)}}for(var p=0,x=h.length;p<x;p++){var b=h[p].multiPoly;-1===r.indexOf(b)&&r.push(b)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(void 0!==this._isInResult)return this._isInResult;var t=this.beforeState().multiPolys,e=this.afterState().multiPolys;switch(G.type){case"union":var n=0===t.length,r=0===e.length;this._isInResult=n!==r;break;case"intersection":var i,o;t.length<e.length?(i=t.length,o=e.length):(i=e.length,o=t.length),this._isInResult=o===G.numMultiPolys&&i<o;break;case"xor":var s=Math.abs(t.length-e.length);this._isInResult=s%2==1;break;case"difference":var u=function(t){return 1===t.length&&t[0].isSubject};this._isInResult=u(t)!==u(e);break;default:throw new Error("Unrecognized operation type found ".concat(G.type))}return this._isInResult}}],[{key:"fromRing",value:function(t,n,r){var i,o,s,u=_.comparePoints(t,n);if(u<0)i=t,o=n,s=1;else{if(!(u>0))throw new Error("Tried to create degenerate segment at [".concat(t.x,", ").concat(t.y,"]"));i=n,o=t,s=-1}return new e(new _(i,!0),new _(o,!1),[r],[s])}}]),e}(),I=function(){function e(n,r,i){if(t(this,e),!Array.isArray(n)||0===n.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=r,this.isExterior=i,this.segments=[],"number"!=typeof n[0][0]||"number"!=typeof n[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var o=p.round(n[0][0],n[0][1]);this.bbox={ll:{x:o.x,y:o.y},ur:{x:o.x,y:o.y}};for(var s=o,u=1,l=n.length;u<l;u++){if("number"!=typeof n[u][0]||"number"!=typeof n[u][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var h=p.round(n[u][0],n[u][1]);h.x===s.x&&h.y===s.y||(this.segments.push(R.fromRing(s,h,this)),h.x<this.bbox.ll.x&&(this.bbox.ll.x=h.x),h.y<this.bbox.ll.y&&(this.bbox.ll.y=h.y),h.x>this.bbox.ur.x&&(this.bbox.ur.x=h.x),h.y>this.bbox.ur.y&&(this.bbox.ur.y=h.y),s=h)}o.x===s.x&&o.y===s.y||this.segments.push(R.fromRing(s,o,this))}return n(e,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,n=this.segments.length;e<n;e++){var r=this.segments[e];t.push(r.leftSE),t.push(r.rightSE)}return t}}]),e}(),P=function(){function e(n,r){if(t(this,e),!Array.isArray(n))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new I(n[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(var i=1,o=n.length;i<o;i++){var s=new I(n[i],this,!1);s.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=s.bbox.ll.x),s.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=s.bbox.ll.y),s.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=s.bbox.ur.x),s.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=s.bbox.ur.y),this.interiorRings.push(s)}this.multiPoly=r}return n(e,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),e=0,n=this.interiorRings.length;e<n;e++)for(var r=this.interiorRings[e].getSweepEvents(),i=0,o=r.length;i<o;i++)t.push(r[i]);return t}}]),e}(),N=function(){function e(n,r){if(t(this,e),!Array.isArray(n))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{"number"==typeof n[0][0][0]&&(n=[n])}catch(t){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var i=0,o=n.length;i<o;i++){var s=new P(n[i],this);s.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=s.bbox.ll.x),s.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=s.bbox.ll.y),s.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=s.bbox.ur.x),s.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=s.bbox.ur.y),this.polys.push(s)}this.isSubject=r}return n(e,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,n=this.polys.length;e<n;e++)for(var r=this.polys[e].getSweepEvents(),i=0,o=r.length;i<o;i++)t.push(r[i]);return t}}]),e}(),A=function(){function e(n){t(this,e),this.events=n;for(var r=0,i=n.length;r<i;r++)n[r].segment.ringOut=this;this.poly=null}return n(e,null,[{key:"factory",value:function(t){for(var n=[],r=0,i=t.length;r<i;r++){var o=t[r];if(o.isInResult()&&!o.ringOut){for(var s=null,u=o.leftSE,l=o.rightSE,h=[u],f=u.point,a=[];s=u,u=l,h.push(u),u.point!==f;)for(;;){var v=u.getAvailableLinkedEvents();if(0===v.length){var g=h[0].point,y=h[h.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(g.x,",")+" ".concat(g.y,"]. Last matching segment found ends at")+" [".concat(y.x,", ").concat(y.y,"]."))}if(1===v.length){l=v[0].otherSE;break}for(var c=null,p=0,x=a.length;p<x;p++)if(a[p].point===u.point){c=p;break}if(null===c){a.push({index:h.length,point:u.point});var b=u.getLeftmostComparator(s);l=v.sort(b)[0].otherSE;break}var m=a.splice(c)[0],d=h.splice(m.index);d.unshift(d[0].otherSE),n.push(new e(d.reverse()))}n.push(new e(h))}}return n}}]),n(e,[{key:"getGeom",value:function(){for(var t=this.events[0].point,e=[t],n=1,r=this.events.length-1;n<r;n++){var i=this.events[n].point,o=this.events[n+1].point;0!==m(i,t,o)&&(e.push(i),t=i)}if(1===e.length)return null;var s=e[0],u=e[1];0===m(s,t,u)&&e.shift(),e.push(e[0]);for(var l=this.isExteriorRing()?1:-1,h=this.isExteriorRing()?0:e.length-1,f=this.isExteriorRing()?e.length:-1,a=[],v=h;v!=f;v+=l)a.push([e[v].x,e[v].y]);return a}},{key:"isExteriorRing",value:function(){if(void 0===this._isExteriorRing){var t=this.enclosingRing();this._isExteriorRing=!t||!t.isExteriorRing()}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return void 0===this._enclosingRing&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var t=this.events[0],e=1,n=this.events.length;e<n;e++){var r=this.events[e];_.compare(t,r)>0&&(t=r)}for(var i=t.segment.prevInResult(),o=i?i.prevInResult():null;;){if(!i)return null;if(!o)return i.ringOut;if(o.ringOut!==i.ringOut)return o.ringOut.enclosingRing()!==i.ringOut?i.ringOut:i.ringOut.enclosingRing();i=o.prevInResult(),o=i?i.prevInResult():null}}}]),e}(),L=function(){function e(n){t(this,e),this.exteriorRing=n,n.poly=this,this.interiorRings=[]}return n(e,[{key:"addInterior",value:function(t){this.interiorRings.push(t),t.poly=this}},{key:"getGeom",value:function(){var t=[this.exteriorRing.getGeom()];if(null===t[0])return null;for(var e=0,n=this.interiorRings.length;e<n;e++){var r=this.interiorRings[e].getGeom();null!==r&&t.push(r)}return t}}]),e}(),O=function(){function e(n){t(this,e),this.rings=n,this.polys=this._composePolys(n)}return n(e,[{key:"getGeom",value:function(){for(var t=[],e=0,n=this.polys.length;e<n;e++){var r=this.polys[e].getGeom();null!==r&&t.push(r)}return t}},{key:"_composePolys",value:function(t){for(var e=[],n=0,r=t.length;n<r;n++){var i=t[n];if(!i.poly)if(i.isExteriorRing())e.push(new L(i));else{var o=i.enclosingRing();o.poly||e.push(new L(o)),o.poly.addInterior(i)}}return e}}]),e}(),z=function(){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:R.compare;t(this,e),this.queue=n,this.tree=new l(r),this.segments=[]}return n(e,[{key:"process",value:function(t){var e=t.segment,n=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),n;var r=t.isLeft?this.tree.insert(e):this.tree.find(e);if(!r)throw new Error("Unable to find segment #".concat(e.id," ")+"[".concat(e.leftSE.point.x,", ").concat(e.leftSE.point.y,"] -> ")+"[".concat(e.rightSE.point.x,", ").concat(e.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var i=r,o=r,s=void 0,u=void 0;void 0===s;)null===(i=this.tree.prev(i))?s=null:void 0===i.key.consumedBy&&(s=i.key);for(;void 0===u;)null===(o=this.tree.next(o))?u=null:void 0===o.key.consumedBy&&(u=o.key);if(t.isLeft){var l=null;if(s){var h=s.getIntersection(e);if(null!==h&&(e.isAnEndpoint(h)||(l=h),!s.isAnEndpoint(h)))for(var f=this._splitSafely(s,h),a=0,v=f.length;a<v;a++)n.push(f[a])}var g=null;if(u){var y=u.getIntersection(e);if(null!==y&&(e.isAnEndpoint(y)||(g=y),!u.isAnEndpoint(y)))for(var c=this._splitSafely(u,y),p=0,x=c.length;p<x;p++)n.push(c[p])}if(null!==l||null!==g){var b=null;if(null===l)b=g;else if(null===g)b=l;else{b=_.comparePoints(l,g)<=0?l:g}this.queue.remove(e.rightSE),n.push(e.rightSE);for(var m=e.split(b),d=0,E=m.length;d<E;d++)n.push(m[d])}n.length>0?(this.tree.remove(e),n.push(t)):(this.segments.push(e),e.prev=s)}else{if(s&&u){var k=s.getIntersection(u);if(null!==k){if(!s.isAnEndpoint(k))for(var S=this._splitSafely(s,k),w=0,R=S.length;w<R;w++)n.push(S[w]);if(!u.isAnEndpoint(k))for(var I=this._splitSafely(u,k),P=0,N=I.length;P<N;P++)n.push(I[P])}}this.tree.remove(e)}return n}},{key:"_splitSafely",value:function(t,e){this.tree.remove(t);var n=t.rightSE;this.queue.remove(n);var r=t.split(e);return r.push(n),void 0===t.consumedBy&&this.tree.insert(t),r}}]),e}(),B="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,M="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,G=new(function(){function e(){t(this,e)}return n(e,[{key:"run",value:function(t,e,n){G.type=t,p.reset();for(var r=[new N(e,!0)],i=0,o=n.length;i<o;i++)r.push(new N(n[i],!1));if(G.numMultiPolys=r.length,"difference"===G.type)for(var s=r[0],u=1;u<r.length;)null!==f(r[u].bbox,s.bbox)?u++:r.splice(u,1);if("intersection"===G.type)for(var h=0,a=r.length;h<a;h++)for(var v=r[h],g=h+1,y=r.length;g<y;g++)if(null===f(v.bbox,r[g].bbox))return[];for(var c=new l(_.compare),x=0,b=r.length;x<b;x++)for(var m=r[x].getSweepEvents(),d=0,E=m.length;d<E;d++)if(c.insert(m[d]),c.size>B)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var k=new z(c),S=c.size,w=c.pop();w;){var R=w.key;if(c.size===S){var I=R.segment;throw new Error("Unable to pop() ".concat(R.isLeft?"left":"right"," SweepEvent ")+"[".concat(R.point.x,", ").concat(R.point.y,"] from segment #").concat(I.id," ")+"[".concat(I.leftSE.point.x,", ").concat(I.leftSE.point.y,"] -> ")+"[".concat(I.rightSE.point.x,", ").concat(I.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(c.size>B)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(k.segments.length>M)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var P=k.process(R),L=0,T=P.length;L<T;L++){var C=P[L];void 0===C.consumedBy&&c.insert(C)}S=c.size,w=c.pop()}p.reset();var q=A.factory(k.segments);return new O(q).getGeom()}}]),e}());return{union:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return G.run("union",t,n)},intersection:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return G.run("intersection",t,n)},xor:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return G.run("xor",t,n)},difference:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return G.run("difference",t,n)}}}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).polygonClipping=e()}(this,(function(){"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function r(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t} | ||
/** | ||
* splaytree v3.1.0 | ||
* Fast Splay tree for Node and browser | ||
* | ||
* @author Alexander Milevski <info@w8r.name> | ||
* @license MIT | ||
* @preserve | ||
*/var n=function(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null};function i(t,e){return t>e?1:t<e?-1:0}function o(t,e,r){for(var i=new n(null,null),o=i,s=i;;){var u=r(t,e.key);if(u<0){if(null===e.left)break;if(r(t,e.left.key)<0){var l=e.left;if(e.left=l.right,l.right=e,null===(e=l).left)break}s.left=e,s=e,e=e.left}else{if(!(u>0))break;if(null===e.right)break;if(r(t,e.right.key)>0){l=e.right;if(e.right=l.left,l.left=e,null===(e=l).right)break}o.right=e,o=e,e=e.right}}return o.right=e.left,s.left=e.right,e.left=i.right,e.right=i.left,e}function s(t,e,r,i){var s=new n(t,e);if(null===r)return s.left=s.right=null,s;var u=i(t,(r=o(t,r,i)).key);return u<0?(s.left=r.left,s.right=r,r.left=null):u>=0&&(s.right=r.right,s.left=r,r.right=null),s}function u(t,e,r){var n=null,i=null;if(e){var s=r((e=o(t,e,r)).key,t);0===s?(n=e.left,i=e.right):s<0?(i=e.right,e.right=null,n=e):(n=e.left,e.left=null,i=e)}return{left:n,right:i}}function l(t,e,r,n,i){if(t){n(e+(r?"└── ":"├── ")+i(t)+"\n");var o=e+(r?" ":"│ ");t.left&&l(t.left,o,!1,n,i),t.right&&l(t.right,o,!0,n,i)}}var h=function(){function t(t){void 0===t&&(t=i),this._root=null,this._size=0,this._comparator=t}return t.prototype.insert=function(t,e){return this._size++,this._root=s(t,e,this._root,this._comparator)},t.prototype.add=function(t,e){var r=new n(t,e);null===this._root&&(r.left=r.right=null,this._size++,this._root=r);var i=this._comparator,s=o(t,this._root,i),u=i(t,s.key);return 0===u?this._root=s:(u<0?(r.left=s.left,r.right=s,s.left=null):u>0&&(r.right=s.right,r.left=s,s.right=null),this._size++,this._root=r),this._root},t.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},t.prototype._remove=function(t,e,r){var n;return null===e?null:0===r(t,(e=o(t,e,r)).key)?(null===e.left?n=e.right:(n=o(t,e.left,r)).right=e.right,this._size--,n):e},t.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=o(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},t.prototype.findStatic=function(t){for(var e=this._root,r=this._comparator;e;){var n=r(t,e.key);if(0===n)return e;e=n<0?e.left:e.right}return null},t.prototype.find=function(t){return this._root&&(this._root=o(t,this._root,this._comparator),0!==this._comparator(t,this._root.key))?null:this._root},t.prototype.contains=function(t){for(var e=this._root,r=this._comparator;e;){var n=r(t,e.key);if(0===n)return!0;e=n<0?e.left:e.right}return!1},t.prototype.forEach=function(t,e){for(var r=this._root,n=[],i=!1;!i;)null!==r?(n.push(r),r=r.left):0!==n.length?(r=n.pop(),t.call(e,r),r=r.right):i=!0;return this},t.prototype.range=function(t,e,r,n){for(var i=[],o=this._comparator,s=this._root;0!==i.length||s;)if(s)i.push(s),s=s.left;else{if(o((s=i.pop()).key,e)>0)break;if(o(s.key,t)>=0&&r.call(n,s))return this;s=s.right}return this},t.prototype.keys=function(){var t=[];return this.forEach((function(e){var r=e.key;return t.push(r)})),t},t.prototype.values=function(){var t=[];return this.forEach((function(e){var r=e.data;return t.push(r)})),t},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.left;)t=t.left;return t},t.prototype.maxNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.right;)t=t.right;return t},t.prototype.at=function(t){for(var e=this._root,r=!1,n=0,i=[];!r;)if(e)i.push(e),e=e.left;else if(i.length>0){if(e=i.pop(),n===t)return e;n++,e=e.right}else r=!0;return null},t.prototype.next=function(t){var e=this._root,r=null;if(t.right){for(r=t.right;r.left;)r=r.left;return r}for(var n=this._comparator;e;){var i=n(t.key,e.key);if(0===i)break;i<0?(r=e,e=e.left):e=e.right}return r},t.prototype.prev=function(t){var e=this._root,r=null;if(null!==t.left){for(r=t.left;r.right;)r=r.right;return r}for(var n=this._comparator;e;){var i=n(t.key,e.key);if(0===i)break;i<0?e=e.left:(r=e,e=e.right)}return r},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return function(t){var e=t,r=[],i=!1,o=new n(null,null),s=o;for(;!i;)e?(r.push(e),e=e.left):r.length>0?e=(e=s=s.next=r.pop()).right:i=!0;return s.next=null,o.next}(this._root)},t.prototype.load=function(t,e,r){void 0===e&&(e=[]),void 0===r&&(r=!1);var i=t.length,o=this._comparator;if(r&&p(t,e,0,i-1,o),null===this._root)this._root=f(t,e,0,i),this._size=i;else{var s=function(t,e,r){var i=new n(null,null),o=i,s=t,u=e;for(;null!==s&&null!==u;)r(s.key,u.key)<0?(o.next=s,s=s.next):(o.next=u,u=u.next),o=o.next;null!==s?o.next=s:null!==u&&(o.next=u);return i.next}(this.toList(),function(t,e){for(var r=new n(null,null),i=r,o=0;o<t.length;o++)i=i.next=new n(t[o],e[o]);return i.next=null,r.next}(t,e),o);i=this._size+i,this._root=a({head:s},0,i)}return this},t.prototype.isEmpty=function(){return null===this._root},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),t.prototype.toString=function(t){void 0===t&&(t=function(t){return String(t.key)});var e=[];return l(this._root,"",!0,(function(t){return e.push(t)}),t),e.join("")},t.prototype.update=function(t,e,r){var n=this._comparator,i=u(t,this._root,n),l=i.left,h=i.right;n(t,e)<0?h=s(e,r,h,n):l=s(e,r,l,n),this._root=function(t,e,r){return null===e?t:(null===t||((e=o(t.key,e,r)).left=t),e)}(l,h,n)},t.prototype.split=function(t){return u(t,this._root,this._comparator)},t}();function f(t,e,r,i){var o=i-r;if(o>0){var s=r+Math.floor(o/2),u=t[s],l=e[s],h=new n(u,l);return h.left=f(t,e,r,s),h.right=f(t,e,s+1,i),h}return null}function a(t,e,r){var n=r-e;if(n>0){var i=e+Math.floor(n/2),o=a(t,e,i),s=t.head;return s.left=o,t.head=t.head.next,s.right=a(t,i+1,r),s}return null}function p(t,e,r,n,i){if(!(r>=n)){for(var o=t[r+n>>1],s=r-1,u=n+1;;){do{s++}while(i(t[s],o)<0);do{u--}while(i(t[u],o)>0);if(s>=u)break;var l=t[s];t[s]=t[u],t[u]=l,l=e[s],e[s]=e[u],e[u]=l}p(t,e,r,u,i),p(t,e,u+1,n,i)}}var y=function(t,e){return t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y},g=function(t,e){if(e.ur.x<t.ll.x||t.ur.x<e.ll.x||e.ur.y<t.ll.y||t.ur.y<e.ll.y)return null;var r=t.ll.x<e.ll.x?e.ll.x:t.ll.x,n=t.ur.x<e.ur.x?t.ur.x:e.ur.x;return{ll:{x:r,y:t.ll.y<e.ll.y?e.ll.y:t.ll.y},ur:{x:n,y:t.ur.y<e.ur.y?t.ur.y:e.ur.y}}},v=Number.EPSILON;void 0===v&&(v=Math.pow(2,-52));var c=v*v,x=function(t,e){if(-v<t&&t<v&&-v<e&&e<v)return 0;var r=t-e;return r*r<c*t*e?0:t<e?-1:1},b=function(){function e(){t(this,e),this.reset()}return r(e,[{key:"reset",value:function(){this.xRounder=new m,this.yRounder=new m}},{key:"round",value:function(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}]),e}(),m=function(){function e(){t(this,e),this.tree=new h,this.round(0)}return r(e,[{key:"round",value:function(t){var e=this.tree.add(t),r=this.tree.prev(e);if(null!==r&&0===x(e.key,r.key))return this.tree.remove(t),r.key;var n=this.tree.next(e);return null!==n&&0===x(e.key,n.key)?(this.tree.remove(t),n.key):t}}]),e}(),d=new b,E=function(t,e){return t.x*e.y-t.y*e.x},S=function(t,e){return t.x*e.x+t.y*e.y},_=function(t,e,r){var n={x:e.x-t.x,y:e.y-t.y},i={x:r.x-t.x,y:r.y-t.y},o=E(n,i);return x(o,0)},k=function(t){return Math.sqrt(S(t,t))},w=function(t,e,r){var n={x:e.x-t.x,y:e.y-t.y},i={x:r.x-t.x,y:r.y-t.y};return S(i,n)/k(i)/k(n)},R=function(t,e,r){return 0===e.y?null:{x:t.x+e.x/e.y*(r-t.y),y:r}},I=function(t,e,r){return 0===e.x?null:{x:r,y:t.y+e.y/e.x*(r-t.x)}},P=function(){function e(r,n){t(this,e),void 0===r.events?r.events=[this]:r.events.push(this),this.point=r,this.isLeft=n}return r(e,null,[{key:"compare",value:function(t,r){var n=e.comparePoints(t.point,r.point);return 0!==n?n:(t.point!==r.point&&t.link(r),t.isLeft!==r.isLeft?t.isLeft?1:-1:O.compare(t.segment,r.segment))}},{key:"comparePoints",value:function(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y<e.y?-1:t.y>e.y?1:0}}]),r(e,[{key:"link",value:function(t){if(t.point===this.point)throw new Error("Tried to link already linked events");for(var e=t.point.events,r=0,n=e.length;r<n;r++){var i=e[r];this.point.events.push(i),i.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var t=this.point.events.length,e=0;e<t;e++){var r=this.point.events[e];if(void 0===r.segment.consumedBy)for(var n=e+1;n<t;n++){var i=this.point.events[n];void 0===i.consumedBy&&(r.otherSE.point.events===i.otherSE.point.events&&r.segment.consume(i.segment))}}}},{key:"getAvailableLinkedEvents",value:function(){for(var t=[],e=0,r=this.point.events.length;e<r;e++){var n=this.point.events[e];n!==this&&!n.segment.ringOut&&n.segment.isInResult()&&t.push(n)}return t}},{key:"getLeftmostComparator",value:function(t){var e=this,r=new Map,n=function(n){var i,o,s,u,l,h=n.otherSE;r.set(n,{sine:(i=e.point,o=t.point,s=h.point,u={x:o.x-i.x,y:o.y-i.y},l={x:s.x-i.x,y:s.y-i.y},E(l,u)/k(l)/k(u)),cosine:w(e.point,t.point,h.point)})};return function(t,e){r.has(t)||n(t),r.has(e)||n(e);var i=r.get(t),o=i.sine,s=i.cosine,u=r.get(e),l=u.sine,h=u.cosine;return o>=0&&l>=0?s<h?1:s>h?-1:0:o<0&&l<0?s<h?-1:s>h?1:0:l<o?-1:l>o?1:0}}}]),e}(),N=0,O=function(){function e(r,n,i,o){t(this,e),this.id=++N,this.leftSE=r,r.segment=this,r.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=r,this.rings=i,this.windings=o}return r(e,null,[{key:"compare",value:function(t,e){var r=t.leftSE.point.x,n=e.leftSE.point.x,i=t.rightSE.point.x,o=e.rightSE.point.x;if(o<r)return 1;if(i<n)return-1;var s=t.leftSE.point.y,u=e.leftSE.point.y,l=t.rightSE.point.y,h=e.rightSE.point.y;if(r<n){if(u<s&&u<l)return 1;if(u>s&&u>l)return-1;var f=t.comparePoint(e.leftSE.point);if(f<0)return 1;if(f>0)return-1;var a=e.comparePoint(t.rightSE.point);return 0!==a?a:-1}if(r>n){if(s<u&&s<h)return-1;if(s>u&&s>h)return 1;var p=e.comparePoint(t.leftSE.point);if(0!==p)return p;var y=t.comparePoint(e.rightSE.point);return y<0?1:y>0?-1:1}if(s<u)return-1;if(s>u)return 1;if(i<o){var g=e.comparePoint(t.rightSE.point);if(0!==g)return g}if(i>o){var v=t.comparePoint(e.rightSE.point);if(v<0)return 1;if(v>0)return-1}if(i!==o){var c=l-s,x=i-r,b=h-u,m=o-n;if(c>x&&b<m)return 1;if(c<x&&b>m)return-1}return i>o?1:i<o||l<h?-1:l>h?1:t.id<e.id?-1:t.id>e.id?1:0}}]),r(e,[{key:"replaceRightSE",value:function(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var t=this.leftSE.point.y,e=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t<e?t:e},ur:{x:this.rightSE.point.x,y:t>e?t:e}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}},{key:"comparePoint",value:function(t){if(this.isAnEndpoint(t))return 0;var e=this.leftSE.point,r=this.rightSE.point,n=this.vector();if(e.x===r.x)return t.x===e.x?0:t.x<e.x?1:-1;var i=(t.y-e.y)/n.y,o=e.x+i*n.x;if(t.x===o)return 0;var s=(t.x-e.x)/n.x,u=e.y+s*n.y;return t.y===u?0:t.y<u?-1:1}},{key:"getIntersection",value:function(t){var e=this.bbox(),r=t.bbox(),n=g(e,r);if(null===n)return null;var i=this.leftSE.point,o=this.rightSE.point,s=t.leftSE.point,u=t.rightSE.point,l=y(e,s)&&0===this.comparePoint(s),h=y(r,i)&&0===t.comparePoint(i),f=y(e,u)&&0===this.comparePoint(u),a=y(r,o)&&0===t.comparePoint(o);if(h&&l)return a&&!f?o:!a&&f?u:null;if(h)return f&&i.x===u.x&&i.y===u.y?null:i;if(l)return a&&o.x===s.x&&o.y===s.y?null:s;if(a&&f)return null;if(a)return o;if(f)return u;var p=function(t,e,r,n){if(0===e.x)return I(r,n,t.x);if(0===n.x)return I(t,e,r.x);if(0===e.y)return R(r,n,t.y);if(0===n.y)return R(t,e,r.y);var i=E(e,n);if(0==i)return null;var o={x:r.x-t.x,y:r.y-t.y},s=E(o,e)/i,u=E(o,n)/i;return{x:(t.x+u*e.x+(r.x+s*n.x))/2,y:(t.y+u*e.y+(r.y+s*n.y))/2}}(i,this.vector(),s,t.vector());return null===p?null:y(n,p)?d.round(p.x,p.y):null}},{key:"split",value:function(t){var r=[],n=void 0!==t.events,i=new P(t,!0),o=new P(t,!1),s=this.rightSE;this.replaceRightSE(o),r.push(o),r.push(i);var u=new e(i,s,this.rings.slice(),this.windings.slice());return P.comparePoints(u.leftSE.point,u.rightSE.point)>0&&u.swapEvents(),P.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(i.checkForConsuming(),o.checkForConsuming()),r}},{key:"swapEvents",value:function(){var t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var e=0,r=this.windings.length;e<r;e++)this.windings[e]*=-1}},{key:"consume",value:function(t){for(var r=this,n=t;r.consumedBy;)r=r.consumedBy;for(;n.consumedBy;)n=n.consumedBy;var i=e.compare(r,n);if(0!==i){if(i>0){var o=r;r=n,n=o}if(r.prev===n){var s=r;r=n,n=s}for(var u=0,l=n.rings.length;u<l;u++){var h=n.rings[u],f=n.windings[u],a=r.rings.indexOf(h);-1===a?(r.rings.push(h),r.windings.push(f)):r.windings[a]+=f}n.rings=null,n.windings=null,n.consumedBy=r,n.leftSE.consumedBy=r.leftSE,n.rightSE.consumedBy=r.rightSE}}},{key:"prevInResult",value:function(){return void 0!==this._prevInResult||(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null),this._prevInResult}},{key:"beforeState",value:function(){if(void 0!==this._beforeState)return this._beforeState;if(this.prev){var t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}else this._beforeState={rings:[],windings:[],multiPolys:[]};return this._beforeState}},{key:"afterState",value:function(){if(void 0!==this._afterState)return this._afterState;var t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};for(var e=this._afterState.rings,r=this._afterState.windings,n=this._afterState.multiPolys,i=0,o=this.rings.length;i<o;i++){var s=this.rings[i],u=this.windings[i],l=e.indexOf(s);-1===l?(e.push(s),r.push(u)):r[l]+=u}for(var h=[],f=[],a=0,p=e.length;a<p;a++)if(0!==r[a]){var y=e[a],g=y.poly;if(-1===f.indexOf(g))if(y.isExterior)h.push(g);else{-1===f.indexOf(g)&&f.push(g);var v=h.indexOf(y.poly);-1!==v&&h.splice(v,1)}}for(var c=0,x=h.length;c<x;c++){var b=h[c].multiPoly;-1===n.indexOf(b)&&n.push(b)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(void 0!==this._isInResult)return this._isInResult;var t=this.beforeState().multiPolys,e=this.afterState().multiPolys;switch(F.type){case"union":var r=0===t.length,n=0===e.length;this._isInResult=r!==n;break;case"intersection":var i,o;t.length<e.length?(i=t.length,o=e.length):(i=e.length,o=t.length),this._isInResult=o===F.numMultiPolys&&i<o;break;case"xor":var s=Math.abs(t.length-e.length);this._isInResult=s%2==1;break;case"difference":var u=function(t){return 1===t.length&&t[0].isSubject};this._isInResult=u(t)!==u(e);break;default:throw new Error("Unrecognized operation type found ".concat(F.type))}return this._isInResult}}],[{key:"fromRing",value:function(t,r,n){var i,o,s,u=P.comparePoints(t,r);if(u<0)i=t,o=r,s=1;else{if(!(u>0))throw new Error("Tried to create degenerate segment at [".concat(t.x,", ").concat(t.y,"]"));i=r,o=t,s=-1}return new e(new P(i,!0),new P(o,!1),[n],[s])}}]),e}(),A=function(){function e(r,n,i){if(t(this,e),!Array.isArray(r)||0===r.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=i,this.segments=[],"number"!=typeof r[0][0]||"number"!=typeof r[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var o=d.round(r[0][0],r[0][1]);this.bbox={ll:{x:o.x,y:o.y},ur:{x:o.x,y:o.y}};for(var s=o,u=1,l=r.length;u<l;u++){if("number"!=typeof r[u][0]||"number"!=typeof r[u][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var h=d.round(r[u][0],r[u][1]);h.x===s.x&&h.y===s.y||(this.segments.push(O.fromRing(s,h,this)),h.x<this.bbox.ll.x&&(this.bbox.ll.x=h.x),h.y<this.bbox.ll.y&&(this.bbox.ll.y=h.y),h.x>this.bbox.ur.x&&(this.bbox.ur.x=h.x),h.y>this.bbox.ur.y&&(this.bbox.ur.y=h.y),s=h)}o.x===s.x&&o.y===s.y||this.segments.push(O.fromRing(s,o,this))}return r(e,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,r=this.segments.length;e<r;e++){var n=this.segments[e];t.push(n.leftSE),t.push(n.rightSE)}return t}}]),e}(),L=function(){function e(r,n){if(t(this,e),!Array.isArray(r))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new A(r[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(var i=1,o=r.length;i<o;i++){var s=new A(r[i],this,!1);s.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=s.bbox.ll.x),s.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=s.bbox.ll.y),s.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=s.bbox.ur.x),s.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=s.bbox.ur.y),this.interiorRings.push(s)}this.multiPoly=n}return r(e,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),e=0,r=this.interiorRings.length;e<r;e++)for(var n=this.interiorRings[e].getSweepEvents(),i=0,o=n.length;i<o;i++)t.push(n[i]);return t}}]),e}(),z=function(){function e(r,n){if(t(this,e),!Array.isArray(r))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{"number"==typeof r[0][0][0]&&(r=[r])}catch(t){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var i=0,o=r.length;i<o;i++){var s=new L(r[i],this);s.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=s.bbox.ll.x),s.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=s.bbox.ll.y),s.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=s.bbox.ur.x),s.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=s.bbox.ur.y),this.polys.push(s)}this.isSubject=n}return r(e,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,r=this.polys.length;e<r;e++)for(var n=this.polys[e].getSweepEvents(),i=0,o=n.length;i<o;i++)t.push(n[i]);return t}}]),e}(),B=function(){function e(r){t(this,e),this.events=r;for(var n=0,i=r.length;n<i;n++)r[n].segment.ringOut=this;this.poly=null}return r(e,null,[{key:"factory",value:function(t){for(var r=[],n=0,i=t.length;n<i;n++){var o=t[n];if(o.isInResult()&&!o.ringOut){for(var s=null,u=o.leftSE,l=o.rightSE,h=[u],f=u.point,a=[];s=u,u=l,h.push(u),u.point!==f;)for(;;){var p=u.getAvailableLinkedEvents();if(0===p.length){var y=h[0].point,g=h[h.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(y.x,",")+" ".concat(y.y,"]. Last matching segment found ends at")+" [".concat(g.x,", ").concat(g.y,"]."))}if(1===p.length){l=p[0].otherSE;break}for(var v=null,c=0,x=a.length;c<x;c++)if(a[c].point===u.point){v=c;break}if(null===v){a.push({index:h.length,point:u.point});var b=u.getLeftmostComparator(s);l=p.sort(b)[0].otherSE;break}var m=a.splice(v)[0],d=h.splice(m.index);d.unshift(d[0].otherSE),r.push(new e(d.reverse()))}r.push(new e(h))}}return r}}]),r(e,[{key:"getGeom",value:function(){for(var t=this.events[0].point,e=[t],r=1,n=this.events.length-1;r<n;r++){var i=this.events[r].point,o=this.events[r+1].point;0!==_(i,t,o)&&(e.push(i),t=i)}if(1===e.length)return null;var s=e[0],u=e[1];0===_(s,t,u)&&e.shift(),e.push(e[0]);for(var l=this.isExteriorRing()?1:-1,h=this.isExteriorRing()?0:e.length-1,f=this.isExteriorRing()?e.length:-1,a=[],p=h;p!=f;p+=l)a.push([e[p].x,e[p].y]);return a}},{key:"isExteriorRing",value:function(){if(void 0===this._isExteriorRing){var t=this.enclosingRing();this._isExteriorRing=!t||!t.isExteriorRing()}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return void 0===this._enclosingRing&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var t=this.events[0],e=1,r=this.events.length;e<r;e++){var n=this.events[e];P.compare(t,n)>0&&(t=n)}for(var i=t.segment.prevInResult(),o=i?i.prevInResult():null;;){if(!i)return null;if(!o)return i.ringOut;if(o.ringOut!==i.ringOut)return o.ringOut.enclosingRing()!==i.ringOut?i.ringOut:i.ringOut.enclosingRing();i=o.prevInResult(),o=i?i.prevInResult():null}}}]),e}(),M=function(){function e(r){t(this,e),this.exteriorRing=r,r.poly=this,this.interiorRings=[]}return r(e,[{key:"addInterior",value:function(t){this.interiorRings.push(t),t.poly=this}},{key:"getGeom",value:function(){var t=[this.exteriorRing.getGeom()];if(null===t[0])return null;for(var e=0,r=this.interiorRings.length;e<r;e++){var n=this.interiorRings[e].getGeom();null!==n&&t.push(n)}return t}}]),e}(),G=function(){function e(r){t(this,e),this.rings=r,this.polys=this._composePolys(r)}return r(e,[{key:"getGeom",value:function(){for(var t=[],e=0,r=this.polys.length;e<r;e++){var n=this.polys[e].getGeom();null!==n&&t.push(n)}return t}},{key:"_composePolys",value:function(t){for(var e=[],r=0,n=t.length;r<n;r++){var i=t[r];if(!i.poly)if(i.isExteriorRing())e.push(new M(i));else{var o=i.enclosingRing();o.poly||e.push(new M(o)),o.poly.addInterior(i)}}return e}}]),e}(),T=function(){function e(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:O.compare;t(this,e),this.queue=r,this.tree=new h(n),this.segments=[]}return r(e,[{key:"process",value:function(t){var e=t.segment,r=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),r;var n=t.isLeft?this.tree.insert(e):this.tree.find(e);if(!n)throw new Error("Unable to find segment #".concat(e.id," ")+"[".concat(e.leftSE.point.x,", ").concat(e.leftSE.point.y,"] -> ")+"[".concat(e.rightSE.point.x,", ").concat(e.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var i=n,o=n,s=void 0,u=void 0;void 0===s;)null===(i=this.tree.prev(i))?s=null:void 0===i.key.consumedBy&&(s=i.key);for(;void 0===u;)null===(o=this.tree.next(o))?u=null:void 0===o.key.consumedBy&&(u=o.key);if(t.isLeft){var l=null;if(s){var h=s.getIntersection(e);if(null!==h&&(e.isAnEndpoint(h)||(l=h),!s.isAnEndpoint(h)))for(var f=this._splitSafely(s,h),a=0,p=f.length;a<p;a++)r.push(f[a])}var y=null;if(u){var g=u.getIntersection(e);if(null!==g&&(e.isAnEndpoint(g)||(y=g),!u.isAnEndpoint(g)))for(var v=this._splitSafely(u,g),c=0,x=v.length;c<x;c++)r.push(v[c])}if(null!==l||null!==y){var b=null;if(null===l)b=y;else if(null===y)b=l;else{b=P.comparePoints(l,y)<=0?l:y}this.queue.remove(e.rightSE),r.push(e.rightSE);for(var m=e.split(b),d=0,E=m.length;d<E;d++)r.push(m[d])}r.length>0?(this.tree.remove(e),r.push(t)):(this.segments.push(e),e.prev=s)}else{if(s&&u){var S=s.getIntersection(u);if(null!==S){if(!s.isAnEndpoint(S))for(var _=this._splitSafely(s,S),k=0,w=_.length;k<w;k++)r.push(_[k]);if(!u.isAnEndpoint(S))for(var R=this._splitSafely(u,S),I=0,N=R.length;I<N;I++)r.push(R[I])}}this.tree.remove(e)}return r}},{key:"_splitSafely",value:function(t,e){this.tree.remove(t);var r=t.rightSE;this.queue.remove(r);var n=t.split(e);return n.push(r),void 0===t.consumedBy&&this.tree.insert(t),n}}]),e}(),C="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,q="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,F=new(function(){function e(){t(this,e)}return r(e,[{key:"run",value:function(t,e,r){F.type=t,d.reset();for(var n=[new z(e,!0)],i=0,o=r.length;i<o;i++)n.push(new z(r[i],!1));if(F.numMultiPolys=n.length,"difference"===F.type)for(var s=n[0],u=1;u<n.length;)null!==g(n[u].bbox,s.bbox)?u++:n.splice(u,1);if("intersection"===F.type)for(var l=0,f=n.length;l<f;l++)for(var a=n[l],p=l+1,y=n.length;p<y;p++)if(null===g(a.bbox,n[p].bbox))return[];for(var v=new h(P.compare),c=0,x=n.length;c<x;c++)for(var b=n[c].getSweepEvents(),m=0,E=b.length;m<E;m++)if(v.insert(b[m]),v.size>C)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var S=new T(v),_=v.size,k=v.pop();k;){var w=k.key;if(v.size===_){var R=w.segment;throw new Error("Unable to pop() ".concat(w.isLeft?"left":"right"," SweepEvent ")+"[".concat(w.point.x,", ").concat(w.point.y,"] from segment #").concat(R.id," ")+"[".concat(R.leftSE.point.x,", ").concat(R.leftSE.point.y,"] -> ")+"[".concat(R.rightSE.point.x,", ").concat(R.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(v.size>C)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(S.segments.length>q)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var I=S.process(w),N=0,O=I.length;N<O;N++){var A=I[N];void 0===A.consumedBy&&v.insert(A)}_=v.size,k=v.pop()}d.reset();var L=B.factory(S.segments);return new G(L).getGeom()}}]),e}());return{union:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return F.run("union",t,r)},intersection:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return F.run("intersection",t,r)},xor:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return F.run("xor",t,r)},difference:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return F.run("difference",t,r)}}})); | ||
//# sourceMappingURL=polygon-clipping.umd.min.js.map |
{ | ||
"name": "polygon-clipping", | ||
"version": "0.15.1", | ||
"version": "0.15.2", | ||
"description": "Apply boolean Polygon clipping operations (intersection, union, difference, xor) to your Polygons & MultiPolygons.", | ||
@@ -47,30 +47,29 @@ "main": "dist/polygon-clipping.cjs.js", | ||
"devDependencies": { | ||
"@babel/cli": "^7.10.3", | ||
"@babel/core": "^7.10.3", | ||
"@babel/preset-env": "^7.10.3", | ||
"@babel/cli": "^7.12.10", | ||
"@babel/core": "^7.12.10", | ||
"@babel/preset-env": "^7.12.10", | ||
"@rollup/plugin-commonjs": "^16.0.0", | ||
"@rollup/plugin-json": "^4.1.0", | ||
"@rollup/plugin-node-resolve": "^10.0.0", | ||
"@turf/difference": "^5.1.5", | ||
"@turf/intersect": "^5.1.6", | ||
"@turf/union": "^5.1.5", | ||
"babel-jest": "^24.9.0", | ||
"babel-jest": "^26.6.3", | ||
"benchmark": "^2.1.4", | ||
"coveralls": "^3.1.0", | ||
"eslint": "^5.16.0", | ||
"eslint-plugin-vue-libs": "^3.0.2", | ||
"jest": "^24.9.0", | ||
"load-json-file": "^5.3.0", | ||
"martinez-polygon-clipping": "^0.5.0", | ||
"eslint": "^7.15.0", | ||
"eslint-plugin-vue": "^7.2.0", | ||
"jest": "^26.6.3", | ||
"load-json-file": "^6.2.0", | ||
"martinez-polygon-clipping": "0.5.0", | ||
"npm-run-all": "^4.1.5", | ||
"rollup": "^1.32.1", | ||
"rollup": "^2.35.1", | ||
"rollup-plugin-babel": "^4.4.0", | ||
"rollup-plugin-commonjs": "^9.3.4", | ||
"rollup-plugin-json": "^3.1.0", | ||
"rollup-plugin-node-resolve": "^4.2.4", | ||
"rollup-plugin-terser": "^4.0.4", | ||
"rollup-plugin-vue": "^4.7.2", | ||
"serve": "^10.1.2", | ||
"vue-template-compiler": "^2.6.11" | ||
"rollup-plugin-terser": "^7.0.2", | ||
"rollup-plugin-vue": "^5.1.9", | ||
"serve": "^11.3.2", | ||
"vue-template-compiler": "^2.6.12" | ||
}, | ||
"dependencies": { | ||
"splaytree": "^3.0.1" | ||
"splaytree": "^3.1.0" | ||
} | ||
} |
@@ -5,5 +5,5 @@ # polygon-clipping | ||
[![npm version](https://img.shields.io/npm/v/polygon-clipping.svg)](https://www.npmjs.com/package/polygon-clipping) | ||
[![build status](https://img.shields.io/travis/mfogel/polygon-clipping/master.svg)](https://travis-ci.org/mfogel/polygon-clipping) | ||
[![test coverage](https://img.shields.io/coveralls/mfogel/polygon-clipping/master.svg)](https://coveralls.io/r/mfogel/polygon-clipping) | ||
[![build](https://github.com/mfogel/polygon-clipping/workflows/build/badge.svg)](https://github.com/mfogel/polygon-clipping/actions?query=workflow%3Abuild) | ||
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT) | ||
[![npm](https://img.shields.io/npm/v/polygon-clipping.svg)](https://www.npmjs.com/package/polygon-clipping) | ||
@@ -10,0 +10,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23
329688
5154
Updatedsplaytree@^3.1.0