package.dist.earcut.min.js Maven / Gradle / Ivy
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).earcut=e()}}(function(){return function i(f,u,o){function v(n,e){if(!u[n]){if(!f[n]){var t="function"==typeof require&&require;if(!e&&t)return t(n,!0);if(y)return y(n,!0);var r=new Error("Cannot find module '"+n+"'");throw r.code="MODULE_NOT_FOUND",r}var x=u[n]={exports:{}};f[n][0].call(x.exports,function(e){return v(f[n][1][e]||e)},x,x.exports,i,f,u,o)}return u[n].exports}for(var y="function"==typeof require&&require,e=0;e80*t){r=i=e[0],x=f=e[1];for(var h=t;hi.x?x.x>f.x?x.x:f.x:i.x>f.x?i.x:f.x,y=x.y>i.y?x.y>f.y?x.y:f.y:i.y>f.y?i.y:f.y,p=w(u,o,n,t,r),a=w(v,y,n,t,r),l=e.prevZ,h=e.nextZ;l&&l.z>=p&&h&&h.z<=a;){if(l!==e.prev&&l!==e.next&&b(x.x,x.y,i.x,i.y,f.x,f.y,l.x,l.y)&&0<=m(l.prev,l,l.next))return;if(l=l.prevZ,h!==e.prev&&h!==e.next&&b(x.x,x.y,i.x,i.y,f.x,f.y,h.x,h.y)&&0<=m(h.prev,h,h.next))return;h=h.nextZ}for(;l&&l.z>=p;){if(l!==e.prev&&l!==e.next&&b(x.x,x.y,i.x,i.y,f.x,f.y,l.x,l.y)&&0<=m(l.prev,l,l.next))return;l=l.prevZ}for(;h&&h.z<=a;){if(h!==e.prev&&h!==e.next&&b(x.x,x.y,i.x,i.y,f.x,f.y,h.x,h.y)&&0<=m(h.prev,h,h.next))return;h=h.nextZ}return 1}}function a(e,n,t){var r=e;do{var x=r.prev,i=r.next.next;!h(x,i)&&z(x,r,r.next,i)&&q(x,i)&&q(i,x)&&(n.push(x.i/t),n.push(r.i/t),n.push(i.i/t),k(r),k(r.next),r=e=i),r=r.next}while(r!==e);return c(r)}function l(e,n,t,r,x,i){var f,u,o=e;do{for(var v=o.next.next;v!==o.prev;){if(o.i!==v.i&&(u=v,(f=o).next.i!==u.i&&f.prev.i!==u.i&&!function(e,n){var t=e;do{if(t.i!==e.i&&t.next.i!==e.i&&t.i!==n.i&&t.next.i!==n.i&&z(t,t.next,e,n))return 1;t=t.next}while(t!==e);return}(f,u)&&(q(f,u)&&q(u,f)&&function(e,n){var t=e,r=!1,x=(e.x+n.x)/2,i=(e.y+n.y)/2;for(;t.y>i!=t.next.y>i&&t.next.y!==t.y&&x<(t.next.x-t.x)*(i-t.y)/(t.next.y-t.y)+t.x&&(r=!r),t=t.next,t!==e;);return r}(f,u)&&(m(f.prev,f,u.prev)||m(f,u.prev,u))||h(f,u)&&0=r.next.y&&r.next.y!==r.y){var u=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(u<=x&&f=r.x&&r.x>=y&&x!==r.x&&b(it.x||r.x===t.x&&(h=r,m((l=t).prev,l,h.prev)<0&&m(h.next,l,l.next)<0)))&&(t=r,a=o)),r=r.next,r!==v;);var l,h;return t}(e,n)){var t=O(n,e);c(n,n.next),c(t,t.next)}}function w(e,n,t,r,x){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-t)*x)|e<<8))|e<<4))|e<<2))|e<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=32767*(n-r)*x)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function M(e){for(var n=e,t=e;(n.x=Math.min(e.x,t.x)&&n.y<=Math.max(e.y,t.y)&&n.y>=Math.min(e.y,t.y)}function v(e){return 0