From 8c25d50d627ae00bac620bbf128a6122d0bbc342 Mon Sep 17 00:00:00 2001 From: hu de yi Date: Thu, 14 Nov 2024 15:44:08 +0800 Subject: [PATCH] upgrade poly-extrude to 0.4.0 (#650) --- package.json | 2 +- src/worker/getworker.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index ed49dac..7968bd8 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,6 @@ }, "dependencies": { "deyihu-geometry-extrude": "0.1.10", - "poly-extrude": "^0.3.0" + "poly-extrude": "^0.4.0" } } diff --git a/src/worker/getworker.ts b/src/worker/getworker.ts index 43681dc..47447ba 100644 --- a/src/worker/getworker.ts +++ b/src/worker/getworker.ts @@ -1,8 +1,8 @@ // eslint-disable-next-line quotes const workerCode = `(function(t){"use strict"; /*! - * poly-extrude v0.3.0 - */var n={exports:{}};function r(t,n,r){r=r||2;var e,o,a,h,u,v,f,x=n&&n.length,d=x?n[0]*r:t.length,y=i(t,0,d,r,!0),g=[];if(!y||y.next===y.prev)return g;if(x&&(y=function(t,n,r,e){var s,o,a,h=[];for(s=0,o=n.length;s80*r){e=a=t[0],o=h=t[1];for(var m=r;ma&&(a=u),v>h&&(h=v);f=0!==(f=Math.max(a-e,h-o))?32767/f:0}return s(y,g,r,e,o,f,0),g}function i(t,n,r,i,e){var s,o;if(e===V(t,n,r,i)>0)for(s=n;s=n;s-=i)o=A(s,t[s],t[s+1],o);return o&&g(o,o.next)&&(P(o),o=o.next),o}function e(t,n){if(!t)return t;n||(n=t);var r,i=t;do{if(r=!1,i.steiner||!g(i,i.next)&&0!==y(i.prev,i,i.next))i=i.next;else{if(P(i),(i=n=i.prev)===i.next)break;r=!0}}while(r||i!==n);return n}function s(t,n,r,i,c,l,v){if(t){!v&&l&&function(t,n,r,i){var e=t;do{0===e.z&&(e.z=f(e.x,e.y,n,r,i)),e.prevZ=e.prev,e.nextZ=e.next,e=e.next}while(e!==t);e.prevZ.nextZ=null,e.prevZ=null,function(t){var n,r,i,e,s,o,a,h,u=1;do{for(r=t,t=null,s=null,o=0;r;){for(o++,i=r,a=0,n=0;n0||h>0&&i;)0!==a&&(0===h||!i||r.z<=i.z)?(e=r,r=r.nextZ,a--):(e=i,i=i.nextZ,h--),s?s.nextZ=e:t=e,e.prevZ=s,s=e;r=i}s.nextZ=null,u*=2}while(o>1)}(e)}(t,i,c,l);for(var p,x,d=t;t.prev!==t.next;)if(p=t.prev,x=t.next,l?a(t,i,c,l):o(t))n.push(p.i/r|0),n.push(t.i/r|0),n.push(x.i/r|0),P(t),t=x.next,d=x.next;else if((t=x)===d){v?1===v?s(t=h(e(t),n,r),n,r,i,c,l,2):2===v&&u(t,n,r,i,c,l):s(e(t),n,r,i,c,l,1);break}}}function o(t){var n=t.prev,r=t,i=t.next;if(y(n,r,i)>=0)return!1;for(var e=n.x,s=r.x,o=i.x,a=n.y,h=r.y,u=i.y,c=es?e>o?e:o:s>o?s:o,f=a>h?a>u?a:u:h>u?h:u,p=i.next;p!==n;){if(p.x>=c&&p.x<=v&&p.y>=l&&p.y<=f&&x(e,a,s,h,o,u,p.x,p.y)&&y(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function a(t,n,r,i){var e=t.prev,s=t,o=t.next;if(y(e,s,o)>=0)return!1;for(var a=e.x,h=s.x,u=o.x,c=e.y,l=s.y,v=o.y,p=ah?a>u?a:u:h>u?h:u,m=c>l?c>v?c:v:l>v?l:v,z=f(p,d,n,r,i),w=f(g,m,n,r,i),M=t.prevZ,b=t.nextZ;M&&M.z>=z&&b&&b.z<=w;){if(M.x>=p&&M.x<=g&&M.y>=d&&M.y<=m&&M!==e&&M!==o&&x(a,c,h,l,u,v,M.x,M.y)&&y(M.prev,M,M.next)>=0)return!1;if(M=M.prevZ,b.x>=p&&b.x<=g&&b.y>=d&&b.y<=m&&b!==e&&b!==o&&x(a,c,h,l,u,v,b.x,b.y)&&y(b.prev,b,b.next)>=0)return!1;b=b.nextZ}for(;M&&M.z>=z;){if(M.x>=p&&M.x<=g&&M.y>=d&&M.y<=m&&M!==e&&M!==o&&x(a,c,h,l,u,v,M.x,M.y)&&y(M.prev,M,M.next)>=0)return!1;M=M.prevZ}for(;b&&b.z<=w;){if(b.x>=p&&b.x<=g&&b.y>=d&&b.y<=m&&b!==e&&b!==o&&x(a,c,h,l,u,v,b.x,b.y)&&y(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function h(t,n,r){var i=t;do{var s=i.prev,o=i.next.next;!g(s,o)&&m(s,i,i.next,o)&&M(s,o)&&M(o,s)&&(n.push(s.i/r|0),n.push(i.i/r|0),n.push(o.i/r|0),P(i),P(i.next),i=t=o),i=i.next}while(i!==t);return e(i)}function u(t,n,r,i,o,a){var h=t;do{for(var u=h.next.next;u!==h.prev;){if(h.i!==u.i&&d(h,u)){var c=b(h,u);return h=e(h,h.next),c=e(c,c.next),s(h,n,r,i,o,a,0),void s(c,n,r,i,o,a,0)}u=u.next}h=h.next}while(h!==t)}function c(t,n){return t.x-n.x}function l(t,n){var r=function(t,n){var r,i=n,e=t.x,s=t.y,o=-1/0;do{if(s<=i.y&&s>=i.next.y&&i.next.y!==i.y){var a=i.x+(s-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(a<=e&&a>o&&(o=a,r=i.x=i.x&&i.x>=c&&e!==i.x&&x(sr.x||i.x===r.x&&v(r,i)))&&(r=i,f=h)),i=i.next}while(i!==u);return r}(t,n);if(!r)return n;var i=b(r,t);return e(i,i.next),e(r,r.next)}function v(t,n){return y(t.prev,t,n.prev)<0&&y(n.next,t,t.next)<0}function f(t,n,r,i,e){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*e|0)|t<<8))|t<<4))|t<<2))|t<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-i)*e|0)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function p(t){var n=t,r=t;do{(n.x=(t-o)*(s-a)&&(t-o)*(i-a)>=(r-o)*(n-a)&&(r-o)*(s-a)>=(e-o)*(i-a)}function d(t,n){return t.next.i!==n.i&&t.prev.i!==n.i&&!function(t,n){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==n.i&&r.next.i!==n.i&&m(r,r.next,t,n))return!0;r=r.next}while(r!==t);return!1}(t,n)&&(M(t,n)&&M(n,t)&&function(t,n){var r=t,i=!1,e=(t.x+n.x)/2,s=(t.y+n.y)/2;do{r.y>s!=r.next.y>s&&r.next.y!==r.y&&e<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next}while(r!==t);return i}(t,n)&&(y(t.prev,t,n.prev)||y(t,n.prev,n))||g(t,n)&&y(t.prev,t,t.next)>0&&y(n.prev,n,n.next)>0)}function y(t,n,r){return(n.y-t.y)*(r.x-n.x)-(n.x-t.x)*(r.y-n.y)}function g(t,n){return t.x===n.x&&t.y===n.y}function m(t,n,r,i){var e=w(y(t,n,r)),s=w(y(t,n,i)),o=w(y(r,i,t)),a=w(y(r,i,n));return e!==s&&o!==a||(!(0!==e||!z(t,r,n))||(!(0!==s||!z(t,i,n))||(!(0!==o||!z(r,t,i))||!(0!==a||!z(r,n,i)))))}function z(t,n,r){return n.x<=Math.max(t.x,r.x)&&n.x>=Math.min(t.x,r.x)&&n.y<=Math.max(t.y,r.y)&&n.y>=Math.min(t.y,r.y)}function w(t){return t>0?1:t<0?-1:0}function M(t,n){return y(t.prev,t,t.next)<0?y(t,n,t.next)>=0&&y(t,t.prev,n)>=0:y(t,n,t.prev)<0||y(t,t.next,n)<0}function b(t,n){var r=new S(t.i,t.x,t.y),i=new S(n.i,n.x,n.y),e=t.next,s=n.prev;return t.next=n,n.prev=t,r.next=e,e.prev=r,i.next=r,r.prev=i,s.next=i,i.prev=s,i}function A(t,n,r,i){var e=new S(t,n,r);return i?(e.next=i.next,e.prev=i,i.next.prev=e,i.next=e):(e.prev=e,e.next=e),e}function P(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function S(t,n,r){this.i=t,this.x=n,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function V(t,n,r,i){for(var e=0,s=n,o=r-i;s0&&(i+=t[e-1].length,r.holes.push(i))}return r};var Z=n.exports;function F(t){for(var n,r,i=0,e=1,s=t.length;e0}function L(t,n,r){return t[0]=n[0]-r[0],t[1]=n[1]-r[1],t[2]=n[2]-r[2],t}function _(t,n){var r=n[0],i=n[1],e=n[2],s=Math.sqrt(r*r+i*i+e*e)||1;return t[0]=r/s,t[1]=i/s,t[2]=e/s,t}function E(t,n){function r(t,n,r,i){t[0]=n,t[1]=r,t[2]=i}for(var i,e,s,o,a,h,u,c,l,v=[],f=[],p=[],x=[],d=[],y=[],g=t.length,m=new Float32Array(n.length),z=0;z0&&e.push(l/2);for(var d=0,y=x.length;d0&&(v=(v=v.map((function(t){return t}))).reverse());for(var f=0,p=v.length-1;f0}function D(t,n){void 0===n&&(n={}),n=Object.assign({},{radius:1,height:2,radialSegments:6},n);for(var r=Math.round(Math.max(4,n.radialSegments)),i=n,e=i.radius,s=i.height,o=360/r/360*Math.PI*2,a=r+1,h=new Float32Array(3*a*2),u=t[0],c=t[1],l=0,v=0,f=3*a,p=2*a,x=[],d=[],y=-1;y1&&x.push(0,y-1,y)}h[l-=3]=h[0],h[l+1]=h[1],h[l+2]=h[2];var b=h.length;h[b-3]=h[0],h[b-2]=h[1],h[b-1]=s;for(var A=x.length,P=0;P0)){h=e;break}h=e-1}if(i[e=h]===r)return e/(s-1);var u=i[e];return(e+(r-u)/(i[e+1]-u))/(s-1)},t}()),$=new Q,tt=new Q,nt=new Q,rt=new G,it=new Y;var et=function(){function t(){this.array=[],this.count=0}var n=t.prototype;return n.set=function(t,n,r,i,e){if(void 0===n&&(n=.1),void 0===r&&(r=10),void 0===i&&(i=null),void 0===e&&(e=!1),(t=t.slice(0)).length<2)return console.warn("PathPointList: points length less than 2."),void(this.count=0);e&&!t[0].equals(t[t.length-1])&&t.push((new Q).copy(t[0]));for(var s=0,o=t.length;s0?this.array[this.count-1].dist:0},n._getByIndex=function(t){return this.array[t]||(this.array[t]=new X),this.array[t]},n._start=function(t,n,r){this.count=0;var i=this._getByIndex(this.count);if(i.pos.copy(t),i.dir.subVectors(n,t),r)i.up.copy(r);else{var e=Number.MAX_VALUE,s=Math.abs(i.dir.x),o=Math.abs(i.dir.y),a=Math.abs(i.dir.z);sNumber.EPSILON){e.normalize();var s=Math.acos(Math.min(Math.max(n.dir.dot(r.dir),-1),1));r.up.applyMatrix4(rt.makeRotationAxis(e,s))}r.right.crossVectors(r.dir,r.up).normalize(),r.dist=n.dist+i,r.widthScale=1,r.sharp=!1,this.count++},n._corner=function(t,n,r,i,e){if(r>0&&i>0){for(var s=function(t,n,r,i,e,s){var o=$.subVectors(n,t),a=tt.subVectors(r,n),h=o.length(),u=a.length();o.normalize(),a.normalize();var c=Math.min(.999999*(e?h/2:h),i);s.v0.copy(n).sub(o.multiplyScalar(c)),s.v1.copy(n);var l=Math.min(u/2*.999999,i);return s.v2.copy(n).add(a.multiplyScalar(l)),s}(this.array[this.count-1].pos,t,n,r,this.count-1==0,it),o=s.getPoints(i),a=0;aNumber.EPSILON){c.normalize();var l=Math.acos(Math.min(Math.max(s.dir.dot(o.dir),-1),1));o.up.applyMatrix4(rt.makeRotationAxis(c,l))}o.right.crossVectors(o.dir,o.up).normalize()}o.dist=s.dist+u;var v=a.dot(h);o.widthScale=Math.min(1/Math.sqrt((1+v)/2),1.415)||1,o.sharp=Math.abs(v-1)>.05&&e,this.count++},t}(),st=new Q(0,0,1);function ot(t,n){n=Object.assign({},{lineWidth:1,cornerRadius:0,cornerSplit:10},n);var r=t.map((function(t){var r=t.map((function(t){var n=t[0],r=t[1],i=t[2];return new Q(n,r,i||0)})),i=new et;i.set(r,n.cornerRadius,n.cornerSplit,st);var e=function(t,n){var r=n.lineWidth||.1,i=1,e=r/2,s=r,o=t.distance(),a=i*o;if(0===o)return null;var h,u=e/s,c=0,l=[],v=[],f=[],p=[],x=0,d=new Q,y=new Q,g=new Q,m=new Q,z=new Q,w=new Q;function M(t){var n=0===l.length,r=t.sharp&&!n,i=t.dist/s,o=t.dir,a=t.up,h=t.right;if(d.copy(h).multiplyScalar(e*t.widthScale),y.copy(h).multiplyScalar(-e*t.widthScale),d.add(t.pos),y.add(t.pos),r){g.fromArray(l,l.length-6).sub(y),m.fromArray(l,l.length-3).sub(d);var M,b,A=g.length()-m.length();A>0?(M=g,b=y):(M=m,b=d),z.copy(M).setLength(Math.abs(A)).add(b);var P=w.copy(b).sub(z).normalize().dot(o)*w.copy(b).sub(z).length()*2;w.copy(o).setLength(P).add(z),A>0?(l.push(z.x,z.y,z.z,d.x,d.y,d.z,y.x,y.y,y.z,d.x,d.y,d.z,w.x,w.y,w.z,d.x,d.y,d.z),x+=6,p.push(x-6,x-8,x-7,x-6,x-7,x-5,x-4,x-6,x-5,x-2,x-4,x-1),c+=12):(l.push(y.x,y.y,y.z,z.x,z.y,z.z,y.x,y.y,y.z,d.x,d.y,d.z,y.x,y.y,y.z,w.x,w.y,w.z),x+=6,p.push(x-6,x-8,x-7,x-6,x-7,x-5,x-6,x-5,x-3,x-2,x-3,x-1),c+=12),v.push(a.x,a.y,a.z,a.x,a.y,a.z,a.x,a.y,a.z,a.x,a.y,a.z,a.x,a.y,a.z,a.x,a.y,a.z),f.push(i-u,0,i-u,1,i,0,i,1,i+u,0,i+u,1)}else l.push(y.x,y.y,y.z,d.x,d.y,d.z),v.push(a.x,a.y,a.z,a.x,a.y,a.z),f.push(i,0,i,1),x+=2,n||(p.push(x-2,x-4,x-3,x-2,x-3,x-1),c+=6)}if(a>0)for(var b=0;ba){var P=t.array[b-1];h=new X;var S=(a-P.dist)/(A.dist-P.dist);h.lerpPathPoints(P,A,S),M(h);break}M(A)}else h=t.array[0];return{points:l,normal:v,uvs:f,index:p,count:c}}(i,n);return e.line=t,e.position=new Float32Array(e.points),e.indices=new Uint32Array(e.index),e.uv=new Float32Array(e.uvs),e.normal=new Float32Array(e.normal),e})),i=I(r);return i.lines=t,i}var at={x:0,y:0},ht={x:0,y:0};function ut(t,n,r,i){for(var e=t.length,s=0;s0&&i80*r){e=o=t[0],a=h=t[1];for(var m=r;mo&&(o=u),v>h&&(h=v);f=0!==(f=Math.max(o-e,h-a))?32767/f:0}return s(y,g,r,e,a,f,0),g}function i(t,n,r,i,e){var s,a;if(e===V(t,n,r,i)>0)for(s=n;s=n;s-=i)a=A(s,t[s],t[s+1],a);return a&&g(a,a.next)&&(P(a),a=a.next),a}function e(t,n){if(!t)return t;n||(n=t);var r,i=t;do{if(r=!1,i.steiner||!g(i,i.next)&&0!==y(i.prev,i,i.next))i=i.next;else{if(P(i),(i=n=i.prev)===i.next)break;r=!0}}while(r||i!==n);return n}function s(t,n,r,i,l,c,v){if(t){!v&&c&&function(t,n,r,i){var e=t;do{0===e.z&&(e.z=f(e.x,e.y,n,r,i)),e.prevZ=e.prev,e.nextZ=e.next,e=e.next}while(e!==t);e.prevZ.nextZ=null,e.prevZ=null,function(t){var n,r,i,e,s,a,o,h,u=1;do{for(r=t,t=null,s=null,a=0;r;){for(a++,i=r,o=0,n=0;n0||h>0&&i;)0!==o&&(0===h||!i||r.z<=i.z)?(e=r,r=r.nextZ,o--):(e=i,i=i.nextZ,h--),s?s.nextZ=e:t=e,e.prevZ=s,s=e;r=i}s.nextZ=null,u*=2}while(a>1)}(e)}(t,i,l,c);for(var p,x,d=t;t.prev!==t.next;)if(p=t.prev,x=t.next,c?o(t,i,l,c):a(t))n.push(p.i/r|0),n.push(t.i/r|0),n.push(x.i/r|0),P(t),t=x.next,d=x.next;else if((t=x)===d){v?1===v?s(t=h(e(t),n,r),n,r,i,l,c,2):2===v&&u(t,n,r,i,l,c):s(e(t),n,r,i,l,c,1);break}}}function a(t){var n=t.prev,r=t,i=t.next;if(y(n,r,i)>=0)return!1;for(var e=n.x,s=r.x,a=i.x,o=n.y,h=r.y,u=i.y,l=es?e>a?e:a:s>a?s:a,f=o>h?o>u?o:u:h>u?h:u,p=i.next;p!==n;){if(p.x>=l&&p.x<=v&&p.y>=c&&p.y<=f&&x(e,o,s,h,a,u,p.x,p.y)&&y(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function o(t,n,r,i){var e=t.prev,s=t,a=t.next;if(y(e,s,a)>=0)return!1;for(var o=e.x,h=s.x,u=a.x,l=e.y,c=s.y,v=a.y,p=oh?o>u?o:u:h>u?h:u,m=l>c?l>v?l:v:c>v?c:v,z=f(p,d,n,r,i),M=f(g,m,n,r,i),w=t.prevZ,b=t.nextZ;w&&w.z>=z&&b&&b.z<=M;){if(w.x>=p&&w.x<=g&&w.y>=d&&w.y<=m&&w!==e&&w!==a&&x(o,l,h,c,u,v,w.x,w.y)&&y(w.prev,w,w.next)>=0)return!1;if(w=w.prevZ,b.x>=p&&b.x<=g&&b.y>=d&&b.y<=m&&b!==e&&b!==a&&x(o,l,h,c,u,v,b.x,b.y)&&y(b.prev,b,b.next)>=0)return!1;b=b.nextZ}for(;w&&w.z>=z;){if(w.x>=p&&w.x<=g&&w.y>=d&&w.y<=m&&w!==e&&w!==a&&x(o,l,h,c,u,v,w.x,w.y)&&y(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;b&&b.z<=M;){if(b.x>=p&&b.x<=g&&b.y>=d&&b.y<=m&&b!==e&&b!==a&&x(o,l,h,c,u,v,b.x,b.y)&&y(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function h(t,n,r){var i=t;do{var s=i.prev,a=i.next.next;!g(s,a)&&m(s,i,i.next,a)&&w(s,a)&&w(a,s)&&(n.push(s.i/r|0),n.push(i.i/r|0),n.push(a.i/r|0),P(i),P(i.next),i=t=a),i=i.next}while(i!==t);return e(i)}function u(t,n,r,i,a,o){var h=t;do{for(var u=h.next.next;u!==h.prev;){if(h.i!==u.i&&d(h,u)){var l=b(h,u);return h=e(h,h.next),l=e(l,l.next),s(h,n,r,i,a,o,0),void s(l,n,r,i,a,o,0)}u=u.next}h=h.next}while(h!==t)}function l(t,n){return t.x-n.x}function c(t,n){var r=function(t,n){var r,i=n,e=t.x,s=t.y,a=-1/0;do{if(s<=i.y&&s>=i.next.y&&i.next.y!==i.y){var o=i.x+(s-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(o<=e&&o>a&&(a=o,r=i.x=i.x&&i.x>=l&&e!==i.x&&x(sr.x||i.x===r.x&&v(r,i)))&&(r=i,f=h)),i=i.next}while(i!==u);return r}(t,n);if(!r)return n;var i=b(r,t);return e(i,i.next),e(r,r.next)}function v(t,n){return y(t.prev,t,n.prev)<0&&y(n.next,t,t.next)<0}function f(t,n,r,i,e){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*e|0)|t<<8))|t<<4))|t<<2))|t<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-i)*e|0)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function p(t){var n=t,r=t;do{(n.x=(t-a)*(s-o)&&(t-a)*(i-o)>=(r-a)*(n-o)&&(r-a)*(s-o)>=(e-a)*(i-o)}function d(t,n){return t.next.i!==n.i&&t.prev.i!==n.i&&!function(t,n){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==n.i&&r.next.i!==n.i&&m(r,r.next,t,n))return!0;r=r.next}while(r!==t);return!1}(t,n)&&(w(t,n)&&w(n,t)&&function(t,n){var r=t,i=!1,e=(t.x+n.x)/2,s=(t.y+n.y)/2;do{r.y>s!=r.next.y>s&&r.next.y!==r.y&&e<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next}while(r!==t);return i}(t,n)&&(y(t.prev,t,n.prev)||y(t,n.prev,n))||g(t,n)&&y(t.prev,t,t.next)>0&&y(n.prev,n,n.next)>0)}function y(t,n,r){return(n.y-t.y)*(r.x-n.x)-(n.x-t.x)*(r.y-n.y)}function g(t,n){return t.x===n.x&&t.y===n.y}function m(t,n,r,i){var e=M(y(t,n,r)),s=M(y(t,n,i)),a=M(y(r,i,t)),o=M(y(r,i,n));return e!==s&&a!==o||(!(0!==e||!z(t,r,n))||(!(0!==s||!z(t,i,n))||(!(0!==a||!z(r,t,i))||!(0!==o||!z(r,n,i)))))}function z(t,n,r){return n.x<=Math.max(t.x,r.x)&&n.x>=Math.min(t.x,r.x)&&n.y<=Math.max(t.y,r.y)&&n.y>=Math.min(t.y,r.y)}function M(t){return t>0?1:t<0?-1:0}function w(t,n){return y(t.prev,t,t.next)<0?y(t,n,t.next)>=0&&y(t,t.prev,n)>=0:y(t,n,t.prev)<0||y(t,t.next,n)<0}function b(t,n){var r=new S(t.i,t.x,t.y),i=new S(n.i,n.x,n.y),e=t.next,s=n.prev;return t.next=n,n.prev=t,r.next=e,e.prev=r,i.next=r,r.prev=i,s.next=i,i.prev=s,i}function A(t,n,r,i){var e=new S(t,n,r);return i?(e.next=i.next,e.prev=i,i.next.prev=e,i.next=e):(e.prev=e,e.next=e),e}function P(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function S(t,n,r){this.i=t,this.x=n,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function V(t,n,r,i){for(var e=0,s=n,a=r-i;s0&&(i+=t[e-1].length,r.holes.push(i))}return r};var Z=n.exports;function F(t){for(var n,r,i=0,e=1,s=t.length;e0}function L(t,n,r){return t[0]=n[0]-r[0],t[1]=n[1]-r[1],t[2]=n[2]-r[2],t}function _(t,n){var r=n[0],i=n[1],e=n[2],s=Math.sqrt(r*r+i*i+e*e)||1;return t[0]=r/s,t[1]=i/s,t[2]=e/s,t}function I(t,n){function r(t,n,r,i){t[0]=n,t[1]=r,t[2]=i}for(var i,e,s,a,o,h,u,l,c,v=[],f=[],p=[],x=[],d=[],y=[],g=t.length,m=new Float32Array(n.length),z=0;z0&&e.push(c/2);for(var d=0,y=x.length;d0&&(v=(v=v.map((function(t){return t}))).reverse());for(var f=0,p=v.length-1;f0}function W(t,n,r){var i=n[1]-t[1],e=n[0]-t[0],s=Math.atan2(i,e),a=s+Math.PI/2,o=Math.cos(a)*r,h=Math.sin(a)*r,u=[t[0]+o,t[1]+h],l=[n[0]+o,n[1]+h],c=s-Math.PI/2;return o=Math.cos(c)*r,h=Math.sin(c)*r,[[u,l],[[t[0]+o,t[1]+h],[n[0]+o,n[1]+h]]]}function D(t,n,r,i){var e=n[0]-t[0],s=n[1]-t[1],a=i[0]-r[0],o=i[1]-r[1];if(0===e&&0===a)return null;if(0===s&&0===o)return null;var h,u,l=s/e,c=o/a,v=t[1]-l*t[0],f=r[1]-c*r[0];return 0===e?u=c*(h=t[0])+f:0===a?u=l*(h=r[0])+v:0===s?h=((u=t[1])-f)/c:0===o?h=((u=r[1])-v)/l:u=l*(h=(f-v)/(l-c))+v,[h,u]}function Q(t,n){void 0===n&&(n={}),n=Object.assign({},{radius:1,height:2,radialSegments:6},n);for(var r=Math.round(Math.max(4,n.radialSegments)),i=n,e=i.radius,s=i.height,a=360/r/360*Math.PI*2,o=r+1,h=new Float32Array(3*o*2),u=t[0],l=t[1],c=0,v=0,f=3*o,p=2*o,x=[],d=[],y=-1;y1&&x.push(0,y-1,y)}h[c-=3]=h[0],h[c+1]=h[1],h[c+2]=h[2];var b=h.length;h[b-3]=h[0],h[b-2]=h[1],h[b-1]=s;for(var A=x.length,P=0;P0)){h=e;break}h=e-1}if(i[e=h]===r)return e/(s-1);var u=i[e];return(e+(r-u)/(i[e+1]-u))/(s-1)},t}()),tt=new X,nt=new X,rt=new X,it=new J,et=new $;var st=function(){function t(){this.array=[],this.count=0}var n=t.prototype;return n.set=function(t,n,r,i,e){if(void 0===n&&(n=.1),void 0===r&&(r=10),void 0===i&&(i=null),void 0===e&&(e=!1),(t=t.slice(0)).length<2)return console.warn("PathPointList: points length less than 2."),void(this.count=0);e&&!t[0].equals(t[t.length-1])&&t.push((new X).copy(t[0]));for(var s=0,a=t.length;s0?this.array[this.count-1].dist:0},n._getByIndex=function(t){return this.array[t]||(this.array[t]=new G),this.array[t]},n._start=function(t,n,r){this.count=0;var i=this._getByIndex(this.count);if(i.pos.copy(t),i.dir.subVectors(n,t),r)i.up.copy(r);else{var e=Number.MAX_VALUE,s=Math.abs(i.dir.x),a=Math.abs(i.dir.y),o=Math.abs(i.dir.z);sNumber.EPSILON){e.normalize();var s=Math.acos(Math.min(Math.max(n.dir.dot(r.dir),-1),1));r.up.applyMatrix4(it.makeRotationAxis(e,s))}r.right.crossVectors(r.dir,r.up).normalize(),r.dist=n.dist+i,r.widthScale=1,r.sharp=!1,this.count++},n._corner=function(t,n,r,i,e){if(r>0&&i>0){for(var s=function(t,n,r,i,e,s){var a=tt.subVectors(n,t),o=nt.subVectors(r,n),h=a.length(),u=o.length();a.normalize(),o.normalize();var l=Math.min(.999999*(e?h/2:h),i);s.v0.copy(n).sub(a.multiplyScalar(l)),s.v1.copy(n);var c=Math.min(u/2*.999999,i);return s.v2.copy(n).add(o.multiplyScalar(c)),s}(this.array[this.count-1].pos,t,n,r,this.count-1==0,et),a=s.getPoints(i),o=0;oNumber.EPSILON){l.normalize();var c=Math.acos(Math.min(Math.max(s.dir.dot(a.dir),-1),1));a.up.applyMatrix4(it.makeRotationAxis(l,c))}a.right.crossVectors(a.dir,a.up).normalize()}a.dist=s.dist+u;var v=o.dot(h);a.widthScale=Math.min(1/Math.sqrt((1+v)/2),1.415)||1,a.sharp=Math.abs(v-1)>.05&&e,this.count++},t}(),at=new X(0,0,1);function ot(t,n){n=Object.assign({},{lineWidth:1,cornerRadius:0,cornerSplit:10},n);var r=t.map((function(t){var r=t.map((function(t){var n=t[0],r=t[1],i=t[2];return new X(n,r,i||0)})),i=new st;i.set(r,n.cornerRadius,n.cornerSplit,at);var e=function(t,n){var r=n.lineWidth||.1,i=1,e=r/2,s=r,a=t.distance(),o=i*a;if(0===a)return null;var h,u=e/s,l=0,c=[],v=[],f=[],p=[],x=0,d=new X,y=new X,g=new X,m=new X,z=new X,M=new X;function w(t){var n=0===c.length,r=t.sharp&&!n,i=t.dist/s,a=t.dir,o=t.up,h=t.right;if(d.copy(h).multiplyScalar(e*t.widthScale),y.copy(h).multiplyScalar(-e*t.widthScale),d.add(t.pos),y.add(t.pos),r){g.fromArray(c,c.length-6).sub(y),m.fromArray(c,c.length-3).sub(d);var w,b,A=g.length()-m.length();A>0?(w=g,b=y):(w=m,b=d),z.copy(w).setLength(Math.abs(A)).add(b);var P=M.copy(b).sub(z).normalize().dot(a)*M.copy(b).sub(z).length()*2;M.copy(a).setLength(P).add(z),A>0?(c.push(z.x,z.y,z.z,d.x,d.y,d.z,y.x,y.y,y.z,d.x,d.y,d.z,M.x,M.y,M.z,d.x,d.y,d.z),x+=6,p.push(x-6,x-8,x-7,x-6,x-7,x-5,x-4,x-6,x-5,x-2,x-4,x-1),l+=12):(c.push(y.x,y.y,y.z,z.x,z.y,z.z,y.x,y.y,y.z,d.x,d.y,d.z,y.x,y.y,y.z,M.x,M.y,M.z),x+=6,p.push(x-6,x-8,x-7,x-6,x-7,x-5,x-6,x-5,x-3,x-2,x-3,x-1),l+=12),v.push(o.x,o.y,o.z,o.x,o.y,o.z,o.x,o.y,o.z,o.x,o.y,o.z,o.x,o.y,o.z,o.x,o.y,o.z),f.push(i-u,0,i-u,1,i,0,i,1,i+u,0,i+u,1)}else c.push(y.x,y.y,y.z,d.x,d.y,d.z),v.push(o.x,o.y,o.z,o.x,o.y,o.z),f.push(i,0,i,1),x+=2,n||(p.push(x-2,x-4,x-3,x-2,x-3,x-1),l+=6)}if(o>0)for(var b=0;bo){var P=t.array[b-1];h=new G;var S=(o-P.dist)/(A.dist-P.dist);h.lerpPathPoints(P,A,S),w(h);break}w(A)}else h=t.array[0];return{points:c,normal:v,uvs:f,index:p,count:l}}(i,n);return e.line=t,e.position=new Float32Array(e.points),e.indices=new Uint32Array(e.index),e.uv=new Float32Array(e.uvs),e.normal=new Float32Array(e.normal),e})),i=E(r);return i.lines=t,i}var ht={x:0,y:0},ut={x:0,y:0};function lt(t,n,r,i){for(var e=t.length,s=0;s0&&i