package.dist.earcut.min.js Maven / Gradle / Ivy
!function(e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).earcut=e()}(function(){return function r(x,i,u){function f(n,e){if(!i[n]){if(!x[n]){var t="function"==typeof require&&require;if(!e&&t)return t(n,!0);if(o)return o(n,!0);throw(t=new Error("Cannot find module '"+n+"'")).code="MODULE_NOT_FOUND",t}t=i[n]={exports:{}},x[n][0].call(t.exports,function(e){return f(x[n][1][e]||e)},t,t.exports,r,x,i,u)}return i[n].exports}for(var o="function"==typeof require&&require,e=0;e=r.next.y&&r.next.y!==r.y){var f=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(f<=x&&u=r.x&&r.x>=y&&x!==r.x&&w(it.x||r.x===t.x&&function(e,n){return M(e.prev,e,n.prev)<0&&M(n.next,e,e.next)<0}(t,r)))&&(t=r,a=o)),r=r.next,r!==v;);return t}(e,n);if(!t)return n;var r=m(t,e),e=s(t,t.next);return s(r,r.next),n===t?e:n}(o[x],t),t=s(t,t.next);return t}(e,n,y,t)),e.length>80*t){for(var a=r=e[0],l=x=e[1],h=t;hi.x?x.x>u.x?x:u:i.x>u.x?i:u).x,y=(x.y>i.y?x.y>u.y?x:u:i.y>u.y?i:u).y,p=g(f,o,n,t,r),a=g(v,y,n,t,r),l=e.prevZ,h=e.nextZ;for(;l&&l.z>=p&&h&&h.z<=a;){if(l!==e.prev&&l!==e.next&&w(x.x,x.y,i.x,i.y,u.x,u.y,l.x,l.y)&&0<=M(l.prev,l,l.next))return!1;if(l=l.prevZ,h!==e.prev&&h!==e.next&&w(x.x,x.y,i.x,i.y,u.x,u.y,h.x,h.y)&&0<=M(h.prev,h,h.next))return!1;h=h.nextZ}for(;l&&l.z>=p;){if(l!==e.prev&&l!==e.next&&w(x.x,x.y,i.x,i.y,u.x,u.y,l.x,l.y)&&0<=M(l.prev,l,l.next))return!1;l=l.prevZ}for(;h&&h.z<=a;){if(h!==e.prev&&h!==e.next&&w(x.x,x.y,i.x,i.y,u.x,u.y,h.x,h.y)&&0<=M(h.prev,h,h.next))return!1;h=h.nextZ}return!0}(e,r,x,i):function(e){var n=e.prev,t=e,r=e.next;if(0<=M(n,t,r))return!1;var x=e.next.next;for(;x!==e.prev;){if(w(n.x,n.y,t.x,t.y,r.x,r.y,x.x,x.y)&&0<=M(x.prev,x,x.next))return!1;x=x.next}return!0}(e))n.push(f.i/t),n.push(e.i/t),n.push(o.i/t),a(e),e=o.next,v=o.next;else if((e=o)===v){u?1===u?d(e=function(e,n,t){var r=e;do{var x=r.prev,i=r.next.next}while(!y(x,i)&&p(x,r,r.next,i)&&b(x,i)&&b(i,x)&&(n.push(x.i/t),n.push(r.i/t),n.push(i.i/t),a(r),a(r.next),r=e=i),r=r.next,r!==e);return s(r)}(s(e),n,t),n,t,r,x,i,2):2===u&&function(e,n,t,r,x,i){var u=e;do{for(var f=u.next.next;f!==u.prev;){if(u.i!==f.i&&function(e,n){return e.next.i!==n.i&&e.prev.i!==n.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&&p(t,t.next,e,n))return!0}while(t=t.next,t!==e);return!1}(e,n)&&(b(e,n)&&b(n,e)&&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}(e,n)&&(M(e.prev,e,n.prev)||M(e,n.prev,n))||y(e,n)&&0=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