diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 6318898..e772a1c 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -1,6 +1,13 @@ -name: Node CI +# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions -on: [push] +name: Node.js CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] jobs: build: @@ -9,18 +16,14 @@ jobs: strategy: matrix: - node-version: [8.x, 10.x, 12.x] + node-version: [10.x, 12.x] steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} - - name: npm install, build, and test - run: | - npm ci - npm run build --if-present - npm test - env: - CI: true + - run: npm ci + - run: npm run build --if-present + - run: npm test diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..7c953ed --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,21 @@ +on: + push: + tags: + - 'v*.*.*' + +jobs: + publish: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-node@v1 + with: + node-version: 12 + - run: npm ci + - run: npm run build + - run: npm test + - uses: JS-DevTools/npm-publish@v1 + with: + token: ${{ secrets.NPM_TOKEN }} diff --git a/.gitignore b/.gitignore index 7a2eb29..bac1b14 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ node_modules .DS_Store .reify-cache npm-debug.log +dist diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0457132..0000000 --- a/.travis.yml +++ /dev/null @@ -1,10 +0,0 @@ -language: node_js -node_js: - - "8" - -env: - global: - - BUILD_TIMEOUT=10000 - -install: - - npm install diff --git a/dist/martinez.min.js b/dist/martinez.min.js deleted file mode 100644 index 5373cc1..0000000 --- a/dist/martinez.min.js +++ /dev/null @@ -1,9 +0,0 @@ -/** - * martinez v0.7.0 - * Martinez polygon clipping algorithm, does boolean operation on polygons (multipolygons, polygons with holes etc): intersection, union, difference, xor - * - * @author Alex Milevski - * @license MIT - * @preserve - */ -(function(t,e){typeof exports==="object"&&typeof module!=="undefined"?e(exports):typeof define==="function"&&define.amd?define(["exports"],e):(t=t||self,e(t.martinez={}))})(this,function(t){"use strict";function i(t,e){return t>e?1:t0){r=r.left}else{return r}}return null};d.prototype.contains=function t(e){var r=this._root;var i=this._compare;while(r){var n=i(e,r.key);if(n===0){return true}else if(n<0){r=r.left}else{r=r.right}}return false};d.prototype.remove=function t(e){var r=this.find(e);if(!r){return false}this.splay(r);if(!r.left){this.replace(r,r.right)}else if(!r.right){this.replace(r,r.left)}else{var i=this.minNode(r.right);if(i.parent!==r){this.replace(i,i.right);i.right=r.right;i.right.parent=i}this.replace(r,i);i.left=r.left;i.left.parent=i}this._size--;return true};d.prototype.removeNode=function t(e){if(!e){return false}this.splay(e);if(!e.left){this.replace(e,e.right)}else if(!e.right){this.replace(e,e.left)}else{var r=this.minNode(e.right);if(r.parent!==e){this.replace(r,r.right);r.right=e.right;r.right.parent=r}this.replace(e,r);r.left=e.left;r.left.parent=r}this._size--;return true};d.prototype.erase=function t(e){var r=this.find(e);if(!r){return}this.splay(r);var i=r.left;var n=r.right;var o=null;if(i){i.parent=null;o=this.maxNode(i);this.splay(o);this._root=o}if(n){if(i){o.right=n}else{this._root=n}n.parent=o}this._size--};d.prototype.pop=function t(){var e=this._root,r=null;if(e){while(e.left){e=e.left}r={key:e.key,data:e.data};this.remove(e.key)}return r};d.prototype.next=function t(e){var r=e;if(r){if(r.right){r=r.right;while(r&&r.left){r=r.left}}else{r=e.parent;while(r&&r.right===e){e=r;r=r.parent}}}return r};d.prototype.prev=function t(e){var r=e;if(r){if(r.left){r=r.left;while(r&&r.right){r=r.right}}else{r=e.parent;while(r&&r.left===e){e=r;r=r.parent}}}return r};d.prototype.forEach=function t(e){var r=this._root;var i=[],n=false,o=0;while(!n){if(r){i.push(r);r=r.left}else{if(i.length>0){r=i.pop();e(r,o++);r=r.right}else{n=true}}}return this};d.prototype.range=function t(e,r,i,n){var o=[];var f=this._compare;var a=this._root,l;while(o.length!==0||a){if(a){o.push(a);a=a.left}else{a=o.pop();l=f(a.key,r);if(l>0){break}else if(f(a.key,e)>=0){if(i.call(n,a)){return this}}a=a.right}}return this};d.prototype.keys=function t(){var e=this._root;var r=[],i=[],n=false;while(!n){if(e){r.push(e);e=e.left}else{if(r.length>0){e=r.pop();i.push(e.key);e=e.right}else{n=true}}}return i};d.prototype.values=function t(){var e=this._root;var r=[],i=[],n=false;while(!n){if(e){r.push(e);e=e.left}else{if(r.length>0){e=r.pop();i.push(e.data);e=e.right}else{n=true}}}return i};d.prototype.at=function t(e){var r=this._root;var i=[],n=false,o=0;while(!n){if(r){i.push(r);r=r.left}else{if(i.length>0){r=i.pop();if(o===e){return r}o++;r=r.right}else{n=true}}}return null};d.prototype.load=function t(e,r,i){if(e===void 0)e=[];if(r===void 0)r=[];if(i===void 0)i=false;if(this._size!==0){throw new Error("bulk-load: tree is not empty")}var n=e.length;if(i){u(e,r,0,n-1,this._compare)}this._root=s(null,e,r,0,n);this._size=n;return this};d.prototype.min=function t(){var e=this.minNode(this._root);if(e){return e.key}else{return null}};d.prototype.max=function t(){var e=this.maxNode(this._root);if(e){return e.key}else{return null}};d.prototype.isEmpty=function t(){return this._root===null};e.size.get=function(){return this._size};d.createTree=function t(e,r,i,n,o){return new d(i,o).load(e,r,n)};Object.defineProperties(d.prototype,e);function s(t,e,r,i,n){var o=n-i;if(o>0){var f=i+Math.floor(o/2);var a=e[f];var l=r[f];var u={key:a,data:l,parent:t};u.left=s(u,e,r,i,f);u.right=s(u,e,r,f+1,n);return u}return null}function u(t,e,r,i,n){if(r>=i){return}var o=t[r+i>>1];var f=r-1;var a=i+1;while(true){do{f++}while(n(t[f],o)<0);do{a--}while(n(t[a],o)>0);if(f>=a){break}var l=t[f];t[f]=t[a];t[a]=l;l=e[f];e[f]=e[a];e[a]=l}u(t,e,r,a,n);u(t,e,a+1,i,n)}var f=0;var l=1;var h=2;var p=3;var y=0;var a=1;var w=2;var v=3;function E(t,e,r){if(e===null){t.inOut=false;t.otherInOut=true}else{if(t.isSubject===e.isSubject){t.inOut=!e.inOut;t.otherInOut=e.otherInOut}else{t.inOut=!e.otherInOut;t.otherInOut=e.isVertical()?!e.inOut:e.inOut}if(e){t.prevInResult=!n(e,r)||e.isVertical()?e.prevInResult:e}}var i=n(t,r);if(i){t.resultTransition=o(t,r)}else{t.resultTransition=0}}function n(t,e){switch(t.type){case f:switch(e){case y:return!t.otherInOut;case a:return t.otherInOut;case w:return t.isSubject&&t.otherInOut||!t.isSubject&&!t.otherInOut;case v:return true}break;case h:return e===y||e===a;case p:return e===w;case l:return false}return false}function o(t,e){var r=!t.inOut;var i=!t.otherInOut;var n;switch(e){case y:n=r&&i;break;case a:n=r||i;break;case v:n=r^i;break;case w:if(t.isSubject){n=r&&!i}else{n=i&&!r}break}return n?+1:-1}var c=function t(e,r,i,n,o){this.left=r;this.point=e;this.otherEvent=i;this.isSubject=n;this.type=o||f;this.inOut=false;this.otherInOut=false;this.prevInResult=null;this.resultTransition=0;this.otherPos=-1;this.outputContourId=-1;this.isExteriorRing=true};var r={inResult:{configurable:true}};c.prototype.isBelow=function t(e){var r=this.point,i=this.otherEvent.point;return this.left?(r[0]-e[0])*(i[1]-e[1])-(i[0]-e[0])*(r[1]-e[1])>0:(i[0]-e[0])*(r[1]-e[1])-(r[0]-e[0])*(i[1]-e[1])>0};c.prototype.isAbove=function t(e){return!this.isBelow(e)};c.prototype.isVertical=function t(){return this.point[0]===this.otherEvent.point[0]};r.inResult.get=function(){return this.resultTransition!==0};c.prototype.clone=function t(){var e=new c(this.point,this.left,this.otherEvent,this.isSubject,this.type);e.contourId=this.contourId;e.resultTransition=this.resultTransition;e.prevInResult=this.prevInResult;e.isExteriorRing=this.isExteriorRing;e.inOut=this.inOut;e.otherInOut=this.otherInOut;return e};Object.defineProperties(c.prototype,r);function g(t,e){if(t[0]===e[0]){if(t[1]===e[1]){return true}else{return false}}return false}var I=11102230246251565e-32;var T=134217729;var L=(3+8*I)*I;function B(t,e,r,i,n){var o,f,a,l;var u=e[0];var s=i[0];var h=0;var p=0;if(s>u===s>-u){o=u;u=e[++h]}else{o=s;s=i[++p]}var v=0;if(hu===s>-u){f=u+o;a=o-(f-u);u=e[++h]}else{f=s+o;a=o-(f-s);s=i[++p]}o=f;if(a!==0){n[v++]=a}while(hu===s>-u){f=o+u;l=f-o;a=o-(f-l)+(u-l);u=e[++h]}else{f=o+s;l=f-o;a=o-(f-l)+(s-l);s=i[++p]}o=f;if(a!==0){n[v++]=a}}}while(h=N||-S>=N){return S}h=t-m;a=t-(m+h)+(h-n);h=r-R;u=r-(R+h)+(h-n);h=e-j;l=e-(j+h)+(h-o);h=i-x;s=i-(x+h)+(h-o);if(a===0&&l===0&&u===0&&s===0){return S}N=D*f+L*Math.abs(S);S+=m*s+x*a-(j*u+R*l);if(S>=N||-S>=N){return S}I=a*x;p=T*a;v=p-(p-a);c=a-v;p=T*x;g=p-(p-x);d=x-g;_=c*d-(I-v*g-c*g-v*d);b=l*R;p=T*l;v=p-(p-l);c=l-v;p=T*R;g=p-(p-R);d=R-g;O=c*d-(b-v*g-c*g-v*d);y=_-O;h=_-y;q[0]=_-(y+h)+(h-O);w=I+y;h=w-I;E=I-(w-h)+(y-h);y=E-b;h=E-y;q[1]=E-(y+h)+(h-b);k=w+y;h=k-w;q[2]=w-(k-h)+(y-h);q[3]=k;var z=B(4,F,4,q,V);I=m*s;p=T*m;v=p-(p-m);c=m-v;p=T*s;g=p-(p-s);d=s-g;_=c*d-(I-v*g-c*g-v*d);b=j*u;p=T*j;v=p-(p-j);c=j-v;p=T*u;g=p-(p-u);d=u-g;O=c*d-(b-v*g-c*g-v*d);y=_-O;h=_-y;q[0]=_-(y+h)+(h-O);w=I+y;h=w-I;E=I-(w-h)+(y-h);y=E-b;h=E-y;q[1]=E-(y+h)+(h-b);k=w+y;h=k-w;q[2]=w-(k-h)+(y-h);q[3]=k;var M=B(z,V,4,q,U);I=a*s;p=T*a;v=p-(p-a);c=a-v;p=T*s;g=p-(p-s);d=s-g;_=c*d-(I-v*g-c*g-v*d);b=l*u;p=T*l;v=p-(p-l);c=l-v;p=T*u;g=p-(p-u);d=u-g;O=c*d-(b-v*g-c*g-v*d);y=_-O;h=_-y;q[0]=_-(y+h)+(h-O);w=I+y;h=w-I;E=I-(w-h)+(y-h);y=E-b;h=E-y;q[1]=E-(y+h)+(h-b);k=w+y;h=k-w;q[2]=w-(k-h)+(y-h);q[3]=k;var P=B(M,U,4,q,X);return X[P-1]}function k(t,e,r,i,n,o){var f=(e-o)*(r-n);var a=(t-n)*(i-o);var l=f-a;if(f===0||a===0||f>0!==a>0){return l}var u=Math.abs(f+a);if(Math.abs(l)>=b*u){return l}return-O(t,e,r,i,n,o,u)}function m(t,e,r){var i=k(t[0],t[1],e[0],e[1],r[0],r[1]);if(i>0){return-1}if(i<0){return 1}return 0}function R(t,e){var r=t.point;var i=e.point;if(r[0]>i[0]){return 1}if(r[0]i[1]?1:-1}return j(t,e,r)}function j(t,e,r,i){if(t.left!==e.left){return t.left?1:-1}if(m(r,t.otherEvent.point,e.otherEvent.point)!==0){return!t.isBelow(e.otherEvent.point)?1:-1}return!t.isSubject&&e.isSubject?1:-1}function x(t,e,r){var i=new c(e,false,t,t.isSubject);var n=new c(e,true,t.otherEvent,t.isSubject);if(g(t.point,t.otherEvent.point)){console.warn("what is that, a collapsed segment?",t)}i.contourId=n.contourId=t.contourId;if(R(n,t.otherEvent)>0){t.otherEvent.left=true;n.left=false}t.otherEvent.otherEvent=n;t.otherEvent=i;r.push(n);r.push(i);return r}function S(t,e){return t[0]*e[1]-t[1]*e[0]}function N(t,e){return t[0]*e[0]+t[1]*e[1]}function z(t,e,r,i,n){var o=[e[0]-t[0],e[1]-t[1]];var f=[i[0]-r[0],i[1]-r[1]];function a(t,e,r){return[t[0]+e*r[0],t[1]+e*r[1]]}var l=[r[0]-t[0],r[1]-t[1]];var u=S(o,f);var s=u*u;var h=N(o,o);if(s>0){var p=S(l,f)/u;if(p<0||p>1){return null}var v=S(l,o)/u;if(v<0||v>1){return null}if(p===0||p===1){return n?null:[a(t,p,o)]}if(v===0||v===1){return n?null:[a(r,v,f)]}return[a(t,p,o)]}u=S(l,o);s=u*u;if(s>0){return null}var c=N(o,l)/h;var g=c+N(o,f)/h;var d=Math.min(c,g);var y=Math.max(c,g);if(d<=1&&y>=0){if(d===1){return n?null:[a(t,d>0?d:0,o)]}if(y===0){return n?null:[a(t,y<1?y:1,o)]}if(n&&d===0&&y===1){return null}return[a(t,d>0?d:0,o),a(t,y<1?y:1,o)]}return null}function M(t,e,r){var i=z(t.point,t.otherEvent.point,e.point,e.otherEvent.point);var n=i?i.length:0;if(n===0){return 0}if(n===1&&(g(t.point,e.point)||g(t.otherEvent.point,e.otherEvent.point))){return 0}if(n===2&&t.isSubject===e.isSubject){return 0}if(n===1){if(!g(t.point,i[0])&&!g(t.otherEvent.point,i[0])){x(t,i[0],r)}if(!g(e.point,i[0])&&!g(e.otherEvent.point,i[0])){x(e,i[0],r)}return 1}var o=[];var f=false;var a=false;if(g(t.point,e.point)){f=true}else if(R(t,e)===1){o.push(e,t)}else{o.push(t,e)}if(g(t.otherEvent.point,e.otherEvent.point)){a=true}else if(R(t.otherEvent,e.otherEvent)===1){o.push(e.otherEvent,t.otherEvent)}else{o.push(t.otherEvent,e.otherEvent)}if(f&&a||f){e.type=l;t.type=e.inOut===t.inOut?h:p;if(f&&!a){x(o[1].otherEvent,o[0].point,r)}return 2}if(a){x(o[0],o[1].point,r);return 3}if(o[0]!==o[3].otherEvent){x(o[0],o[1].point,r);x(o[1],o[2].point,r);return 3}x(o[0],o[1].point,r);x(o[3].otherEvent,o[2].point,r);return 3}function P(t,e){if(t===e){return 0}if(m(t.point,t.otherEvent.point,e.point)!==0||m(t.point,t.otherEvent.point,e.otherEvent.point)!==0){if(g(t.point,e.point)){return t.isBelow(e.otherEvent.point)?-1:1}if(t.point[0]===e.point[0]){return t.point[1]e.contourId?1:-1}}}else{return t.isSubject?-1:1}return R(t,e)===1?1:-1}function G(t,e,r,i,n,o){var f=new d(P);var a=[];var l=Math.min(i[2],n[2]);var u,s,h;while(t.length!==0){var p=t.pop();a.push(p);if(o===y&&p.point[0]>l||o===w&&p.point[0]>i[2]){break}if(p.left){s=u=f.insert(p);h=f.minNode();if(u!==h){u=f.prev(u)}else{u=null}s=f.next(s);var v=u?u.key:null;var c=void 0;E(p,v,o);if(s){if(M(p,s.key,t)===2){E(p,v,o);E(p,s.key,o)}}if(u){if(M(u.key,p,t)===2){var g=u;if(g!==h){g=f.prev(g)}else{g=null}c=g?g.key:null;E(v,c,o);E(p,v,o)}}}else{p=p.otherEvent;s=u=f.find(p);if(u&&s){if(u!==h){u=f.prev(u)}else{u=null}s=f.next(s);f.remove(p);if(s&&u){M(u.key,s.key,t)}}}}return a}var H=function t(){this.points=[];this.holeIds=[];this.holeOf=null;this.depth=null};H.prototype.isExterior=function t(){return this.holeOf==null};function J(t){var e,r,i,n;var o=[];for(r=0,i=t.length;ri){n--}return n}function Q(t,e,r){var i=new H;if(t.prevInResult!=null){var n=t.prevInResult;var o=n.outputContourId;var f=n.resultTransition;if(f>0){var a=e[o];if(a.holeOf!=null){var l=a.holeOf;e[l].holeIds.push(r);i.holeOf=l;i.depth=e[o].depth}else{e[o].holeIds.push(r);i.holeOf=o;i.depth=e[o].depth+1}}else{i.holeOf=null;i.depth=e[o].depth}}else{i.holeOf=null;i.depth=0}return i}function W(t){var f,e;var a=J(t);var l={};var u=[];var r=function(){if(l[f]){return}var e=u.length;var t=Q(a[f],u,e);var r=function(t){l[t]=true;a[t].outputContourId=e};var i=f;var n=f;var o=a[f].point;t.points.push(o);while(true){r(i);i=a[i].otherPos;r(i);t.points.push(a[i].point);i=K(i,a,l,n);if(i==n){break}}u.push(t)};for(f=0,e=a.length;f0){for(var r=(this.length>>1)-1;r>=0;r--){this._down(r)}}}function tt(t,e){return te?1:0}$.prototype={push:function(t){this.data.push(t);this.length++;this._up(this.length-1)},pop:function(){if(this.length===0){return undefined}var t=this.data[0];this.length--;if(this.length>0){this.data[0]=this.data[this.length];this._down(0)}this.data.pop();return t},peek:function(){return this.data[0]},_up:function(t){var e=this.data;var r=this.compare;var i=e[t];while(t>0){var n=t-1>>1;var o=e[n];if(r(i,o)>=0){break}e[t]=o;t=n}e[t]=i},_down:function(t){var e=this.data;var r=this.compare;var i=this.length>>1;var n=e[t];while(t=0){break}e[t]=a;t=o}e[t]=n}};Y.default=Z;var et=Math.max;var rt=Math.min;var it=0;function nt(t,e,r,i,n,o){var f,a,l,u,s,h;for(f=0,a=t.length-1;f0){h.left=true}else{s.left=true}var p=l[0],v=l[1];n[0]=rt(n[0],p);n[1]=rt(n[1],v);n[2]=et(n[2],p);n[3]=et(n[3],v);i.push(s);i.push(h)}}function ot(t,e,r,i,n){var o=new Y(null,R);var f,a,l,u,s,h;for(l=0,u=t.length;li[2]||i[0]>r[2]||r[1]>i[3]||i[1]>r[3]){if(n===y){o=ft}else if(n===w){o=t}else if(n===a||n===v){o=t.concat(e)}}return o}function ut(t,e,r){if(typeof t[0][0][0]==="number"){t=[t]}if(typeof e[0][0][0]==="number"){e=[e]}var i=at(t,e,r);if(i){return i===ft?null:i}var n=[Infinity,Infinity,-Infinity,-Infinity];var o=[Infinity,Infinity,-Infinity,-Infinity];var f=ot(t,e,n,o,r);i=lt(t,e,n,o,r);if(i){return i===ft?null:i}var a=G(f,t,e,n,o,r);var l=W(a);var u=[];for(var s=0;s - * @license MIT - * @preserve - */ - -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (global = global || self, factory(global.martinez = {})); -}(this, (function (exports) { 'use strict'; - - function DEFAULT_COMPARE (a, b) { return a > b ? 1 : a < b ? -1 : 0; } - - var SplayTree = function SplayTree(compare, noDuplicates) { - if ( compare === void 0 ) compare = DEFAULT_COMPARE; - if ( noDuplicates === void 0 ) noDuplicates = false; - - this._compare = compare; - this._root = null; - this._size = 0; - this._noDuplicates = !!noDuplicates; - }; - - var prototypeAccessors = { size: { configurable: true } }; - - - SplayTree.prototype.rotateLeft = function rotateLeft (x) { - var y = x.right; - if (y) { - x.right = y.left; - if (y.left) { y.left.parent = x; } - y.parent = x.parent; - } - - if (!x.parent) { this._root = y; } - else if (x === x.parent.left) { x.parent.left = y; } - else { x.parent.right = y; } - if (y) { y.left = x; } - x.parent = y; - }; - - - SplayTree.prototype.rotateRight = function rotateRight (x) { - var y = x.left; - if (y) { - x.left = y.right; - if (y.right) { y.right.parent = x; } - y.parent = x.parent; - } - - if (!x.parent) { this._root = y; } - else if(x === x.parent.left) { x.parent.left = y; } - else { x.parent.right = y; } - if (y) { y.right = x; } - x.parent = y; - }; - - - SplayTree.prototype._splay = function _splay (x) { - while (x.parent) { - var p = x.parent; - if (!p.parent) { - if (p.left === x) { this.rotateRight(p); } - else { this.rotateLeft(p); } - } else if (p.left === x && p.parent.left === p) { - this.rotateRight(p.parent); - this.rotateRight(p); - } else if (p.right === x && p.parent.right === p) { - this.rotateLeft(p.parent); - this.rotateLeft(p); - } else if (p.left === x && p.parent.right === p) { - this.rotateRight(p); - this.rotateLeft(p); - } else { - this.rotateLeft(p); - this.rotateRight(p); - } - } - }; - - - SplayTree.prototype.splay = function splay (x) { - var p, gp, ggp, l, r; - - while (x.parent) { - p = x.parent; - gp = p.parent; - - if (gp && gp.parent) { - ggp = gp.parent; - if (ggp.left === gp) { ggp.left= x; } - else { ggp.right = x; } - x.parent = ggp; - } else { - x.parent = null; - this._root = x; - } - - l = x.left; r = x.right; - - if (x === p.left) { // left - if (gp) { - if (gp.left === p) { - /* zig-zig */ - if (p.right) { - gp.left = p.right; - gp.left.parent = gp; - } else { gp.left = null; } - - p.right = gp; - gp.parent = p; - } else { - /* zig-zag */ - if (l) { - gp.right = l; - l.parent = gp; - } else { gp.right = null; } - - x.left = gp; - gp.parent = x; - } - } - if (r) { - p.left = r; - r.parent = p; - } else { p.left = null; } - - x.right= p; - p.parent = x; - } else { // right - if (gp) { - if (gp.right === p) { - /* zig-zig */ - if (p.left) { - gp.right = p.left; - gp.right.parent = gp; - } else { gp.right = null; } - - p.left = gp; - gp.parent = p; - } else { - /* zig-zag */ - if (r) { - gp.left = r; - r.parent = gp; - } else { gp.left = null; } - - x.right = gp; - gp.parent = x; - } - } - if (l) { - p.right = l; - l.parent = p; - } else { p.right = null; } - - x.left = p; - p.parent = x; - } - } - }; - - - SplayTree.prototype.replace = function replace (u, v) { - if (!u.parent) { this._root = v; } - else if (u === u.parent.left) { u.parent.left = v; } - else { u.parent.right = v; } - if (v) { v.parent = u.parent; } - }; - - - SplayTree.prototype.minNode = function minNode (u) { - if ( u === void 0 ) u = this._root; - - if (u) { while (u.left) { u = u.left; } } - return u; - }; - - - SplayTree.prototype.maxNode = function maxNode (u) { - if ( u === void 0 ) u = this._root; - - if (u) { while (u.right) { u = u.right; } } - return u; - }; - - - SplayTree.prototype.insert = function insert (key, data) { - var z = this._root; - var p = null; - var comp = this._compare; - var cmp; - - if (this._noDuplicates) { - while (z) { - p = z; - cmp = comp(z.key, key); - if (cmp === 0) { return; } - else if (comp(z.key, key) < 0) { z = z.right; } - else { z = z.left; } - } - } else { - while (z) { - p = z; - if (comp(z.key, key) < 0) { z = z.right; } - else { z = z.left; } - } - } - - z = { key: key, data: data, left: null, right: null, parent: p }; - - if (!p) { this._root = z; } - else if (comp(p.key, z.key) < 0) { p.right = z; } - else { p.left= z; } - - this.splay(z); - this._size++; - return z; - }; - - - SplayTree.prototype.find = function find (key) { - var z = this._root; - var comp = this._compare; - while (z) { - var cmp = comp(z.key, key); - if (cmp < 0) { z = z.right; } - else if (cmp > 0) { z = z.left; } - else { return z; } - } - return null; - }; - - /** - * Whether the tree contains a node with the given key - * @param{Key} key - * @return {boolean} true/false - */ - SplayTree.prototype.contains = function contains (key) { - var node = this._root; - var comparator = this._compare; - while (node){ - var cmp = comparator(key, node.key); - if (cmp === 0) { return true; } - else if (cmp < 0) { node = node.left; } - else { node = node.right; } - } - - return false; - }; - - - SplayTree.prototype.remove = function remove (key) { - var z = this.find(key); - - if (!z) { return false; } - - this.splay(z); - - if (!z.left) { this.replace(z, z.right); } - else if (!z.right) { this.replace(z, z.left); } - else { - var y = this.minNode(z.right); - if (y.parent !== z) { - this.replace(y, y.right); - y.right = z.right; - y.right.parent = y; - } - this.replace(z, y); - y.left = z.left; - y.left.parent = y; - } - - this._size--; - return true; - }; - - - SplayTree.prototype.removeNode = function removeNode (z) { - if (!z) { return false; } - - this.splay(z); - - if (!z.left) { this.replace(z, z.right); } - else if (!z.right) { this.replace(z, z.left); } - else { - var y = this.minNode(z.right); - if (y.parent !== z) { - this.replace(y, y.right); - y.right = z.right; - y.right.parent = y; - } - this.replace(z, y); - y.left = z.left; - y.left.parent = y; - } - - this._size--; - return true; - }; - - - SplayTree.prototype.erase = function erase (key) { - var z = this.find(key); - if (!z) { return; } - - this.splay(z); - - var s = z.left; - var t = z.right; - - var sMax = null; - if (s) { - s.parent = null; - sMax = this.maxNode(s); - this.splay(sMax); - this._root = sMax; - } - if (t) { - if (s) { sMax.right = t; } - else { this._root = t; } - t.parent = sMax; - } - - this._size--; - }; - - /** - * Removes and returns the node with smallest key - * @return {?Node} - */ - SplayTree.prototype.pop = function pop () { - var node = this._root, returnValue = null; - if (node) { - while (node.left) { node = node.left; } - returnValue = { key: node.key, data: node.data }; - this.remove(node.key); - } - return returnValue; - }; - - - /* eslint-disable class-methods-use-this */ - - /** - * Successor node - * @param{Node} node - * @return {?Node} - */ - SplayTree.prototype.next = function next (node) { - var successor = node; - if (successor) { - if (successor.right) { - successor = successor.right; - while (successor && successor.left) { successor = successor.left; } - } else { - successor = node.parent; - while (successor && successor.right === node) { - node = successor; successor = successor.parent; - } - } - } - return successor; - }; - - - /** - * Predecessor node - * @param{Node} node - * @return {?Node} - */ - SplayTree.prototype.prev = function prev (node) { - var predecessor = node; - if (predecessor) { - if (predecessor.left) { - predecessor = predecessor.left; - while (predecessor && predecessor.right) { predecessor = predecessor.right; } - } else { - predecessor = node.parent; - while (predecessor && predecessor.left === node) { - node = predecessor; - predecessor = predecessor.parent; - } - } - } - return predecessor; - }; - /* eslint-enable class-methods-use-this */ - - - /** - * @param{forEachCallback} callback - * @return {SplayTree} - */ - SplayTree.prototype.forEach = function forEach (callback) { - var current = this._root; - var s = [], done = false, i = 0; - - while (!done) { - // Reach the left most Node of the current Node - if (current) { - // Place pointer to a tree node on the stack - // before traversing the node's left subtree - s.push(current); - current = current.left; - } else { - // BackTrack from the empty subtree and visit the Node - // at the top of the stack; however, if the stack is - // empty you are done - if (s.length > 0) { - current = s.pop(); - callback(current, i++); - - // We have visited the node and its left - // subtree. Now, it's right subtree's turn - current = current.right; - } else { done = true; } - } - } - return this; - }; - - - /** - * Walk key range from `low` to `high`. Stops if `fn` returns a value. - * @param{Key} low - * @param{Key} high - * @param{Function} fn - * @param{*?} ctx - * @return {SplayTree} - */ - SplayTree.prototype.range = function range (low, high, fn, ctx) { - var Q = []; - var compare = this._compare; - var node = this._root, cmp; - - while (Q.length !== 0 || node) { - if (node) { - Q.push(node); - node = node.left; - } else { - node = Q.pop(); - cmp = compare(node.key, high); - if (cmp > 0) { - break; - } else if (compare(node.key, low) >= 0) { - if (fn.call(ctx, node)) { return this; } // stop if smth is returned - } - node = node.right; - } - } - return this; - }; - - /** - * Returns all keys in order - * @return {Array} - */ - SplayTree.prototype.keys = function keys () { - var current = this._root; - var s = [], r = [], done = false; - - while (!done) { - if (current) { - s.push(current); - current = current.left; - } else { - if (s.length > 0) { - current = s.pop(); - r.push(current.key); - current = current.right; - } else { done = true; } - } - } - return r; - }; - - - /** - * Returns `data` fields of all nodes in order. - * @return {Array} - */ - SplayTree.prototype.values = function values () { - var current = this._root; - var s = [], r = [], done = false; - - while (!done) { - if (current) { - s.push(current); - current = current.left; - } else { - if (s.length > 0) { - current = s.pop(); - r.push(current.data); - current = current.right; - } else { done = true; } - } - } - return r; - }; - - - /** - * Returns node at given index - * @param{number} index - * @return {?Node} - */ - SplayTree.prototype.at = function at (index) { - // removed after a consideration, more misleading than useful - // index = index % this.size; - // if (index < 0) index = this.size - index; - - var current = this._root; - var s = [], done = false, i = 0; - - while (!done) { - if (current) { - s.push(current); - current = current.left; - } else { - if (s.length > 0) { - current = s.pop(); - if (i === index) { return current; } - i++; - current = current.right; - } else { done = true; } - } - } - return null; - }; - - /** - * Bulk-load items. Both array have to be same size - * @param{Array} keys - * @param{Array}[values] - * @param{Boolean} [presort=false] Pre-sort keys and values, using - * tree's comparator. Sorting is done - * in-place - * @return {AVLTree} - */ - SplayTree.prototype.load = function load (keys, values, presort) { - if ( keys === void 0 ) keys = []; - if ( values === void 0 ) values = []; - if ( presort === void 0 ) presort = false; - - if (this._size !== 0) { throw new Error('bulk-load: tree is not empty'); } - var size = keys.length; - if (presort) { sort(keys, values, 0, size - 1, this._compare); } - this._root = loadRecursive(null, keys, values, 0, size); - this._size = size; - return this; - }; - - - SplayTree.prototype.min = function min () { - var node = this.minNode(this._root); - if (node) { return node.key; } - else { return null; } - }; - - - SplayTree.prototype.max = function max () { - var node = this.maxNode(this._root); - if (node) { return node.key; } - else { return null; } - }; - - SplayTree.prototype.isEmpty = function isEmpty () { return this._root === null; }; - prototypeAccessors.size.get = function () { return this._size; }; - - - /** - * Create a tree and load it with items - * @param{Array} keys - * @param{Array?} [values] - - * @param{Function?} [comparator] - * @param{Boolean?} [presort=false] Pre-sort keys and values, using - * tree's comparator. Sorting is done - * in-place - * @param{Boolean?} [noDuplicates=false] Allow duplicates - * @return {SplayTree} - */ - SplayTree.createTree = function createTree (keys, values, comparator, presort, noDuplicates) { - return new SplayTree(comparator, noDuplicates).load(keys, values, presort); - }; - - Object.defineProperties( SplayTree.prototype, prototypeAccessors ); - - - function loadRecursive (parent, keys, values, start, end) { - var size = end - start; - if (size > 0) { - var middle = start + Math.floor(size / 2); - var key = keys[middle]; - var data = values[middle]; - var node = { key: key, data: data, parent: parent }; - node.left = loadRecursive(node, keys, values, start, middle); - node.right = loadRecursive(node, keys, values, middle + 1, end); - return node; - } - return null; - } - - - function sort(keys, values, left, right, compare) { - if (left >= right) { return; } - - var pivot = keys[(left + right) >> 1]; - var i = left - 1; - var j = right + 1; - - while (true) { - do { i++; } while (compare(keys[i], pivot) < 0); - do { j--; } while (compare(keys[j], pivot) > 0); - if (i >= j) { break; } - - var tmp = keys[i]; - keys[i] = keys[j]; - keys[j] = tmp; - - tmp = values[i]; - values[i] = values[j]; - values[j] = tmp; - } - - sort(keys, values, left, j, compare); - sort(keys, values, j + 1, right, compare); - } - - var NORMAL = 0; - var NON_CONTRIBUTING = 1; - var SAME_TRANSITION = 2; - var DIFFERENT_TRANSITION = 3; - - var INTERSECTION = 0; - var UNION = 1; - var DIFFERENCE = 2; - var XOR = 3; - - /** - * @param {SweepEvent} event - * @param {SweepEvent} prev - * @param {Operation} operation - */ - function computeFields (event, prev, operation) { - // compute inOut and otherInOut fields - if (prev === null) { - event.inOut = false; - event.otherInOut = true; - - // previous line segment in sweepline belongs to the same polygon - } else { - if (event.isSubject === prev.isSubject) { - event.inOut = !prev.inOut; - event.otherInOut = prev.otherInOut; - - // previous line segment in sweepline belongs to the clipping polygon - } else { - event.inOut = !prev.otherInOut; - event.otherInOut = prev.isVertical() ? !prev.inOut : prev.inOut; - } - - // compute prevInResult field - if (prev) { - event.prevInResult = (!inResult(prev, operation) || prev.isVertical()) - ? prev.prevInResult : prev; - } - } - - // check if the line segment belongs to the Boolean operation - var isInResult = inResult(event, operation); - if (isInResult) { - event.resultTransition = determineResultTransition(event, operation); - } else { - event.resultTransition = 0; - } - } - - - /* eslint-disable indent */ - function inResult(event, operation) { - switch (event.type) { - case NORMAL: - switch (operation) { - case INTERSECTION: - return !event.otherInOut; - case UNION: - return event.otherInOut; - case DIFFERENCE: - // return (event.isSubject && !event.otherInOut) || - // (!event.isSubject && event.otherInOut); - return (event.isSubject && event.otherInOut) || - (!event.isSubject && !event.otherInOut); - case XOR: - return true; - } - break; - case SAME_TRANSITION: - return operation === INTERSECTION || operation === UNION; - case DIFFERENT_TRANSITION: - return operation === DIFFERENCE; - case NON_CONTRIBUTING: - return false; - } - return false; - } - /* eslint-enable indent */ - - - function determineResultTransition(event, operation) { - var thisIn = !event.inOut; - var thatIn = !event.otherInOut; - - var isIn; - switch (operation) { - case INTERSECTION: - isIn = thisIn && thatIn; break; - case UNION: - isIn = thisIn || thatIn; break; - case XOR: - isIn = thisIn ^ thatIn; break; - case DIFFERENCE: - if (event.isSubject) { - isIn = thisIn && !thatIn; - } else { - isIn = thatIn && !thisIn; - } - break; - } - return isIn ? +1 : -1; - } - - var SweepEvent = function SweepEvent (point, left, otherEvent, isSubject, edgeType) { - - /** - * Is left endpoint? - * @type {Boolean} - */ - this.left = left; - - /** - * @type {Array.} - */ - this.point = point; - - /** - * Other edge reference - * @type {SweepEvent} - */ - this.otherEvent = otherEvent; - - /** - * Belongs to source or clipping polygon - * @type {Boolean} - */ - this.isSubject = isSubject; - - /** - * Edge contribution type - * @type {Number} - */ - this.type = edgeType || NORMAL; - - - /** - * In-out transition for the sweepline crossing polygon - * @type {Boolean} - */ - this.inOut = false; - - - /** - * @type {Boolean} - */ - this.otherInOut = false; - - /** - * Previous event in result? - * @type {SweepEvent} - */ - this.prevInResult = null; - - /** - * Type of result transition (0 = not in result, +1 = out-in, -1, in-out) - * @type {Number} - */ - this.resultTransition = 0; - - // connection step - - /** - * @type {Number} - */ - this.otherPos = -1; - - /** - * @type {Number} - */ - this.outputContourId = -1; - - this.isExteriorRing = true; // TODO: Looks unused, remove? - }; - - var prototypeAccessors$1 = { inResult: { configurable: true } }; - - - /** - * @param{Array.}p - * @return {Boolean} - */ - SweepEvent.prototype.isBelow = function isBelow (p) { - var p0 = this.point, p1 = this.otherEvent.point; - return this.left - ? (p0[0] - p[0]) * (p1[1] - p[1]) - (p1[0] - p[0]) * (p0[1] - p[1]) > 0 - // signedArea(this.point, this.otherEvent.point, p) > 0 : - : (p1[0] - p[0]) * (p0[1] - p[1]) - (p0[0] - p[0]) * (p1[1] - p[1]) > 0; - //signedArea(this.otherEvent.point, this.point, p) > 0; - }; - - - /** - * @param{Array.}p - * @return {Boolean} - */ - SweepEvent.prototype.isAbove = function isAbove (p) { - return !this.isBelow(p); - }; - - - /** - * @return {Boolean} - */ - SweepEvent.prototype.isVertical = function isVertical () { - return this.point[0] === this.otherEvent.point[0]; - }; - - - /** - * Does event belong to result? - * @return {Boolean} - */ - prototypeAccessors$1.inResult.get = function () { - return this.resultTransition !== 0; - }; - - - SweepEvent.prototype.clone = function clone () { - var copy = new SweepEvent( - this.point, this.left, this.otherEvent, this.isSubject, this.type); - - copy.contourId = this.contourId; - copy.resultTransition = this.resultTransition; - copy.prevInResult = this.prevInResult; - copy.isExteriorRing = this.isExteriorRing; - copy.inOut = this.inOut; - copy.otherInOut = this.otherInOut; - - return copy; - }; - - Object.defineProperties( SweepEvent.prototype, prototypeAccessors$1 ); - - function equals(p1, p2) { - if (p1[0] === p2[0]) { - if (p1[1] === p2[1]) { - return true; - } else { - return false; - } - } - return false; - } - - // const EPSILON = 1e-9; - // const abs = Math.abs; - // TODO https://github.com/w8r/martinez/issues/6#issuecomment-262847164 - // Precision problem. - // - // module.exports = function equals(p1, p2) { - // return abs(p1[0] - p2[0]) <= EPSILON && abs(p1[1] - p2[1]) <= EPSILON; - // }; - - var epsilon = 1.1102230246251565e-16; - var splitter = 134217729; - var resulterrbound = (3 + 8 * epsilon) * epsilon; - - // fast_expansion_sum_zeroelim routine from oritinal code - function sum(elen, e, flen, f, h) { - var Q, Qnew, hh, bvirt; - var enow = e[0]; - var fnow = f[0]; - var eindex = 0; - var findex = 0; - if ((fnow > enow) === (fnow > -enow)) { - Q = enow; - enow = e[++eindex]; - } else { - Q = fnow; - fnow = f[++findex]; - } - var hindex = 0; - if (eindex < elen && findex < flen) { - if ((fnow > enow) === (fnow > -enow)) { - Qnew = enow + Q; - hh = Q - (Qnew - enow); - enow = e[++eindex]; - } else { - Qnew = fnow + Q; - hh = Q - (Qnew - fnow); - fnow = f[++findex]; - } - Q = Qnew; - if (hh !== 0) { - h[hindex++] = hh; - } - while (eindex < elen && findex < flen) { - if ((fnow > enow) === (fnow > -enow)) { - Qnew = Q + enow; - bvirt = Qnew - Q; - hh = Q - (Qnew - bvirt) + (enow - bvirt); - enow = e[++eindex]; - } else { - Qnew = Q + fnow; - bvirt = Qnew - Q; - hh = Q - (Qnew - bvirt) + (fnow - bvirt); - fnow = f[++findex]; - } - Q = Qnew; - if (hh !== 0) { - h[hindex++] = hh; - } - } - } - while (eindex < elen) { - Qnew = Q + enow; - bvirt = Qnew - Q; - hh = Q - (Qnew - bvirt) + (enow - bvirt); - enow = e[++eindex]; - Q = Qnew; - if (hh !== 0) { - h[hindex++] = hh; - } - } - while (findex < flen) { - Qnew = Q + fnow; - bvirt = Qnew - Q; - hh = Q - (Qnew - bvirt) + (fnow - bvirt); - fnow = f[++findex]; - Q = Qnew; - if (hh !== 0) { - h[hindex++] = hh; - } - } - if (Q !== 0 || hindex === 0) { - h[hindex++] = Q; - } - return hindex; - } - - function estimate(elen, e) { - var Q = e[0]; - for (var i = 1; i < elen; i++) { Q += e[i]; } - return Q; - } - - function vec(n) { - return new Float64Array(n); - } - - var ccwerrboundA = (3 + 16 * epsilon) * epsilon; - var ccwerrboundB = (2 + 12 * epsilon) * epsilon; - var ccwerrboundC = (9 + 64 * epsilon) * epsilon * epsilon; - - var B = vec(4); - var C1 = vec(8); - var C2 = vec(12); - var D = vec(16); - var u = vec(4); - - function orient2dadapt(ax, ay, bx, by, cx, cy, detsum) { - var acxtail, acytail, bcxtail, bcytail; - var bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3; - - var acx = ax - cx; - var bcx = bx - cx; - var acy = ay - cy; - var bcy = by - cy; - - s1 = acx * bcy; - c = splitter * acx; - ahi = c - (c - acx); - alo = acx - ahi; - c = splitter * bcy; - bhi = c - (c - bcy); - blo = bcy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = acy * bcx; - c = splitter * acy; - ahi = c - (c - acy); - alo = acy - ahi; - c = splitter * bcx; - bhi = c - (c - bcx); - blo = bcx - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - B[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - B[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - B[2] = _j - (u3 - bvirt) + (_i - bvirt); - B[3] = u3; - - var det = estimate(4, B); - var errbound = ccwerrboundB * detsum; - if (det >= errbound || -det >= errbound) { - return det; - } - - bvirt = ax - acx; - acxtail = ax - (acx + bvirt) + (bvirt - cx); - bvirt = bx - bcx; - bcxtail = bx - (bcx + bvirt) + (bvirt - cx); - bvirt = ay - acy; - acytail = ay - (acy + bvirt) + (bvirt - cy); - bvirt = by - bcy; - bcytail = by - (bcy + bvirt) + (bvirt - cy); - - if (acxtail === 0 && acytail === 0 && bcxtail === 0 && bcytail === 0) { - return det; - } - - errbound = ccwerrboundC * detsum + resulterrbound * Math.abs(det); - det += (acx * bcytail + bcy * acxtail) - (acy * bcxtail + bcx * acytail); - if (det >= errbound || -det >= errbound) { return det; } - - s1 = acxtail * bcy; - c = splitter * acxtail; - ahi = c - (c - acxtail); - alo = acxtail - ahi; - c = splitter * bcy; - bhi = c - (c - bcy); - blo = bcy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = acytail * bcx; - c = splitter * acytail; - ahi = c - (c - acytail); - alo = acytail - ahi; - c = splitter * bcx; - bhi = c - (c - bcx); - blo = bcx - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - u[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - u[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - u[2] = _j - (u3 - bvirt) + (_i - bvirt); - u[3] = u3; - var C1len = sum(4, B, 4, u, C1); - - s1 = acx * bcytail; - c = splitter * acx; - ahi = c - (c - acx); - alo = acx - ahi; - c = splitter * bcytail; - bhi = c - (c - bcytail); - blo = bcytail - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = acy * bcxtail; - c = splitter * acy; - ahi = c - (c - acy); - alo = acy - ahi; - c = splitter * bcxtail; - bhi = c - (c - bcxtail); - blo = bcxtail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - u[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - u[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - u[2] = _j - (u3 - bvirt) + (_i - bvirt); - u[3] = u3; - var C2len = sum(C1len, C1, 4, u, C2); - - s1 = acxtail * bcytail; - c = splitter * acxtail; - ahi = c - (c - acxtail); - alo = acxtail - ahi; - c = splitter * bcytail; - bhi = c - (c - bcytail); - blo = bcytail - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = acytail * bcxtail; - c = splitter * acytail; - ahi = c - (c - acytail); - alo = acytail - ahi; - c = splitter * bcxtail; - bhi = c - (c - bcxtail); - blo = bcxtail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - u[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - u[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - u[2] = _j - (u3 - bvirt) + (_i - bvirt); - u[3] = u3; - var Dlen = sum(C2len, C2, 4, u, D); - - return D[Dlen - 1]; - } - - function orient2d(ax, ay, bx, by, cx, cy) { - var detleft = (ay - cy) * (bx - cx); - var detright = (ax - cx) * (by - cy); - var det = detleft - detright; - - if (detleft === 0 || detright === 0 || (detleft > 0) !== (detright > 0)) { return det; } - - var detsum = Math.abs(detleft + detright); - if (Math.abs(det) >= ccwerrboundA * detsum) { return det; } - - return -orient2dadapt(ax, ay, bx, by, cx, cy, detsum); - } - - /** - * Signed area of the triangle (p0, p1, p2) - * @param {Array.} p0 - * @param {Array.} p1 - * @param {Array.} p2 - * @return {Number} - */ - function signedArea(p0, p1, p2) { - var res = orient2d(p0[0], p0[1], p1[0], p1[1], p2[0], p2[1]); - if (res > 0) { return -1; } - if (res < 0) { return 1; } - return 0; - } - - /** - * @param {SweepEvent} e1 - * @param {SweepEvent} e2 - * @return {Number} - */ - function compareEvents(e1, e2) { - var p1 = e1.point; - var p2 = e2.point; - - // Different x-coordinate - if (p1[0] > p2[0]) { return 1; } - if (p1[0] < p2[0]) { return -1; } - - // Different points, but same x-coordinate - // Event with lower y-coordinate is processed first - if (p1[1] !== p2[1]) { return p1[1] > p2[1] ? 1 : -1; } - - return specialCases(e1, e2, p1); - } - - - /* eslint-disable no-unused-vars */ - function specialCases(e1, e2, p1, p2) { - // Same coordinates, but one is a left endpoint and the other is - // a right endpoint. The right endpoint is processed first - if (e1.left !== e2.left) - { return e1.left ? 1 : -1; } - - // const p2 = e1.otherEvent.point, p3 = e2.otherEvent.point; - // const sa = (p1[0] - p3[0]) * (p2[1] - p3[1]) - (p2[0] - p3[0]) * (p1[1] - p3[1]) - // Same coordinates, both events - // are left endpoints or right endpoints. - // not collinear - if (signedArea(p1, e1.otherEvent.point, e2.otherEvent.point) !== 0) { - // the event associate to the bottom segment is processed first - return (!e1.isBelow(e2.otherEvent.point)) ? 1 : -1; - } - - return (!e1.isSubject && e2.isSubject) ? 1 : -1; - } - /* eslint-enable no-unused-vars */ - - /** - * @param {SweepEvent} se - * @param {Array.} p - * @param {Queue} queue - * @return {Queue} - */ - function divideSegment(se, p, queue) { - var r = new SweepEvent(p, false, se, se.isSubject); - var l = new SweepEvent(p, true, se.otherEvent, se.isSubject); - - /* eslint-disable no-console */ - if (equals(se.point, se.otherEvent.point)) { - console.warn('what is that, a collapsed segment?', se); - } - /* eslint-enable no-console */ - - r.contourId = l.contourId = se.contourId; - - // avoid a rounding error. The left event would be processed after the right event - if (compareEvents(l, se.otherEvent) > 0) { - se.otherEvent.left = true; - l.left = false; - } - - // avoid a rounding error. The left event would be processed after the right event - // if (compareEvents(se, r) > 0) {} - - se.otherEvent.otherEvent = l; - se.otherEvent = r; - - queue.push(l); - queue.push(r); - - return queue; - } - - //const EPS = 1e-9; - - /** - * Finds the magnitude of the cross product of two vectors (if we pretend - * they're in three dimensions) - * - * @param {Object} a First vector - * @param {Object} b Second vector - * @private - * @returns {Number} The magnitude of the cross product - */ - function crossProduct(a, b) { - return (a[0] * b[1]) - (a[1] * b[0]); - } - - /** - * Finds the dot product of two vectors. - * - * @param {Object} a First vector - * @param {Object} b Second vector - * @private - * @returns {Number} The dot product - */ - function dotProduct(a, b) { - return (a[0] * b[0]) + (a[1] * b[1]); - } - - /** - * Finds the intersection (if any) between two line segments a and b, given the - * line segments' end points a1, a2 and b1, b2. - * - * This algorithm is based on Schneider and Eberly. - * http://www.cimec.org.ar/~ncalvo/Schneider_Eberly.pdf - * Page 244. - * - * @param {Array.} a1 point of first line - * @param {Array.} a2 point of first line - * @param {Array.} b1 point of second line - * @param {Array.} b2 point of second line - * @param {Boolean=} noEndpointTouch whether to skip single touchpoints - * (meaning connected segments) as - * intersections - * @returns {Array.>|Null} If the lines intersect, the point of - * intersection. If they overlap, the two end points of the overlapping segment. - * Otherwise, null. - */ - function intersection (a1, a2, b1, b2, noEndpointTouch) { - // The algorithm expects our lines in the form P + sd, where P is a point, - // s is on the interval [0, 1], and d is a vector. - // We are passed two points. P can be the first point of each pair. The - // vector, then, could be thought of as the distance (in x and y components) - // from the first point to the second point. - // So first, let's make our vectors: - var va = [a2[0] - a1[0], a2[1] - a1[1]]; - var vb = [b2[0] - b1[0], b2[1] - b1[1]]; - // We also define a function to convert back to regular point form: - - /* eslint-disable arrow-body-style */ - - function toPoint(p, s, d) { - return [ - p[0] + s * d[0], - p[1] + s * d[1] - ]; - } - - /* eslint-enable arrow-body-style */ - - // The rest is pretty much a straight port of the algorithm. - var e = [b1[0] - a1[0], b1[1] - a1[1]]; - var kross = crossProduct(va, vb); - var sqrKross = kross * kross; - var sqrLenA = dotProduct(va, va); - //const sqrLenB = dotProduct(vb, vb); - - // Check for line intersection. This works because of the properties of the - // cross product -- specifically, two vectors are parallel if and only if the - // cross product is the 0 vector. The full calculation involves relative error - // to account for possible very small line segments. See Schneider & Eberly - // for details. - if (sqrKross > 0/* EPS * sqrLenB * sqLenA */) { - // If they're not parallel, then (because these are line segments) they - // still might not actually intersect. This code checks that the - // intersection point of the lines is actually on both line segments. - var s = crossProduct(e, vb) / kross; - if (s < 0 || s > 1) { - // not on line segment a - return null; - } - var t = crossProduct(e, va) / kross; - if (t < 0 || t > 1) { - // not on line segment b - return null; - } - if (s === 0 || s === 1) { - // on an endpoint of line segment a - return noEndpointTouch ? null : [toPoint(a1, s, va)]; - } - if (t === 0 || t === 1) { - // on an endpoint of line segment b - return noEndpointTouch ? null : [toPoint(b1, t, vb)]; - } - return [toPoint(a1, s, va)]; - } - - // If we've reached this point, then the lines are either parallel or the - // same, but the segments could overlap partially or fully, or not at all. - // So we need to find the overlap, if any. To do that, we can use e, which is - // the (vector) difference between the two initial points. If this is parallel - // with the line itself, then the two lines are the same line, and there will - // be overlap. - //const sqrLenE = dotProduct(e, e); - kross = crossProduct(e, va); - sqrKross = kross * kross; - - if (sqrKross > 0 /* EPS * sqLenB * sqLenE */) { - // Lines are just parallel, not the same. No overlap. - return null; - } - - var sa = dotProduct(va, e) / sqrLenA; - var sb = sa + dotProduct(va, vb) / sqrLenA; - var smin = Math.min(sa, sb); - var smax = Math.max(sa, sb); - - // this is, essentially, the FindIntersection acting on floats from - // Schneider & Eberly, just inlined into this function. - if (smin <= 1 && smax >= 0) { - - // overlap on an end point - if (smin === 1) { - return noEndpointTouch ? null : [toPoint(a1, smin > 0 ? smin : 0, va)]; - } - - if (smax === 0) { - return noEndpointTouch ? null : [toPoint(a1, smax < 1 ? smax : 1, va)]; - } - - if (noEndpointTouch && smin === 0 && smax === 1) { return null; } - - // There's overlap on a segment -- two points of intersection. Return both. - return [ - toPoint(a1, smin > 0 ? smin : 0, va), - toPoint(a1, smax < 1 ? smax : 1, va) - ]; - } - - return null; - } - - /** - * @param {SweepEvent} se1 - * @param {SweepEvent} se2 - * @param {Queue} queue - * @return {Number} - */ - function possibleIntersection (se1, se2, queue) { - // that disallows self-intersecting polygons, - // did cost us half a day, so I'll leave it - // out of respect - // if (se1.isSubject === se2.isSubject) return; - var inter = intersection( - se1.point, se1.otherEvent.point, - se2.point, se2.otherEvent.point - ); - - var nintersections = inter ? inter.length : 0; - if (nintersections === 0) { return 0; } // no intersection - - // the line segments intersect at an endpoint of both line segments - if ((nintersections === 1) && - (equals(se1.point, se2.point) || - equals(se1.otherEvent.point, se2.otherEvent.point))) { - return 0; - } - - if (nintersections === 2 && se1.isSubject === se2.isSubject) { - // if(se1.contourId === se2.contourId){ - // console.warn('Edges of the same polygon overlap', - // se1.point, se1.otherEvent.point, se2.point, se2.otherEvent.point); - // } - //throw new Error('Edges of the same polygon overlap'); - return 0; - } - - // The line segments associated to se1 and se2 intersect - if (nintersections === 1) { - - // if the intersection point is not an endpoint of se1 - if (!equals(se1.point, inter[0]) && !equals(se1.otherEvent.point, inter[0])) { - divideSegment(se1, inter[0], queue); - } - - // if the intersection point is not an endpoint of se2 - if (!equals(se2.point, inter[0]) && !equals(se2.otherEvent.point, inter[0])) { - divideSegment(se2, inter[0], queue); - } - return 1; - } - - // The line segments associated to se1 and se2 overlap - var events = []; - var leftCoincide = false; - var rightCoincide = false; - - if (equals(se1.point, se2.point)) { - leftCoincide = true; // linked - } else if (compareEvents(se1, se2) === 1) { - events.push(se2, se1); - } else { - events.push(se1, se2); - } - - if (equals(se1.otherEvent.point, se2.otherEvent.point)) { - rightCoincide = true; - } else if (compareEvents(se1.otherEvent, se2.otherEvent) === 1) { - events.push(se2.otherEvent, se1.otherEvent); - } else { - events.push(se1.otherEvent, se2.otherEvent); - } - - if ((leftCoincide && rightCoincide) || leftCoincide) { - // both line segments are equal or share the left endpoint - se2.type = NON_CONTRIBUTING; - se1.type = (se2.inOut === se1.inOut) - ? SAME_TRANSITION : DIFFERENT_TRANSITION; - - if (leftCoincide && !rightCoincide) { - // honestly no idea, but changing events selection from [2, 1] - // to [0, 1] fixes the overlapping self-intersecting polygons issue - divideSegment(events[1].otherEvent, events[0].point, queue); - } - return 2; - } - - // the line segments share the right endpoint - if (rightCoincide) { - divideSegment(events[0], events[1].point, queue); - return 3; - } - - // no line segment includes totally the other one - if (events[0] !== events[3].otherEvent) { - divideSegment(events[0], events[1].point, queue); - divideSegment(events[1], events[2].point, queue); - return 3; - } - - // one line segment includes the other one - divideSegment(events[0], events[1].point, queue); - divideSegment(events[3].otherEvent, events[2].point, queue); - - return 3; - } - - /** - * @param {SweepEvent} le1 - * @param {SweepEvent} le2 - * @return {Number} - */ - function compareSegments(le1, le2) { - if (le1 === le2) { return 0; } - - // Segments are not collinear - if (signedArea(le1.point, le1.otherEvent.point, le2.point) !== 0 || - signedArea(le1.point, le1.otherEvent.point, le2.otherEvent.point) !== 0) { - - // If they share their left endpoint use the right endpoint to sort - if (equals(le1.point, le2.point)) { return le1.isBelow(le2.otherEvent.point) ? -1 : 1; } - - // Different left endpoint: use the left endpoint to sort - if (le1.point[0] === le2.point[0]) { return le1.point[1] < le2.point[1] ? -1 : 1; } - - // has the line segment associated to e1 been inserted - // into S after the line segment associated to e2 ? - if (compareEvents(le1, le2) === 1) { return le2.isAbove(le1.point) ? -1 : 1; } - - // The line segment associated to e2 has been inserted - // into S after the line segment associated to e1 - return le1.isBelow(le2.point) ? -1 : 1; - } - - if (le1.isSubject === le2.isSubject) { // same polygon - var p1 = le1.point, p2 = le2.point; - if (p1[0] === p2[0] && p1[1] === p2[1]/*equals(le1.point, le2.point)*/) { - p1 = le1.otherEvent.point; p2 = le2.otherEvent.point; - if (p1[0] === p2[0] && p1[1] === p2[1]) { return 0; } - else { return le1.contourId > le2.contourId ? 1 : -1; } - } - } else { // Segments are collinear, but belong to separate polygons - return le1.isSubject ? -1 : 1; - } - - return compareEvents(le1, le2) === 1 ? 1 : -1; - } - - function subdivide(eventQueue, subject, clipping, sbbox, cbbox, operation) { - var sweepLine = new SplayTree(compareSegments); - var sortedEvents = []; - - var rightbound = Math.min(sbbox[2], cbbox[2]); - - var prev, next, begin; - - while (eventQueue.length !== 0) { - var event = eventQueue.pop(); - sortedEvents.push(event); - - // optimization by bboxes for intersection and difference goes here - if ((operation === INTERSECTION && event.point[0] > rightbound) || - (operation === DIFFERENCE && event.point[0] > sbbox[2])) { - break; - } - - if (event.left) { - next = prev = sweepLine.insert(event); - begin = sweepLine.minNode(); - - if (prev !== begin) { prev = sweepLine.prev(prev); } - else { prev = null; } - - next = sweepLine.next(next); - - var prevEvent = prev ? prev.key : null; - var prevprevEvent = (void 0); - computeFields(event, prevEvent, operation); - if (next) { - if (possibleIntersection(event, next.key, eventQueue) === 2) { - computeFields(event, prevEvent, operation); - computeFields(event, next.key, operation); - } - } - - if (prev) { - if (possibleIntersection(prev.key, event, eventQueue) === 2) { - var prevprev = prev; - if (prevprev !== begin) { prevprev = sweepLine.prev(prevprev); } - else { prevprev = null; } - - prevprevEvent = prevprev ? prevprev.key : null; - computeFields(prevEvent, prevprevEvent, operation); - computeFields(event, prevEvent, operation); - } - } - } else { - event = event.otherEvent; - next = prev = sweepLine.find(event); - - if (prev && next) { - - if (prev !== begin) { prev = sweepLine.prev(prev); } - else { prev = null; } - - next = sweepLine.next(next); - sweepLine.remove(event); - - if (next && prev) { - possibleIntersection(prev.key, next.key, eventQueue); - } - } - } - } - return sortedEvents; - } - - var Contour = function Contour() { - this.points = []; - this.holeIds = []; - this.holeOf = null; - this.depth = null; - }; - - Contour.prototype.isExterior = function isExterior () { - return this.holeOf == null; - }; - - /** - * @param {Array.} sortedEvents - * @return {Array.} - */ - function orderEvents(sortedEvents) { - var event, i, len, tmp; - var resultEvents = []; - for (i = 0, len = sortedEvents.length; i < len; i++) { - event = sortedEvents[i]; - if ((event.left && event.inResult) || - (!event.left && event.otherEvent.inResult)) { - resultEvents.push(event); - } - } - // Due to overlapping edges the resultEvents array can be not wholly sorted - var sorted = false; - while (!sorted) { - sorted = true; - for (i = 0, len = resultEvents.length; i < len; i++) { - if ((i + 1) < len && - compareEvents(resultEvents[i], resultEvents[i + 1]) === 1) { - tmp = resultEvents[i]; - resultEvents[i] = resultEvents[i + 1]; - resultEvents[i + 1] = tmp; - sorted = false; - } - } - } - - - for (i = 0, len = resultEvents.length; i < len; i++) { - event = resultEvents[i]; - event.otherPos = i; - } - - // imagine, the right event is found in the beginning of the queue, - // when his left counterpart is not marked yet - for (i = 0, len = resultEvents.length; i < len; i++) { - event = resultEvents[i]; - if (!event.left) { - tmp = event.otherPos; - event.otherPos = event.otherEvent.otherPos; - event.otherEvent.otherPos = tmp; - } - } - - return resultEvents; - } - - - /** - * @param {Number} pos - * @param {Array.} resultEvents - * @param {Object>} processed - * @return {Number} - */ - function nextPos(pos, resultEvents, processed, origPos) { - var newPos = pos + 1, - p = resultEvents[pos].point, - p1; - var length = resultEvents.length; - - if (newPos < length) - { p1 = resultEvents[newPos].point; } - - while (newPos < length && p1[0] === p[0] && p1[1] === p[1]) { - if (!processed[newPos]) { - return newPos; - } else { - newPos++; - } - p1 = resultEvents[newPos].point; - } - - newPos = pos - 1; - - while (processed[newPos] && newPos > origPos) { - newPos--; - } - - return newPos; - } - - - function initializeContourFromContext(event, contours, contourId) { - var contour = new Contour(); - if (event.prevInResult != null) { - var prevInResult = event.prevInResult; - // Note that it is valid to query the "previous in result" for its output contour id, - // because we must have already processed it (i.e., assigned an output contour id) - // in an earlier iteration, otherwise it wouldn't be possible that it is "previous in - // result". - var lowerContourId = prevInResult.outputContourId; - var lowerResultTransition = prevInResult.resultTransition; - if (lowerResultTransition > 0) { - // We are inside. Now we have to check if the thing below us is another hole or - // an exterior contour. - var lowerContour = contours[lowerContourId]; - if (lowerContour.holeOf != null) { - // The lower contour is a hole => Connect the new contour as a hole to its parent, - // and use same depth. - var parentContourId = lowerContour.holeOf; - contours[parentContourId].holeIds.push(contourId); - contour.holeOf = parentContourId; - contour.depth = contours[lowerContourId].depth; - } else { - // The lower contour is an exterior contour => Connect the new contour as a hole, - // and increment depth. - contours[lowerContourId].holeIds.push(contourId); - contour.holeOf = lowerContourId; - contour.depth = contours[lowerContourId].depth + 1; - } - } else { - // We are outside => this contour is an exterior contour of same depth. - contour.holeOf = null; - contour.depth = contours[lowerContourId].depth; - } - } else { - // There is no lower/previous contour => this contour is an exterior contour of depth 0. - contour.holeOf = null; - contour.depth = 0; - } - return contour; - } - - /** - * @param {Array.} sortedEvents - * @return {Array.<*>} polygons - */ - function connectEdges(sortedEvents) { - var i, len; - var resultEvents = orderEvents(sortedEvents); - - // "false"-filled array - var processed = {}; - var contours = []; - - var loop = function ( ) { - - if (processed[i]) { - return; - } - - var contourId = contours.length; - var contour = initializeContourFromContext(resultEvents[i], contours, contourId); - - // Helper function that combines marking an event as processed with assigning its output contour ID - var markAsProcessed = function (pos) { - processed[pos] = true; - resultEvents[pos].outputContourId = contourId; - }; - - var pos = i; - var origPos = i; - - var initial = resultEvents[i].point; - contour.points.push(initial); - - /* eslint no-constant-condition: "off" */ - while (true) { - markAsProcessed(pos); - - pos = resultEvents[pos].otherPos; - - markAsProcessed(pos); - contour.points.push(resultEvents[pos].point); - - pos = nextPos(pos, resultEvents, processed, origPos); - - if (pos == origPos) { - break; - } - } - - contours.push(contour); - }; - - for (i = 0, len = resultEvents.length; i < len; i++) loop( ); - - return contours; - } - - var tinyqueue = TinyQueue; - var default_1 = TinyQueue; - - function TinyQueue(data, compare) { - if (!(this instanceof TinyQueue)) { return new TinyQueue(data, compare); } - - this.data = data || []; - this.length = this.data.length; - this.compare = compare || defaultCompare; - - if (this.length > 0) { - for (var i = (this.length >> 1) - 1; i >= 0; i--) { this._down(i); } - } - } - - function defaultCompare(a, b) { - return a < b ? -1 : a > b ? 1 : 0; - } - - TinyQueue.prototype = { - - push: function (item) { - this.data.push(item); - this.length++; - this._up(this.length - 1); - }, - - pop: function () { - if (this.length === 0) { return undefined; } - - var top = this.data[0]; - this.length--; - - if (this.length > 0) { - this.data[0] = this.data[this.length]; - this._down(0); - } - this.data.pop(); - - return top; - }, - - peek: function () { - return this.data[0]; - }, - - _up: function (pos) { - var data = this.data; - var compare = this.compare; - var item = data[pos]; - - while (pos > 0) { - var parent = (pos - 1) >> 1; - var current = data[parent]; - if (compare(item, current) >= 0) { break; } - data[pos] = current; - pos = parent; - } - - data[pos] = item; - }, - - _down: function (pos) { - var data = this.data; - var compare = this.compare; - var halfLength = this.length >> 1; - var item = data[pos]; - - while (pos < halfLength) { - var left = (pos << 1) + 1; - var right = left + 1; - var best = data[left]; - - if (right < this.length && compare(data[right], best) < 0) { - left = right; - best = data[right]; - } - if (compare(best, item) >= 0) { break; } - - data[pos] = best; - pos = left; - } - - data[pos] = item; - } - }; - tinyqueue.default = default_1; - - var max = Math.max; - var min = Math.min; - - var contourId = 0; - - - function processPolygon(contourOrHole, isSubject, depth, Q, bbox, isExteriorRing) { - var i, len, s1, s2, e1, e2; - for (i = 0, len = contourOrHole.length - 1; i < len; i++) { - s1 = contourOrHole[i]; - s2 = contourOrHole[i + 1]; - e1 = new SweepEvent(s1, false, undefined, isSubject); - e2 = new SweepEvent(s2, false, e1, isSubject); - e1.otherEvent = e2; - - if (s1[0] === s2[0] && s1[1] === s2[1]) { - continue; // skip collapsed edges, or it breaks - } - - e1.contourId = e2.contourId = depth; - if (!isExteriorRing) { - e1.isExteriorRing = false; - e2.isExteriorRing = false; - } - if (compareEvents(e1, e2) > 0) { - e2.left = true; - } else { - e1.left = true; - } - - var x = s1[0], y = s1[1]; - bbox[0] = min(bbox[0], x); - bbox[1] = min(bbox[1], y); - bbox[2] = max(bbox[2], x); - bbox[3] = max(bbox[3], y); - - // Pushing it so the queue is sorted from left to right, - // with object on the left having the highest priority. - Q.push(e1); - Q.push(e2); - } - } - - - function fillQueue(subject, clipping, sbbox, cbbox, operation) { - var eventQueue = new tinyqueue(null, compareEvents); - var polygonSet, isExteriorRing, i, ii, j, jj; //, k, kk; - - for (i = 0, ii = subject.length; i < ii; i++) { - polygonSet = subject[i]; - for (j = 0, jj = polygonSet.length; j < jj; j++) { - isExteriorRing = j === 0; - if (isExteriorRing) { contourId++; } - processPolygon(polygonSet[j], true, contourId, eventQueue, sbbox, isExteriorRing); - } - } - - for (i = 0, ii = clipping.length; i < ii; i++) { - polygonSet = clipping[i]; - for (j = 0, jj = polygonSet.length; j < jj; j++) { - isExteriorRing = j === 0; - if (operation === DIFFERENCE) { isExteriorRing = false; } - if (isExteriorRing) { contourId++; } - processPolygon(polygonSet[j], false, contourId, eventQueue, cbbox, isExteriorRing); - } - } - - return eventQueue; - } - - var EMPTY = []; - - - function trivialOperation(subject, clipping, operation) { - var result = null; - if (subject.length * clipping.length === 0) { - if (operation === INTERSECTION) { - result = EMPTY; - } else if (operation === DIFFERENCE) { - result = subject; - } else if (operation === UNION || - operation === XOR) { - result = (subject.length === 0) ? clipping : subject; - } - } - return result; - } - - - function compareBBoxes(subject, clipping, sbbox, cbbox, operation) { - var result = null; - if (sbbox[0] > cbbox[2] || - cbbox[0] > sbbox[2] || - sbbox[1] > cbbox[3] || - cbbox[1] > sbbox[3]) { - if (operation === INTERSECTION) { - result = EMPTY; - } else if (operation === DIFFERENCE) { - result = subject; - } else if (operation === UNION || - operation === XOR) { - result = subject.concat(clipping); - } - } - return result; - } - - - function boolean(subject, clipping, operation) { - if (typeof subject[0][0][0] === 'number') { - subject = [subject]; - } - if (typeof clipping[0][0][0] === 'number') { - clipping = [clipping]; - } - var trivial = trivialOperation(subject, clipping, operation); - if (trivial) { - return trivial === EMPTY ? null : trivial; - } - var sbbox = [Infinity, Infinity, -Infinity, -Infinity]; - var cbbox = [Infinity, Infinity, -Infinity, -Infinity]; - - // console.time('fill queue'); - var eventQueue = fillQueue(subject, clipping, sbbox, cbbox, operation); - //console.timeEnd('fill queue'); - - trivial = compareBBoxes(subject, clipping, sbbox, cbbox, operation); - if (trivial) { - return trivial === EMPTY ? null : trivial; - } - // console.time('subdivide edges'); - var sortedEvents = subdivide(eventQueue, subject, clipping, sbbox, cbbox, operation); - //console.timeEnd('subdivide edges'); - - // console.time('connect vertices'); - var contours = connectEdges(sortedEvents); - //console.timeEnd('connect vertices'); - - // Convert contours to polygons - var polygons = []; - for (var i = 0; i < contours.length; i++) { - var contour = contours[i]; - if (contour.isExterior()) { - // The exterior ring goes first - var rings = [contour.points]; - // Followed by holes if any - for (var j = 0; j < contour.holeIds.length; j++) { - var holeId = contour.holeIds[j]; - rings.push(contours[holeId].points); - } - polygons.push(rings); - } - } - - return polygons; - } - - function union (subject, clipping) { - return boolean(subject, clipping, UNION); - } - - function diff (subject, clipping) { - return boolean(subject, clipping, DIFFERENCE); - } - - function xor (subject, clipping) { - return boolean(subject, clipping, XOR); - } - - function intersection$1 (subject, clipping) { - return boolean(subject, clipping, INTERSECTION); - } - - /** - * @enum {Number} - */ - var operations = { UNION: UNION, DIFFERENCE: DIFFERENCE, INTERSECTION: INTERSECTION, XOR: XOR }; - - exports.diff = diff; - exports.intersection = intersection$1; - exports.operations = operations; - exports.union = union; - exports.xor = xor; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); -//# sourceMappingURL=martinez.umd.js.map diff --git a/dist/martinez.umd.js.map b/dist/martinez.umd.js.map deleted file mode 100644 index f841bfb..0000000 --- a/dist/martinez.umd.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"martinez.umd.js","sources":["../node_modules/splaytree/index.js","../src/edge_type.js","../src/operation.js","../src/compute_fields.js","../src/sweep_event.js","../src/equals.js","../node_modules/robust-predicates/esm/util.js","../node_modules/robust-predicates/esm/orient2d.js","../src/signed_area.js","../src/compare_events.js","../src/divide_segment.js","../src/segment_intersection.js","../src/possible_intersection.js","../src/compare_segments.js","../src/subdivide_segments.js","../src/contour.js","../src/connect_edges.js","../node_modules/tinyqueue/index.js","../src/fill_queue.js","../src/index.js","../index.js"],"sourcesContent":["function DEFAULT_COMPARE (a, b) { return a > b ? 1 : a < b ? -1 : 0; }\n\nexport default class SplayTree {\n\n constructor(compare = DEFAULT_COMPARE, noDuplicates = false) {\n this._compare = compare;\n this._root = null;\n this._size = 0;\n this._noDuplicates = !!noDuplicates;\n }\n\n\n rotateLeft(x) {\n var y = x.right;\n if (y) {\n x.right = y.left;\n if (y.left) y.left.parent = x;\n y.parent = x.parent;\n }\n\n if (!x.parent) this._root = y;\n else if (x === x.parent.left) x.parent.left = y;\n else x.parent.right = y;\n if (y) y.left = x;\n x.parent = y;\n }\n\n\n rotateRight(x) {\n var y = x.left;\n if (y) {\n x.left = y.right;\n if (y.right) y.right.parent = x;\n y.parent = x.parent;\n }\n\n if (!x.parent) this._root = y;\n else if(x === x.parent.left) x.parent.left = y;\n else x.parent.right = y;\n if (y) y.right = x;\n x.parent = y;\n }\n\n\n _splay(x) {\n while (x.parent) {\n var p = x.parent;\n if (!p.parent) {\n if (p.left === x) this.rotateRight(p);\n else this.rotateLeft(p);\n } else if (p.left === x && p.parent.left === p) {\n this.rotateRight(p.parent);\n this.rotateRight(p);\n } else if (p.right === x && p.parent.right === p) {\n this.rotateLeft(p.parent);\n this.rotateLeft(p);\n } else if (p.left === x && p.parent.right === p) {\n this.rotateRight(p);\n this.rotateLeft(p);\n } else {\n this.rotateLeft(p);\n this.rotateRight(p);\n }\n }\n }\n\n\n splay(x) {\n var p, gp, ggp, l, r;\n\n while (x.parent) {\n p = x.parent;\n gp = p.parent;\n\n if (gp && gp.parent) {\n ggp = gp.parent;\n if (ggp.left === gp) ggp.left = x;\n else ggp.right = x;\n x.parent = ggp;\n } else {\n x.parent = null;\n this._root = x;\n }\n\n l = x.left; r = x.right;\n\n if (x === p.left) { // left\n if (gp) {\n if (gp.left === p) {\n /* zig-zig */\n if (p.right) {\n gp.left = p.right;\n gp.left.parent = gp;\n } else gp.left = null;\n\n p.right = gp;\n gp.parent = p;\n } else {\n /* zig-zag */\n if (l) {\n gp.right = l;\n l.parent = gp;\n } else gp.right = null;\n\n x.left = gp;\n gp.parent = x;\n }\n }\n if (r) {\n p.left = r;\n r.parent = p;\n } else p.left = null;\n\n x.right = p;\n p.parent = x;\n } else { // right\n if (gp) {\n if (gp.right === p) {\n /* zig-zig */\n if (p.left) {\n gp.right = p.left;\n gp.right.parent = gp;\n } else gp.right = null;\n\n p.left = gp;\n gp.parent = p;\n } else {\n /* zig-zag */\n if (r) {\n gp.left = r;\n r.parent = gp;\n } else gp.left = null;\n\n x.right = gp;\n gp.parent = x;\n }\n }\n if (l) {\n p.right = l;\n l.parent = p;\n } else p.right = null;\n\n x.left = p;\n p.parent = x;\n }\n }\n }\n\n\n replace(u, v) {\n if (!u.parent) this._root = v;\n else if (u === u.parent.left) u.parent.left = v;\n else u.parent.right = v;\n if (v) v.parent = u.parent;\n }\n\n\n minNode(u = this._root) {\n if (u) while (u.left) u = u.left;\n return u;\n }\n\n\n maxNode(u = this._root) {\n if (u) while (u.right) u = u.right;\n return u;\n }\n\n\n insert(key, data) {\n var z = this._root;\n var p = null;\n var comp = this._compare;\n var cmp;\n\n if (this._noDuplicates) {\n while (z) {\n p = z;\n cmp = comp(z.key, key);\n if (cmp === 0) return;\n else if (comp(z.key, key) < 0) z = z.right;\n else z = z.left;\n }\n } else {\n while (z) {\n p = z;\n if (comp(z.key, key) < 0) z = z.right;\n else z = z.left;\n }\n }\n\n z = { key, data, left: null, right: null, parent: p };\n\n if (!p) this._root = z;\n else if (comp(p.key, z.key) < 0) p.right = z;\n else p.left = z;\n\n this.splay(z);\n this._size++;\n return z;\n }\n\n\n find (key) {\n var z = this._root;\n var comp = this._compare;\n while (z) {\n var cmp = comp(z.key, key);\n if (cmp < 0) z = z.right;\n else if (cmp > 0) z = z.left;\n else return z;\n }\n return null;\n }\n\n /**\n * Whether the tree contains a node with the given key\n * @param {Key} key\n * @return {boolean} true/false\n */\n contains (key) {\n var node = this._root;\n var comparator = this._compare;\n while (node) {\n var cmp = comparator(key, node.key);\n if (cmp === 0) return true;\n else if (cmp < 0) node = node.left;\n else node = node.right;\n }\n\n return false;\n }\n\n\n remove (key) {\n var z = this.find(key);\n\n if (!z) return false;\n\n this.splay(z);\n\n if (!z.left) this.replace(z, z.right);\n else if (!z.right) this.replace(z, z.left);\n else {\n var y = this.minNode(z.right);\n if (y.parent !== z) {\n this.replace(y, y.right);\n y.right = z.right;\n y.right.parent = y;\n }\n this.replace(z, y);\n y.left = z.left;\n y.left.parent = y;\n }\n\n this._size--;\n return true;\n }\n\n\n removeNode(z) {\n if (!z) return false;\n\n this.splay(z);\n\n if (!z.left) this.replace(z, z.right);\n else if (!z.right) this.replace(z, z.left);\n else {\n var y = this.minNode(z.right);\n if (y.parent !== z) {\n this.replace(y, y.right);\n y.right = z.right;\n y.right.parent = y;\n }\n this.replace(z, y);\n y.left = z.left;\n y.left.parent = y;\n }\n\n this._size--;\n return true;\n }\n\n\n erase (key) {\n var z = this.find(key);\n if (!z) return;\n\n this.splay(z);\n\n var s = z.left;\n var t = z.right;\n\n var sMax = null;\n if (s) {\n s.parent = null;\n sMax = this.maxNode(s);\n this.splay(sMax);\n this._root = sMax;\n }\n if (t) {\n if (s) sMax.right = t;\n else this._root = t;\n t.parent = sMax;\n }\n\n this._size--;\n }\n\n /**\n * Removes and returns the node with smallest key\n * @return {?Node}\n */\n pop () {\n var node = this._root, returnValue = null;\n if (node) {\n while (node.left) node = node.left;\n returnValue = { key: node.key, data: node.data };\n this.remove(node.key);\n }\n return returnValue;\n }\n\n\n /* eslint-disable class-methods-use-this */\n\n /**\n * Successor node\n * @param {Node} node\n * @return {?Node}\n */\n next (node) {\n var successor = node;\n if (successor) {\n if (successor.right) {\n successor = successor.right;\n while (successor && successor.left) successor = successor.left;\n } else {\n successor = node.parent;\n while (successor && successor.right === node) {\n node = successor; successor = successor.parent;\n }\n }\n }\n return successor;\n }\n\n\n /**\n * Predecessor node\n * @param {Node} node\n * @return {?Node}\n */\n prev (node) {\n var predecessor = node;\n if (predecessor) {\n if (predecessor.left) {\n predecessor = predecessor.left;\n while (predecessor && predecessor.right) predecessor = predecessor.right;\n } else {\n predecessor = node.parent;\n while (predecessor && predecessor.left === node) {\n node = predecessor;\n predecessor = predecessor.parent;\n }\n }\n }\n return predecessor;\n }\n /* eslint-enable class-methods-use-this */\n\n\n /**\n * @param {forEachCallback} callback\n * @return {SplayTree}\n */\n forEach(callback) {\n var current = this._root;\n var s = [], done = false, i = 0;\n\n while (!done) {\n // Reach the left most Node of the current Node\n if (current) {\n // Place pointer to a tree node on the stack\n // before traversing the node's left subtree\n s.push(current);\n current = current.left;\n } else {\n // BackTrack from the empty subtree and visit the Node\n // at the top of the stack; however, if the stack is\n // empty you are done\n if (s.length > 0) {\n current = s.pop();\n callback(current, i++);\n\n // We have visited the node and its left\n // subtree. Now, it's right subtree's turn\n current = current.right;\n } else done = true;\n }\n }\n return this;\n }\n\n\n /**\n * Walk key range from `low` to `high`. Stops if `fn` returns a value.\n * @param {Key} low\n * @param {Key} high\n * @param {Function} fn\n * @param {*?} ctx\n * @return {SplayTree}\n */\n range(low, high, fn, ctx) {\n const Q = [];\n const compare = this._compare;\n let node = this._root, cmp;\n\n while (Q.length !== 0 || node) {\n if (node) {\n Q.push(node);\n node = node.left;\n } else {\n node = Q.pop();\n cmp = compare(node.key, high);\n if (cmp > 0) {\n break;\n } else if (compare(node.key, low) >= 0) {\n if (fn.call(ctx, node)) return this; // stop if smth is returned\n }\n node = node.right;\n }\n }\n return this;\n }\n\n /**\n * Returns all keys in order\n * @return {Array}\n */\n keys () {\n var current = this._root;\n var s = [], r = [], done = false;\n\n while (!done) {\n if (current) {\n s.push(current);\n current = current.left;\n } else {\n if (s.length > 0) {\n current = s.pop();\n r.push(current.key);\n current = current.right;\n } else done = true;\n }\n }\n return r;\n }\n\n\n /**\n * Returns `data` fields of all nodes in order.\n * @return {Array}\n */\n values () {\n var current = this._root;\n var s = [], r = [], done = false;\n\n while (!done) {\n if (current) {\n s.push(current);\n current = current.left;\n } else {\n if (s.length > 0) {\n current = s.pop();\n r.push(current.data);\n current = current.right;\n } else done = true;\n }\n }\n return r;\n }\n\n\n /**\n * Returns node at given index\n * @param {number} index\n * @return {?Node}\n */\n at (index) {\n // removed after a consideration, more misleading than useful\n // index = index % this.size;\n // if (index < 0) index = this.size - index;\n\n var current = this._root;\n var s = [], done = false, i = 0;\n\n while (!done) {\n if (current) {\n s.push(current);\n current = current.left;\n } else {\n if (s.length > 0) {\n current = s.pop();\n if (i === index) return current;\n i++;\n current = current.right;\n } else done = true;\n }\n }\n return null;\n }\n\n /**\n * Bulk-load items. Both array have to be same size\n * @param {Array} keys\n * @param {Array} [values]\n * @param {Boolean} [presort=false] Pre-sort keys and values, using\n * tree's comparator. Sorting is done\n * in-place\n * @return {AVLTree}\n */\n load(keys = [], values = [], presort = false) {\n if (this._size !== 0) throw new Error('bulk-load: tree is not empty');\n const size = keys.length;\n if (presort) sort(keys, values, 0, size - 1, this._compare);\n this._root = loadRecursive(null, keys, values, 0, size);\n this._size = size;\n return this;\n }\n\n\n min() {\n var node = this.minNode(this._root);\n if (node) return node.key;\n else return null;\n }\n\n\n max() {\n var node = this.maxNode(this._root);\n if (node) return node.key;\n else return null;\n }\n\n isEmpty() { return this._root === null; }\n get size() { return this._size; }\n\n\n /**\n * Create a tree and load it with items\n * @param {Array} keys\n * @param {Array?} [values]\n\n * @param {Function?} [comparator]\n * @param {Boolean?} [presort=false] Pre-sort keys and values, using\n * tree's comparator. Sorting is done\n * in-place\n * @param {Boolean?} [noDuplicates=false] Allow duplicates\n * @return {SplayTree}\n */\n static createTree(keys, values, comparator, presort, noDuplicates) {\n return new SplayTree(comparator, noDuplicates).load(keys, values, presort);\n }\n}\n\n\nfunction loadRecursive (parent, keys, values, start, end) {\n const size = end - start;\n if (size > 0) {\n const middle = start + Math.floor(size / 2);\n const key = keys[middle];\n const data = values[middle];\n const node = { key, data, parent };\n node.left = loadRecursive(node, keys, values, start, middle);\n node.right = loadRecursive(node, keys, values, middle + 1, end);\n return node;\n }\n return null;\n}\n\n\nfunction sort(keys, values, left, right, compare) {\n if (left >= right) return;\n\n const pivot = keys[(left + right) >> 1];\n let i = left - 1;\n let j = right + 1;\n\n while (true) {\n do i++; while (compare(keys[i], pivot) < 0);\n do j--; while (compare(keys[j], pivot) > 0);\n if (i >= j) break;\n\n let tmp = keys[i];\n keys[i] = keys[j];\n keys[j] = tmp;\n\n tmp = values[i];\n values[i] = values[j];\n values[j] = tmp;\n }\n\n sort(keys, values, left, j, compare);\n sort(keys, values, j + 1, right, compare);\n}\n","export const NORMAL = 0;\nexport const NON_CONTRIBUTING = 1;\nexport const SAME_TRANSITION = 2;\nexport const DIFFERENT_TRANSITION = 3;\n","export const INTERSECTION = 0;\nexport const UNION = 1;\nexport const DIFFERENCE = 2;\nexport const XOR = 3;\n","import {\n NORMAL,\n SAME_TRANSITION,\n DIFFERENT_TRANSITION,\n NON_CONTRIBUTING\n} from './edge_type';\nimport {\n INTERSECTION,\n UNION,\n DIFFERENCE,\n XOR\n} from './operation';\n\n/**\n * @param {SweepEvent} event\n * @param {SweepEvent} prev\n * @param {Operation} operation\n */\nexport default function computeFields (event, prev, operation) {\n // compute inOut and otherInOut fields\n if (prev === null) {\n event.inOut = false;\n event.otherInOut = true;\n\n // previous line segment in sweepline belongs to the same polygon\n } else {\n if (event.isSubject === prev.isSubject) {\n event.inOut = !prev.inOut;\n event.otherInOut = prev.otherInOut;\n\n // previous line segment in sweepline belongs to the clipping polygon\n } else {\n event.inOut = !prev.otherInOut;\n event.otherInOut = prev.isVertical() ? !prev.inOut : prev.inOut;\n }\n\n // compute prevInResult field\n if (prev) {\n event.prevInResult = (!inResult(prev, operation) || prev.isVertical())\n ? prev.prevInResult : prev;\n }\n }\n\n // check if the line segment belongs to the Boolean operation\n let isInResult = inResult(event, operation);\n if (isInResult) {\n event.resultTransition = determineResultTransition(event, operation);\n } else {\n event.resultTransition = 0;\n }\n}\n\n\n/* eslint-disable indent */\nfunction inResult(event, operation) {\n switch (event.type) {\n case NORMAL:\n switch (operation) {\n case INTERSECTION:\n return !event.otherInOut;\n case UNION:\n return event.otherInOut;\n case DIFFERENCE:\n // return (event.isSubject && !event.otherInOut) ||\n // (!event.isSubject && event.otherInOut);\n return (event.isSubject && event.otherInOut) ||\n (!event.isSubject && !event.otherInOut);\n case XOR:\n return true;\n }\n break;\n case SAME_TRANSITION:\n return operation === INTERSECTION || operation === UNION;\n case DIFFERENT_TRANSITION:\n return operation === DIFFERENCE;\n case NON_CONTRIBUTING:\n return false;\n }\n return false;\n}\n/* eslint-enable indent */\n\n\nfunction determineResultTransition(event, operation) {\n let thisIn = !event.inOut;\n let thatIn = !event.otherInOut;\n\n let isIn;\n switch (operation) {\n case INTERSECTION:\n isIn = thisIn && thatIn; break;\n case UNION:\n isIn = thisIn || thatIn; break;\n case XOR:\n isIn = thisIn ^ thatIn; break;\n case DIFFERENCE:\n if (event.isSubject) {\n isIn = thisIn && !thatIn;\n } else {\n isIn = thatIn && !thisIn;\n }\n break;\n }\n return isIn ? +1 : -1;\n}\n","import { NORMAL } from './edge_type';\n\n\nexport default class SweepEvent {\n\n\n /**\n * Sweepline event\n *\n * @class {SweepEvent}\n * @param {Array.} point\n * @param {Boolean} left\n * @param {SweepEvent=} otherEvent\n * @param {Boolean} isSubject\n * @param {Number} edgeType\n */\n constructor (point, left, otherEvent, isSubject, edgeType) {\n\n /**\n * Is left endpoint?\n * @type {Boolean}\n */\n this.left = left;\n\n /**\n * @type {Array.}\n */\n this.point = point;\n\n /**\n * Other edge reference\n * @type {SweepEvent}\n */\n this.otherEvent = otherEvent;\n\n /**\n * Belongs to source or clipping polygon\n * @type {Boolean}\n */\n this.isSubject = isSubject;\n\n /**\n * Edge contribution type\n * @type {Number}\n */\n this.type = edgeType || NORMAL;\n\n\n /**\n * In-out transition for the sweepline crossing polygon\n * @type {Boolean}\n */\n this.inOut = false;\n\n\n /**\n * @type {Boolean}\n */\n this.otherInOut = false;\n\n /**\n * Previous event in result?\n * @type {SweepEvent}\n */\n this.prevInResult = null;\n\n /**\n * Type of result transition (0 = not in result, +1 = out-in, -1, in-out)\n * @type {Number}\n */\n this.resultTransition = 0;\n\n // connection step\n\n /**\n * @type {Number}\n */\n this.otherPos = -1;\n\n /**\n * @type {Number}\n */\n this.outputContourId = -1;\n\n this.isExteriorRing = true; // TODO: Looks unused, remove?\n }\n\n\n /**\n * @param {Array.} p\n * @return {Boolean}\n */\n isBelow (p) {\n const p0 = this.point, p1 = this.otherEvent.point;\n return this.left\n ? (p0[0] - p[0]) * (p1[1] - p[1]) - (p1[0] - p[0]) * (p0[1] - p[1]) > 0\n // signedArea(this.point, this.otherEvent.point, p) > 0 :\n : (p1[0] - p[0]) * (p0[1] - p[1]) - (p0[0] - p[0]) * (p1[1] - p[1]) > 0;\n //signedArea(this.otherEvent.point, this.point, p) > 0;\n }\n\n\n /**\n * @param {Array.} p\n * @return {Boolean}\n */\n isAbove (p) {\n return !this.isBelow(p);\n }\n\n\n /**\n * @return {Boolean}\n */\n isVertical () {\n return this.point[0] === this.otherEvent.point[0];\n }\n\n\n /**\n * Does event belong to result?\n * @return {Boolean}\n */\n get inResult() {\n return this.resultTransition !== 0;\n }\n\n\n clone () {\n const copy = new SweepEvent(\n this.point, this.left, this.otherEvent, this.isSubject, this.type);\n\n copy.contourId = this.contourId;\n copy.resultTransition = this.resultTransition;\n copy.prevInResult = this.prevInResult;\n copy.isExteriorRing = this.isExteriorRing;\n copy.inOut = this.inOut;\n copy.otherInOut = this.otherInOut;\n\n return copy;\n }\n}\n","export default function equals(p1, p2) {\n if (p1[0] === p2[0]) {\n if (p1[1] === p2[1]) {\n return true;\n } else {\n return false;\n }\n }\n return false;\n}\n\n// const EPSILON = 1e-9;\n// const abs = Math.abs;\n// TODO https://github.com/w8r/martinez/issues/6#issuecomment-262847164\n// Precision problem.\n//\n// module.exports = function equals(p1, p2) {\n// return abs(p1[0] - p2[0]) <= EPSILON && abs(p1[1] - p2[1]) <= EPSILON;\n// };\n","export const epsilon = 1.1102230246251565e-16;\nexport const splitter = 134217729;\nexport const resulterrbound = (3 + 8 * epsilon) * epsilon;\n\n// fast_expansion_sum_zeroelim routine from oritinal code\nexport function sum(elen, e, flen, f, h) {\n let Q, Qnew, hh, bvirt;\n let enow = e[0];\n let fnow = f[0];\n let eindex = 0;\n let findex = 0;\n if ((fnow > enow) === (fnow > -enow)) {\n Q = enow;\n enow = e[++eindex];\n } else {\n Q = fnow;\n fnow = f[++findex];\n }\n let hindex = 0;\n if (eindex < elen && findex < flen) {\n if ((fnow > enow) === (fnow > -enow)) {\n Qnew = enow + Q;\n hh = Q - (Qnew - enow);\n enow = e[++eindex];\n } else {\n Qnew = fnow + Q;\n hh = Q - (Qnew - fnow);\n fnow = f[++findex];\n }\n Q = Qnew;\n if (hh !== 0) {\n h[hindex++] = hh;\n }\n while (eindex < elen && findex < flen) {\n if ((fnow > enow) === (fnow > -enow)) {\n Qnew = Q + enow;\n bvirt = Qnew - Q;\n hh = Q - (Qnew - bvirt) + (enow - bvirt);\n enow = e[++eindex];\n } else {\n Qnew = Q + fnow;\n bvirt = Qnew - Q;\n hh = Q - (Qnew - bvirt) + (fnow - bvirt);\n fnow = f[++findex];\n }\n Q = Qnew;\n if (hh !== 0) {\n h[hindex++] = hh;\n }\n }\n }\n while (eindex < elen) {\n Qnew = Q + enow;\n bvirt = Qnew - Q;\n hh = Q - (Qnew - bvirt) + (enow - bvirt);\n enow = e[++eindex];\n Q = Qnew;\n if (hh !== 0) {\n h[hindex++] = hh;\n }\n }\n while (findex < flen) {\n Qnew = Q + fnow;\n bvirt = Qnew - Q;\n hh = Q - (Qnew - bvirt) + (fnow - bvirt);\n fnow = f[++findex];\n Q = Qnew;\n if (hh !== 0) {\n h[hindex++] = hh;\n }\n }\n if (Q !== 0 || hindex === 0) {\n h[hindex++] = Q;\n }\n return hindex;\n}\n\nexport function sum_three(alen, a, blen, b, clen, c, tmp, out) {\n return sum(sum(alen, a, blen, b, tmp), tmp, clen, c, out);\n}\n\n// scale_expansion_zeroelim routine from oritinal code\nexport function scale(elen, e, b, h) {\n let Q, sum, hh, product1, product0;\n let bvirt, c, ahi, alo, bhi, blo;\n\n c = splitter * b;\n bhi = c - (c - b);\n blo = b - bhi;\n let enow = e[0];\n Q = enow * b;\n c = splitter * enow;\n ahi = c - (c - enow);\n alo = enow - ahi;\n hh = alo * blo - (Q - ahi * bhi - alo * bhi - ahi * blo);\n let hindex = 0;\n if (hh !== 0) {\n h[hindex++] = hh;\n }\n for (let i = 1; i < elen; i++) {\n enow = e[i];\n product1 = enow * b;\n c = splitter * enow;\n ahi = c - (c - enow);\n alo = enow - ahi;\n product0 = alo * blo - (product1 - ahi * bhi - alo * bhi - ahi * blo);\n sum = Q + product0;\n bvirt = sum - Q;\n hh = Q - (sum - bvirt) + (product0 - bvirt);\n if (hh !== 0) {\n h[hindex++] = hh;\n }\n Q = product1 + sum;\n hh = sum - (Q - product1);\n if (hh !== 0) {\n h[hindex++] = hh;\n }\n }\n if (Q !== 0 || hindex === 0) {\n h[hindex++] = Q;\n }\n return hindex;\n}\n\nexport function negate(elen, e) {\n for (let i = 0; i < elen; i++) e[i] = -e[i];\n return elen;\n}\n\nexport function estimate(elen, e) {\n let Q = e[0];\n for (let i = 1; i < elen; i++) Q += e[i];\n return Q;\n}\n\nexport function vec(n) {\n return new Float64Array(n);\n}\n","import {epsilon, splitter, resulterrbound, estimate, vec, sum} from './util.js';\n\nconst ccwerrboundA = (3 + 16 * epsilon) * epsilon;\nconst ccwerrboundB = (2 + 12 * epsilon) * epsilon;\nconst ccwerrboundC = (9 + 64 * epsilon) * epsilon * epsilon;\n\nconst B = vec(4);\nconst C1 = vec(8);\nconst C2 = vec(12);\nconst D = vec(16);\nconst u = vec(4);\n\nfunction orient2dadapt(ax, ay, bx, by, cx, cy, detsum) {\n let acxtail, acytail, bcxtail, bcytail;\n let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3;\n\n const acx = ax - cx;\n const bcx = bx - cx;\n const acy = ay - cy;\n const bcy = by - cy;\n\n s1 = acx * bcy;\n c = splitter * acx;\n ahi = c - (c - acx);\n alo = acx - ahi;\n c = splitter * bcy;\n bhi = c - (c - bcy);\n blo = bcy - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = acy * bcx;\n c = splitter * acy;\n ahi = c - (c - acy);\n alo = acy - ahi;\n c = splitter * bcx;\n bhi = c - (c - bcx);\n blo = bcx - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n B[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n B[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n B[2] = _j - (u3 - bvirt) + (_i - bvirt);\n B[3] = u3;\n\n let det = estimate(4, B);\n let errbound = ccwerrboundB * detsum;\n if (det >= errbound || -det >= errbound) {\n return det;\n }\n\n bvirt = ax - acx;\n acxtail = ax - (acx + bvirt) + (bvirt - cx);\n bvirt = bx - bcx;\n bcxtail = bx - (bcx + bvirt) + (bvirt - cx);\n bvirt = ay - acy;\n acytail = ay - (acy + bvirt) + (bvirt - cy);\n bvirt = by - bcy;\n bcytail = by - (bcy + bvirt) + (bvirt - cy);\n\n if (acxtail === 0 && acytail === 0 && bcxtail === 0 && bcytail === 0) {\n return det;\n }\n\n errbound = ccwerrboundC * detsum + resulterrbound * Math.abs(det);\n det += (acx * bcytail + bcy * acxtail) - (acy * bcxtail + bcx * acytail);\n if (det >= errbound || -det >= errbound) return det;\n\n s1 = acxtail * bcy;\n c = splitter * acxtail;\n ahi = c - (c - acxtail);\n alo = acxtail - ahi;\n c = splitter * bcy;\n bhi = c - (c - bcy);\n blo = bcy - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = acytail * bcx;\n c = splitter * acytail;\n ahi = c - (c - acytail);\n alo = acytail - ahi;\n c = splitter * bcx;\n bhi = c - (c - bcx);\n blo = bcx - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n u[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n u[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n u[2] = _j - (u3 - bvirt) + (_i - bvirt);\n u[3] = u3;\n const C1len = sum(4, B, 4, u, C1);\n\n s1 = acx * bcytail;\n c = splitter * acx;\n ahi = c - (c - acx);\n alo = acx - ahi;\n c = splitter * bcytail;\n bhi = c - (c - bcytail);\n blo = bcytail - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = acy * bcxtail;\n c = splitter * acy;\n ahi = c - (c - acy);\n alo = acy - ahi;\n c = splitter * bcxtail;\n bhi = c - (c - bcxtail);\n blo = bcxtail - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n u[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n u[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n u[2] = _j - (u3 - bvirt) + (_i - bvirt);\n u[3] = u3;\n const C2len = sum(C1len, C1, 4, u, C2);\n\n s1 = acxtail * bcytail;\n c = splitter * acxtail;\n ahi = c - (c - acxtail);\n alo = acxtail - ahi;\n c = splitter * bcytail;\n bhi = c - (c - bcytail);\n blo = bcytail - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = acytail * bcxtail;\n c = splitter * acytail;\n ahi = c - (c - acytail);\n alo = acytail - ahi;\n c = splitter * bcxtail;\n bhi = c - (c - bcxtail);\n blo = bcxtail - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n u[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n u[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n u[2] = _j - (u3 - bvirt) + (_i - bvirt);\n u[3] = u3;\n const Dlen = sum(C2len, C2, 4, u, D);\n\n return D[Dlen - 1];\n}\n\nexport function orient2d(ax, ay, bx, by, cx, cy) {\n const detleft = (ay - cy) * (bx - cx);\n const detright = (ax - cx) * (by - cy);\n const det = detleft - detright;\n\n if (detleft === 0 || detright === 0 || (detleft > 0) !== (detright > 0)) return det;\n\n const detsum = Math.abs(detleft + detright);\n if (Math.abs(det) >= ccwerrboundA * detsum) return det;\n\n return -orient2dadapt(ax, ay, bx, by, cx, cy, detsum);\n}\n\nexport function orient2dfast(ax, ay, bx, by, cx, cy) {\n return (ay - cy) * (bx - cx) - (ax - cx) * (by - cy);\n}\n","import {orient2d} from 'robust-predicates';\n\n/**\n * Signed area of the triangle (p0, p1, p2)\n * @param {Array.} p0\n * @param {Array.} p1\n * @param {Array.} p2\n * @return {Number}\n */\nexport default function signedArea(p0, p1, p2) {\n const res = orient2d(p0[0], p0[1], p1[0], p1[1], p2[0], p2[1]);\n if (res > 0) return -1;\n if (res < 0) return 1;\n return 0;\n}\n","import signedArea from './signed_area';\n\n/**\n * @param {SweepEvent} e1\n * @param {SweepEvent} e2\n * @return {Number}\n */\nexport default function compareEvents(e1, e2) {\n const p1 = e1.point;\n const p2 = e2.point;\n\n // Different x-coordinate\n if (p1[0] > p2[0]) return 1;\n if (p1[0] < p2[0]) return -1;\n\n // Different points, but same x-coordinate\n // Event with lower y-coordinate is processed first\n if (p1[1] !== p2[1]) return p1[1] > p2[1] ? 1 : -1;\n\n return specialCases(e1, e2, p1, p2);\n}\n\n\n/* eslint-disable no-unused-vars */\nfunction specialCases(e1, e2, p1, p2) {\n // Same coordinates, but one is a left endpoint and the other is\n // a right endpoint. The right endpoint is processed first\n if (e1.left !== e2.left)\n return e1.left ? 1 : -1;\n\n // const p2 = e1.otherEvent.point, p3 = e2.otherEvent.point;\n // const sa = (p1[0] - p3[0]) * (p2[1] - p3[1]) - (p2[0] - p3[0]) * (p1[1] - p3[1])\n // Same coordinates, both events\n // are left endpoints or right endpoints.\n // not collinear\n if (signedArea(p1, e1.otherEvent.point, e2.otherEvent.point) !== 0) {\n // the event associate to the bottom segment is processed first\n return (!e1.isBelow(e2.otherEvent.point)) ? 1 : -1;\n }\n\n return (!e1.isSubject && e2.isSubject) ? 1 : -1;\n}\n/* eslint-enable no-unused-vars */\n","import SweepEvent from './sweep_event';\nimport equals from './equals';\nimport compareEvents from './compare_events';\n\n/**\n * @param {SweepEvent} se\n * @param {Array.} p\n * @param {Queue} queue\n * @return {Queue}\n */\nexport default function divideSegment(se, p, queue) {\n const r = new SweepEvent(p, false, se, se.isSubject);\n const l = new SweepEvent(p, true, se.otherEvent, se.isSubject);\n\n /* eslint-disable no-console */\n if (equals(se.point, se.otherEvent.point)) {\n console.warn('what is that, a collapsed segment?', se);\n }\n /* eslint-enable no-console */\n\n r.contourId = l.contourId = se.contourId;\n\n // avoid a rounding error. The left event would be processed after the right event\n if (compareEvents(l, se.otherEvent) > 0) {\n se.otherEvent.left = true;\n l.left = false;\n }\n\n // avoid a rounding error. The left event would be processed after the right event\n // if (compareEvents(se, r) > 0) {}\n\n se.otherEvent.otherEvent = l;\n se.otherEvent = r;\n\n queue.push(l);\n queue.push(r);\n\n return queue;\n}\n","//const EPS = 1e-9;\n\n/**\n * Finds the magnitude of the cross product of two vectors (if we pretend\n * they're in three dimensions)\n *\n * @param {Object} a First vector\n * @param {Object} b Second vector\n * @private\n * @returns {Number} The magnitude of the cross product\n */\nfunction crossProduct(a, b) {\n return (a[0] * b[1]) - (a[1] * b[0]);\n}\n\n/**\n * Finds the dot product of two vectors.\n *\n * @param {Object} a First vector\n * @param {Object} b Second vector\n * @private\n * @returns {Number} The dot product\n */\nfunction dotProduct(a, b) {\n return (a[0] * b[0]) + (a[1] * b[1]);\n}\n\n/**\n * Finds the intersection (if any) between two line segments a and b, given the\n * line segments' end points a1, a2 and b1, b2.\n *\n * This algorithm is based on Schneider and Eberly.\n * http://www.cimec.org.ar/~ncalvo/Schneider_Eberly.pdf\n * Page 244.\n *\n * @param {Array.} a1 point of first line\n * @param {Array.} a2 point of first line\n * @param {Array.} b1 point of second line\n * @param {Array.} b2 point of second line\n * @param {Boolean=} noEndpointTouch whether to skip single touchpoints\n * (meaning connected segments) as\n * intersections\n * @returns {Array.>|Null} If the lines intersect, the point of\n * intersection. If they overlap, the two end points of the overlapping segment.\n * Otherwise, null.\n */\nexport default function (a1, a2, b1, b2, noEndpointTouch) {\n // The algorithm expects our lines in the form P + sd, where P is a point,\n // s is on the interval [0, 1], and d is a vector.\n // We are passed two points. P can be the first point of each pair. The\n // vector, then, could be thought of as the distance (in x and y components)\n // from the first point to the second point.\n // So first, let's make our vectors:\n const va = [a2[0] - a1[0], a2[1] - a1[1]];\n const vb = [b2[0] - b1[0], b2[1] - b1[1]];\n // We also define a function to convert back to regular point form:\n\n /* eslint-disable arrow-body-style */\n\n function toPoint(p, s, d) {\n return [\n p[0] + s * d[0],\n p[1] + s * d[1]\n ];\n }\n\n /* eslint-enable arrow-body-style */\n\n // The rest is pretty much a straight port of the algorithm.\n const e = [b1[0] - a1[0], b1[1] - a1[1]];\n let kross = crossProduct(va, vb);\n let sqrKross = kross * kross;\n const sqrLenA = dotProduct(va, va);\n //const sqrLenB = dotProduct(vb, vb);\n\n // Check for line intersection. This works because of the properties of the\n // cross product -- specifically, two vectors are parallel if and only if the\n // cross product is the 0 vector. The full calculation involves relative error\n // to account for possible very small line segments. See Schneider & Eberly\n // for details.\n if (sqrKross > 0/* EPS * sqrLenB * sqLenA */) {\n // If they're not parallel, then (because these are line segments) they\n // still might not actually intersect. This code checks that the\n // intersection point of the lines is actually on both line segments.\n const s = crossProduct(e, vb) / kross;\n if (s < 0 || s > 1) {\n // not on line segment a\n return null;\n }\n const t = crossProduct(e, va) / kross;\n if (t < 0 || t > 1) {\n // not on line segment b\n return null;\n }\n if (s === 0 || s === 1) {\n // on an endpoint of line segment a\n return noEndpointTouch ? null : [toPoint(a1, s, va)];\n }\n if (t === 0 || t === 1) {\n // on an endpoint of line segment b\n return noEndpointTouch ? null : [toPoint(b1, t, vb)];\n }\n return [toPoint(a1, s, va)];\n }\n\n // If we've reached this point, then the lines are either parallel or the\n // same, but the segments could overlap partially or fully, or not at all.\n // So we need to find the overlap, if any. To do that, we can use e, which is\n // the (vector) difference between the two initial points. If this is parallel\n // with the line itself, then the two lines are the same line, and there will\n // be overlap.\n //const sqrLenE = dotProduct(e, e);\n kross = crossProduct(e, va);\n sqrKross = kross * kross;\n\n if (sqrKross > 0 /* EPS * sqLenB * sqLenE */) {\n // Lines are just parallel, not the same. No overlap.\n return null;\n }\n\n const sa = dotProduct(va, e) / sqrLenA;\n const sb = sa + dotProduct(va, vb) / sqrLenA;\n const smin = Math.min(sa, sb);\n const smax = Math.max(sa, sb);\n\n // this is, essentially, the FindIntersection acting on floats from\n // Schneider & Eberly, just inlined into this function.\n if (smin <= 1 && smax >= 0) {\n\n // overlap on an end point\n if (smin === 1) {\n return noEndpointTouch ? null : [toPoint(a1, smin > 0 ? smin : 0, va)];\n }\n\n if (smax === 0) {\n return noEndpointTouch ? null : [toPoint(a1, smax < 1 ? smax : 1, va)];\n }\n\n if (noEndpointTouch && smin === 0 && smax === 1) return null;\n\n // There's overlap on a segment -- two points of intersection. Return both.\n return [\n toPoint(a1, smin > 0 ? smin : 0, va),\n toPoint(a1, smax < 1 ? smax : 1, va)\n ];\n }\n\n return null;\n}\n","import divideSegment from './divide_segment';\nimport intersection from './segment_intersection';\nimport equals from './equals';\nimport compareEvents from './compare_events';\nimport {\n NON_CONTRIBUTING,\n SAME_TRANSITION,\n DIFFERENT_TRANSITION\n} from './edge_type';\n\n/**\n * @param {SweepEvent} se1\n * @param {SweepEvent} se2\n * @param {Queue} queue\n * @return {Number}\n */\nexport default function possibleIntersection (se1, se2, queue) {\n // that disallows self-intersecting polygons,\n // did cost us half a day, so I'll leave it\n // out of respect\n // if (se1.isSubject === se2.isSubject) return;\n const inter = intersection(\n se1.point, se1.otherEvent.point,\n se2.point, se2.otherEvent.point\n );\n\n const nintersections = inter ? inter.length : 0;\n if (nintersections === 0) return 0; // no intersection\n\n // the line segments intersect at an endpoint of both line segments\n if ((nintersections === 1) &&\n (equals(se1.point, se2.point) ||\n equals(se1.otherEvent.point, se2.otherEvent.point))) {\n return 0;\n }\n\n if (nintersections === 2 && se1.isSubject === se2.isSubject) {\n // if(se1.contourId === se2.contourId){\n // console.warn('Edges of the same polygon overlap',\n // se1.point, se1.otherEvent.point, se2.point, se2.otherEvent.point);\n // }\n //throw new Error('Edges of the same polygon overlap');\n return 0;\n }\n\n // The line segments associated to se1 and se2 intersect\n if (nintersections === 1) {\n\n // if the intersection point is not an endpoint of se1\n if (!equals(se1.point, inter[0]) && !equals(se1.otherEvent.point, inter[0])) {\n divideSegment(se1, inter[0], queue);\n }\n\n // if the intersection point is not an endpoint of se2\n if (!equals(se2.point, inter[0]) && !equals(se2.otherEvent.point, inter[0])) {\n divideSegment(se2, inter[0], queue);\n }\n return 1;\n }\n\n // The line segments associated to se1 and se2 overlap\n const events = [];\n let leftCoincide = false;\n let rightCoincide = false;\n\n if (equals(se1.point, se2.point)) {\n leftCoincide = true; // linked\n } else if (compareEvents(se1, se2) === 1) {\n events.push(se2, se1);\n } else {\n events.push(se1, se2);\n }\n\n if (equals(se1.otherEvent.point, se2.otherEvent.point)) {\n rightCoincide = true;\n } else if (compareEvents(se1.otherEvent, se2.otherEvent) === 1) {\n events.push(se2.otherEvent, se1.otherEvent);\n } else {\n events.push(se1.otherEvent, se2.otherEvent);\n }\n\n if ((leftCoincide && rightCoincide) || leftCoincide) {\n // both line segments are equal or share the left endpoint\n se2.type = NON_CONTRIBUTING;\n se1.type = (se2.inOut === se1.inOut)\n ? SAME_TRANSITION : DIFFERENT_TRANSITION;\n\n if (leftCoincide && !rightCoincide) {\n // honestly no idea, but changing events selection from [2, 1]\n // to [0, 1] fixes the overlapping self-intersecting polygons issue\n divideSegment(events[1].otherEvent, events[0].point, queue);\n }\n return 2;\n }\n\n // the line segments share the right endpoint\n if (rightCoincide) {\n divideSegment(events[0], events[1].point, queue);\n return 3;\n }\n\n // no line segment includes totally the other one\n if (events[0] !== events[3].otherEvent) {\n divideSegment(events[0], events[1].point, queue);\n divideSegment(events[1], events[2].point, queue);\n return 3;\n }\n\n // one line segment includes the other one\n divideSegment(events[0], events[1].point, queue);\n divideSegment(events[3].otherEvent, events[2].point, queue);\n\n return 3;\n}\n","import signedArea from './signed_area';\nimport compareEvents from './compare_events';\nimport equals from './equals';\n\n\n/**\n * @param {SweepEvent} le1\n * @param {SweepEvent} le2\n * @return {Number}\n */\nexport default function compareSegments(le1, le2) {\n if (le1 === le2) return 0;\n\n // Segments are not collinear\n if (signedArea(le1.point, le1.otherEvent.point, le2.point) !== 0 ||\n signedArea(le1.point, le1.otherEvent.point, le2.otherEvent.point) !== 0) {\n\n // If they share their left endpoint use the right endpoint to sort\n if (equals(le1.point, le2.point)) return le1.isBelow(le2.otherEvent.point) ? -1 : 1;\n\n // Different left endpoint: use the left endpoint to sort\n if (le1.point[0] === le2.point[0]) return le1.point[1] < le2.point[1] ? -1 : 1;\n\n // has the line segment associated to e1 been inserted\n // into S after the line segment associated to e2 ?\n if (compareEvents(le1, le2) === 1) return le2.isAbove(le1.point) ? -1 : 1;\n\n // The line segment associated to e2 has been inserted\n // into S after the line segment associated to e1\n return le1.isBelow(le2.point) ? -1 : 1;\n }\n\n if (le1.isSubject === le2.isSubject) { // same polygon\n let p1 = le1.point, p2 = le2.point;\n if (p1[0] === p2[0] && p1[1] === p2[1]/*equals(le1.point, le2.point)*/) {\n p1 = le1.otherEvent.point; p2 = le2.otherEvent.point;\n if (p1[0] === p2[0] && p1[1] === p2[1]) return 0;\n else return le1.contourId > le2.contourId ? 1 : -1;\n }\n } else { // Segments are collinear, but belong to separate polygons\n return le1.isSubject ? -1 : 1;\n }\n\n return compareEvents(le1, le2) === 1 ? 1 : -1;\n}\n","import Tree from 'splaytree';\nimport computeFields from './compute_fields';\nimport possibleIntersection from './possible_intersection';\nimport compareSegments from './compare_segments';\nimport {\n INTERSECTION,\n DIFFERENCE\n} from './operation';\n\n\nexport default function subdivide(eventQueue, subject, clipping, sbbox, cbbox, operation) {\n const sweepLine = new Tree(compareSegments);\n const sortedEvents = [];\n\n const rightbound = Math.min(sbbox[2], cbbox[2]);\n\n let prev, next, begin;\n\n while (eventQueue.length !== 0) {\n let event = eventQueue.pop();\n sortedEvents.push(event);\n\n // optimization by bboxes for intersection and difference goes here\n if ((operation === INTERSECTION && event.point[0] > rightbound) ||\n (operation === DIFFERENCE && event.point[0] > sbbox[2])) {\n break;\n }\n\n if (event.left) {\n next = prev = sweepLine.insert(event);\n begin = sweepLine.minNode();\n\n if (prev !== begin) prev = sweepLine.prev(prev);\n else prev = null;\n\n next = sweepLine.next(next);\n\n const prevEvent = prev ? prev.key : null;\n let prevprevEvent;\n computeFields(event, prevEvent, operation);\n if (next) {\n if (possibleIntersection(event, next.key, eventQueue) === 2) {\n computeFields(event, prevEvent, operation);\n computeFields(event, next.key, operation);\n }\n }\n\n if (prev) {\n if (possibleIntersection(prev.key, event, eventQueue) === 2) {\n let prevprev = prev;\n if (prevprev !== begin) prevprev = sweepLine.prev(prevprev);\n else prevprev = null;\n\n prevprevEvent = prevprev ? prevprev.key : null;\n computeFields(prevEvent, prevprevEvent, operation);\n computeFields(event, prevEvent, operation);\n }\n }\n } else {\n event = event.otherEvent;\n next = prev = sweepLine.find(event);\n\n if (prev && next) {\n\n if (prev !== begin) prev = sweepLine.prev(prev);\n else prev = null;\n\n next = sweepLine.next(next);\n sweepLine.remove(event);\n\n if (next && prev) {\n possibleIntersection(prev.key, next.key, eventQueue);\n }\n }\n }\n }\n return sortedEvents;\n}\n","export default class Contour {\n\n /**\n * Contour\n *\n * @class {Contour}\n */\n constructor() {\n this.points = [];\n this.holeIds = [];\n this.holeOf = null;\n this.depth = null;\n }\n\n isExterior() {\n return this.holeOf == null;\n }\n\n}\n","import compareEvents from './compare_events';\nimport Contour from './contour';\n\n/**\n * @param {Array.} sortedEvents\n * @return {Array.}\n */\nfunction orderEvents(sortedEvents) {\n let event, i, len, tmp;\n const resultEvents = [];\n for (i = 0, len = sortedEvents.length; i < len; i++) {\n event = sortedEvents[i];\n if ((event.left && event.inResult) ||\n (!event.left && event.otherEvent.inResult)) {\n resultEvents.push(event);\n }\n }\n // Due to overlapping edges the resultEvents array can be not wholly sorted\n let sorted = false;\n while (!sorted) {\n sorted = true;\n for (i = 0, len = resultEvents.length; i < len; i++) {\n if ((i + 1) < len &&\n compareEvents(resultEvents[i], resultEvents[i + 1]) === 1) {\n tmp = resultEvents[i];\n resultEvents[i] = resultEvents[i + 1];\n resultEvents[i + 1] = tmp;\n sorted = false;\n }\n }\n }\n\n\n for (i = 0, len = resultEvents.length; i < len; i++) {\n event = resultEvents[i];\n event.otherPos = i;\n }\n\n // imagine, the right event is found in the beginning of the queue,\n // when his left counterpart is not marked yet\n for (i = 0, len = resultEvents.length; i < len; i++) {\n event = resultEvents[i];\n if (!event.left) {\n tmp = event.otherPos;\n event.otherPos = event.otherEvent.otherPos;\n event.otherEvent.otherPos = tmp;\n }\n }\n\n return resultEvents;\n}\n\n\n/**\n * @param {Number} pos\n * @param {Array.} resultEvents\n * @param {Object>} processed\n * @return {Number}\n */\nfunction nextPos(pos, resultEvents, processed, origPos) {\n let newPos = pos + 1,\n p = resultEvents[pos].point,\n p1;\n const length = resultEvents.length;\n\n if (newPos < length)\n p1 = resultEvents[newPos].point;\n\n while (newPos < length && p1[0] === p[0] && p1[1] === p[1]) {\n if (!processed[newPos]) {\n return newPos;\n } else {\n newPos++;\n }\n p1 = resultEvents[newPos].point;\n }\n\n newPos = pos - 1;\n\n while (processed[newPos] && newPos > origPos) {\n newPos--;\n }\n\n return newPos;\n}\n\n\nfunction initializeContourFromContext(event, contours, contourId) {\n const contour = new Contour();\n if (event.prevInResult != null) {\n const prevInResult = event.prevInResult;\n // Note that it is valid to query the \"previous in result\" for its output contour id,\n // because we must have already processed it (i.e., assigned an output contour id)\n // in an earlier iteration, otherwise it wouldn't be possible that it is \"previous in\n // result\".\n const lowerContourId = prevInResult.outputContourId;\n const lowerResultTransition = prevInResult.resultTransition;\n if (lowerResultTransition > 0) {\n // We are inside. Now we have to check if the thing below us is another hole or\n // an exterior contour.\n const lowerContour = contours[lowerContourId];\n if (lowerContour.holeOf != null) {\n // The lower contour is a hole => Connect the new contour as a hole to its parent,\n // and use same depth.\n const parentContourId = lowerContour.holeOf;\n contours[parentContourId].holeIds.push(contourId);\n contour.holeOf = parentContourId;\n contour.depth = contours[lowerContourId].depth;\n } else {\n // The lower contour is an exterior contour => Connect the new contour as a hole,\n // and increment depth.\n contours[lowerContourId].holeIds.push(contourId);\n contour.holeOf = lowerContourId;\n contour.depth = contours[lowerContourId].depth + 1;\n }\n } else {\n // We are outside => this contour is an exterior contour of same depth.\n contour.holeOf = null;\n contour.depth = contours[lowerContourId].depth;\n }\n } else {\n // There is no lower/previous contour => this contour is an exterior contour of depth 0.\n contour.holeOf = null;\n contour.depth = 0;\n }\n return contour;\n}\n\n/**\n * @param {Array.} sortedEvents\n * @return {Array.<*>} polygons\n */\nexport default function connectEdges(sortedEvents) {\n let i, len;\n const resultEvents = orderEvents(sortedEvents);\n\n // \"false\"-filled array\n const processed = {};\n const contours = [];\n\n for (i = 0, len = resultEvents.length; i < len; i++) {\n\n if (processed[i]) {\n continue;\n }\n\n const contourId = contours.length;\n const contour = initializeContourFromContext(resultEvents[i], contours, contourId);\n\n // Helper function that combines marking an event as processed with assigning its output contour ID\n const markAsProcessed = (pos) => {\n processed[pos] = true;\n resultEvents[pos].outputContourId = contourId;\n };\n\n let pos = i;\n let origPos = i;\n\n const initial = resultEvents[i].point;\n contour.points.push(initial);\n\n /* eslint no-constant-condition: \"off\" */\n while (true) {\n markAsProcessed(pos);\n\n pos = resultEvents[pos].otherPos;\n\n markAsProcessed(pos);\n contour.points.push(resultEvents[pos].point);\n\n pos = nextPos(pos, resultEvents, processed, origPos);\n\n if (pos == origPos) {\n break;\n }\n }\n\n contours.push(contour);\n }\n\n return contours;\n}\n","'use strict';\n\nmodule.exports = TinyQueue;\nmodule.exports.default = TinyQueue;\n\nfunction TinyQueue(data, compare) {\n if (!(this instanceof TinyQueue)) return new TinyQueue(data, compare);\n\n this.data = data || [];\n this.length = this.data.length;\n this.compare = compare || defaultCompare;\n\n if (this.length > 0) {\n for (var i = (this.length >> 1) - 1; i >= 0; i--) this._down(i);\n }\n}\n\nfunction defaultCompare(a, b) {\n return a < b ? -1 : a > b ? 1 : 0;\n}\n\nTinyQueue.prototype = {\n\n push: function (item) {\n this.data.push(item);\n this.length++;\n this._up(this.length - 1);\n },\n\n pop: function () {\n if (this.length === 0) return undefined;\n\n var top = this.data[0];\n this.length--;\n\n if (this.length > 0) {\n this.data[0] = this.data[this.length];\n this._down(0);\n }\n this.data.pop();\n\n return top;\n },\n\n peek: function () {\n return this.data[0];\n },\n\n _up: function (pos) {\n var data = this.data;\n var compare = this.compare;\n var item = data[pos];\n\n while (pos > 0) {\n var parent = (pos - 1) >> 1;\n var current = data[parent];\n if (compare(item, current) >= 0) break;\n data[pos] = current;\n pos = parent;\n }\n\n data[pos] = item;\n },\n\n _down: function (pos) {\n var data = this.data;\n var compare = this.compare;\n var halfLength = this.length >> 1;\n var item = data[pos];\n\n while (pos < halfLength) {\n var left = (pos << 1) + 1;\n var right = left + 1;\n var best = data[left];\n\n if (right < this.length && compare(data[right], best) < 0) {\n left = right;\n best = data[right];\n }\n if (compare(best, item) >= 0) break;\n\n data[pos] = best;\n pos = left;\n }\n\n data[pos] = item;\n }\n};\n","import Queue from 'tinyqueue';\nimport SweepEvent from './sweep_event';\nimport compareEvents from './compare_events';\nimport { DIFFERENCE } from './operation';\n\nconst max = Math.max;\nconst min = Math.min;\n\nlet contourId = 0;\n\n\nfunction processPolygon(contourOrHole, isSubject, depth, Q, bbox, isExteriorRing) {\n let i, len, s1, s2, e1, e2;\n for (i = 0, len = contourOrHole.length - 1; i < len; i++) {\n s1 = contourOrHole[i];\n s2 = contourOrHole[i + 1];\n e1 = new SweepEvent(s1, false, undefined, isSubject);\n e2 = new SweepEvent(s2, false, e1, isSubject);\n e1.otherEvent = e2;\n\n if (s1[0] === s2[0] && s1[1] === s2[1]) {\n continue; // skip collapsed edges, or it breaks\n }\n\n e1.contourId = e2.contourId = depth;\n if (!isExteriorRing) {\n e1.isExteriorRing = false;\n e2.isExteriorRing = false;\n }\n if (compareEvents(e1, e2) > 0) {\n e2.left = true;\n } else {\n e1.left = true;\n }\n\n const x = s1[0], y = s1[1];\n bbox[0] = min(bbox[0], x);\n bbox[1] = min(bbox[1], y);\n bbox[2] = max(bbox[2], x);\n bbox[3] = max(bbox[3], y);\n\n // Pushing it so the queue is sorted from left to right,\n // with object on the left having the highest priority.\n Q.push(e1);\n Q.push(e2);\n }\n}\n\n\nexport default function fillQueue(subject, clipping, sbbox, cbbox, operation) {\n const eventQueue = new Queue(null, compareEvents);\n let polygonSet, isExteriorRing, i, ii, j, jj; //, k, kk;\n\n for (i = 0, ii = subject.length; i < ii; i++) {\n polygonSet = subject[i];\n for (j = 0, jj = polygonSet.length; j < jj; j++) {\n isExteriorRing = j === 0;\n if (isExteriorRing) contourId++;\n processPolygon(polygonSet[j], true, contourId, eventQueue, sbbox, isExteriorRing);\n }\n }\n\n for (i = 0, ii = clipping.length; i < ii; i++) {\n polygonSet = clipping[i];\n for (j = 0, jj = polygonSet.length; j < jj; j++) {\n isExteriorRing = j === 0;\n if (operation === DIFFERENCE) isExteriorRing = false;\n if (isExteriorRing) contourId++;\n processPolygon(polygonSet[j], false, contourId, eventQueue, cbbox, isExteriorRing);\n }\n }\n\n return eventQueue;\n}\n","import subdivideSegments from './subdivide_segments';\nimport connectEdges from './connect_edges';\nimport fillQueue from './fill_queue';\nimport {\n INTERSECTION,\n DIFFERENCE,\n UNION,\n XOR\n} from './operation';\n\nconst EMPTY = [];\n\n\nfunction trivialOperation(subject, clipping, operation) {\n let result = null;\n if (subject.length * clipping.length === 0) {\n if (operation === INTERSECTION) {\n result = EMPTY;\n } else if (operation === DIFFERENCE) {\n result = subject;\n } else if (operation === UNION ||\n operation === XOR) {\n result = (subject.length === 0) ? clipping : subject;\n }\n }\n return result;\n}\n\n\nfunction compareBBoxes(subject, clipping, sbbox, cbbox, operation) {\n let result = null;\n if (sbbox[0] > cbbox[2] ||\n cbbox[0] > sbbox[2] ||\n sbbox[1] > cbbox[3] ||\n cbbox[1] > sbbox[3]) {\n if (operation === INTERSECTION) {\n result = EMPTY;\n } else if (operation === DIFFERENCE) {\n result = subject;\n } else if (operation === UNION ||\n operation === XOR) {\n result = subject.concat(clipping);\n }\n }\n return result;\n}\n\n\nexport default function boolean(subject, clipping, operation) {\n if (typeof subject[0][0][0] === 'number') {\n subject = [subject];\n }\n if (typeof clipping[0][0][0] === 'number') {\n clipping = [clipping];\n }\n let trivial = trivialOperation(subject, clipping, operation);\n if (trivial) {\n return trivial === EMPTY ? null : trivial;\n }\n const sbbox = [Infinity, Infinity, -Infinity, -Infinity];\n const cbbox = [Infinity, Infinity, -Infinity, -Infinity];\n\n // console.time('fill queue');\n const eventQueue = fillQueue(subject, clipping, sbbox, cbbox, operation);\n //console.timeEnd('fill queue');\n\n trivial = compareBBoxes(subject, clipping, sbbox, cbbox, operation);\n if (trivial) {\n return trivial === EMPTY ? null : trivial;\n }\n // console.time('subdivide edges');\n const sortedEvents = subdivideSegments(eventQueue, subject, clipping, sbbox, cbbox, operation);\n //console.timeEnd('subdivide edges');\n\n // console.time('connect vertices');\n const contours = connectEdges(sortedEvents, operation);\n //console.timeEnd('connect vertices');\n\n // Convert contours to polygons\n const polygons = [];\n for (let i = 0; i < contours.length; i++) {\n let contour = contours[i];\n if (contour.isExterior()) {\n // The exterior ring goes first\n let rings = [contour.points];\n // Followed by holes if any\n for (let j = 0; j < contour.holeIds.length; j++) {\n let holeId = contour.holeIds[j];\n rings.push(contours[holeId].points);\n }\n polygons.push(rings);\n }\n }\n\n return polygons;\n}\n","import boolean from './src/';\nimport {\n INTERSECTION,\n DIFFERENCE,\n UNION,\n XOR\n} from './src/operation';\n\nexport function union (subject, clipping) {\n return boolean(subject, clipping, UNION);\n}\n\nexport function diff (subject, clipping) {\n return boolean(subject, clipping, DIFFERENCE);\n}\n\nexport function xor (subject, clipping) {\n return boolean(subject, clipping, XOR);\n}\n\nexport function intersection (subject, clipping) {\n return boolean(subject, clipping, INTERSECTION);\n}\n\n/**\n * @enum {Number}\n */\nexport const operations = { UNION, DIFFERENCE, INTERSECTION, XOR };\n"],"names":["const","let","prototypeAccessors","Tree","Queue","subdivideSegments","intersection"],"mappings":";;;;;;;;;;;;;;;EAAA,SAAS,eAAe,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE;AACtE;EACe,IAAM,SAAS,GAE5B,kBAAW,CAAC,OAAyB,EAAE,YAAoB,EAAE;qCAA1C,GAAG;+CAA6B,GAAG;AAAQ;EAChE,EAAI,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;EAC5B,EAAI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;EACtB,EAAI,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;EACnB,EAAI,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC,YAAY,CAAC;EACtC;;4DAAC;AACH;AACA;sBACE,kCAAW,CAAC,EAAE;EAChB,EAAI,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC;EACpB,EAAI,IAAI,CAAC,EAAE;EACX,IAAM,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC;EACvB,IAAM,IAAI,CAAC,CAAC,IAAI,IAAE,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,GAAC;EACpC,IAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;EAC1B,GAAK;AACL;EACA,EAAI,IAAI,CAAC,CAAC,CAAC,MAAM,iBAAiB,IAAI,CAAC,KAAK,GAAG,CAAC,GAAC;EACjD,OAAS,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,IAAE,CAAC,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,GAAC;EACpD,gCAAkC,CAAC,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