poly-extrude 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/poly-extrude.js +333 -107
- package/dist/poly-extrude.js.map +1 -1
- package/dist/poly-extrude.min.js +3 -3
- package/dist/poly-extrude.mjs +333 -107
- package/package.json +1 -1
- package/readme.md +22 -26
- package/src/cylinder.js +32 -10
- package/src/path.js +176 -72
- package/src/polygon.js +46 -26
- package/src/polyline.js +40 -16
- package/src/tube.js +14 -14
- package/src/util.js +27 -9
package/dist/poly-extrude.min.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
|
-
* poly-extrude v0.
|
2
|
+
* poly-extrude v0.9.0
|
3
3
|
*/
|
4
|
-
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((t="undefined"!=typeof globalThis?globalThis:t||self).polyextrude=t.polyextrude||{})}(this,(function(t){"use strict";var r={exports:{}};function n(t,r,n){n=n||2;var e,o,h,a,u,f,y,v=r&&r.length,x=v?r[0]*n:t.length,d=i(t,0,x,n,!0),g=[];if(!d||d.next===d.prev)return g;if(v&&(d=function(t,r,n,e){var s,o,h,a=[];for(s=0,o=r.length;s<o;s++)(h=i(t,r[s]*e,s<o-1?r[s+1]*e:t.length,e,!1))===h.next&&(h.steiner=!0),a.push(p(h));for(a.sort(c),s=0;s<a.length;s++)n=l(a[s],n);return n}(t,r,d,n)),t.length>80*n){e=h=t[0],o=a=t[1];for(var _=n;_<x;_+=n)(u=t[_])<e&&(e=u),(f=t[_+1])<o&&(o=f),u>h&&(h=u),f>a&&(a=f);y=0!==(y=Math.max(h-e,a-o))?32767/y:0}return s(d,g,n,e,o,y,0),g}function i(t,r,n,i,e){var s,o;if(e===A(t,r,n,i)>0)for(s=r;s<n;s+=i)o=b(s,t[s],t[s+1],o);else for(s=n-i;s>=r;s-=i)o=b(s,t[s],t[s+1],o);return o&&g(o,o.next)&&(P(o),o=o.next),o}function e(t,r){if(!t)return t;r||(r=t);var n,i=t;do{if(n=!1,i.steiner||!g(i,i.next)&&0!==d(i.prev,i,i.next))i=i.next;else{if(P(i),(i=r=i.prev)===i.next)break;n=!0}}while(n||i!==r);return r}function s(t,r,n,i,c,l,f){if(t){!f&&l&&function(t,r,n,i){var e=t;do{0===e.z&&(e.z=y(e.x,e.y,r,n,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 r,n,i,e,s,o,h,a,u=1;do{for(n=t,t=null,s=null,o=0;n;){for(o++,i=n,h=0,r=0;r<u&&(h++,i=i.nextZ);r++);for(a=u;h>0||a>0&&i;)0!==h&&(0===a||!i||n.z<=i.z)?(e=n,n=n.nextZ,h--):(e=i,i=i.nextZ,a--),s?s.nextZ=e:t=e,e.prevZ=s,s=e;n=i}s.nextZ=null,u*=2}while(o>1)}(e)}(t,i,c,l);for(var p,v,x=t;t.prev!==t.next;)if(p=t.prev,v=t.next,l?h(t,i,c,l):o(t))r.push(p.i/n|0),r.push(t.i/n|0),r.push(v.i/n|0),P(t),t=v.next,x=v.next;else if((t=v)===x){f?1===f?s(t=a(e(t),r,n),r,n,i,c,l,2):2===f&&u(t,r,n,i,c,l):s(e(t),r,n,i,c,l,1);break}}}function o(t){var r=t.prev,n=t,i=t.next;if(d(r,n,i)>=0)return!1;for(var e=r.x,s=n.x,o=i.x,h=r.y,a=n.y,u=i.y,c=e<s?e<o?e:o:s<o?s:o,l=h<a?h<u?h:u:a<u?a:u,f=e>s?e>o?e:o:s>o?s:o,y=h>a?h>u?h:u:a>u?a:u,p=i.next;p!==r;){if(p.x>=c&&p.x<=f&&p.y>=l&&p.y<=y&&v(e,h,s,a,o,u,p.x,p.y)&&d(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function h(t,r,n,i){var e=t.prev,s=t,o=t.next;if(d(e,s,o)>=0)return!1;for(var h=e.x,a=s.x,u=o.x,c=e.y,l=s.y,f=o.y,p=h<a?h<u?h:u:a<u?a:u,x=c<l?c<f?c:f:l<f?l:f,g=h>a?h>u?h:u:a>u?a:u,_=c>l?c>f?c:f:l>f?l:f,m=y(p,x,r,n,i),w=y(g,_,r,n,i),z=t.prevZ,M=t.nextZ;z&&z.z>=m&&M&&M.z<=w;){if(z.x>=p&&z.x<=g&&z.y>=x&&z.y<=_&&z!==e&&z!==o&&v(h,c,a,l,u,f,z.x,z.y)&&d(z.prev,z,z.next)>=0)return!1;if(z=z.prevZ,M.x>=p&&M.x<=g&&M.y>=x&&M.y<=_&&M!==e&&M!==o&&v(h,c,a,l,u,f,M.x,M.y)&&d(M.prev,M,M.next)>=0)return!1;M=M.nextZ}for(;z&&z.z>=m;){if(z.x>=p&&z.x<=g&&z.y>=x&&z.y<=_&&z!==e&&z!==o&&v(h,c,a,l,u,f,z.x,z.y)&&d(z.prev,z,z.next)>=0)return!1;z=z.prevZ}for(;M&&M.z<=w;){if(M.x>=p&&M.x<=g&&M.y>=x&&M.y<=_&&M!==e&&M!==o&&v(h,c,a,l,u,f,M.x,M.y)&&d(M.prev,M,M.next)>=0)return!1;M=M.nextZ}return!0}function a(t,r,n){var i=t;do{var s=i.prev,o=i.next.next;!g(s,o)&&_(s,i,i.next,o)&&z(s,o)&&z(o,s)&&(r.push(s.i/n|0),r.push(i.i/n|0),r.push(o.i/n|0),P(i),P(i.next),i=t=o),i=i.next}while(i!==t);return e(i)}function u(t,r,n,i,o,h){var a=t;do{for(var u=a.next.next;u!==a.prev;){if(a.i!==u.i&&x(a,u)){var c=M(a,u);return a=e(a,a.next),c=e(c,c.next),s(a,r,n,i,o,h,0),void s(c,r,n,i,o,h,0)}u=u.next}a=a.next}while(a!==t)}function c(t,r){return t.x-r.x}function l(t,r){var n=function(t,r){var n,i=r,e=t.x,s=t.y,o=-1/0;do{if(s<=i.y&&s>=i.next.y&&i.next.y!==i.y){var h=i.x+(s-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(h<=e&&h>o&&(o=h,n=i.x<i.next.x?i:i.next,h===e))return n}i=i.next}while(i!==r);if(!n)return null;var a,u=n,c=n.x,l=n.y,y=1/0;i=n;do{e>=i.x&&i.x>=c&&e!==i.x&&v(s<l?e:o,s,c,l,s<l?o:e,s,i.x,i.y)&&(a=Math.abs(s-i.y)/(e-i.x),z(i,t)&&(a<y||a===y&&(i.x>n.x||i.x===n.x&&f(n,i)))&&(n=i,y=a)),i=i.next}while(i!==u);return n}(t,r);if(!n)return r;var i=M(n,t);return e(i,i.next),e(n,n.next)}function f(t,r){return d(t.prev,t,r.prev)<0&&d(r.next,t,t.next)<0}function y(t,r,n,i,e){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*e|0)|t<<8))|t<<4))|t<<2))|t<<1))|(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-i)*e|0)|r<<8))|r<<4))|r<<2))|r<<1))<<1}function p(t){var r=t,n=t;do{(r.x<n.x||r.x===n.x&&r.y<n.y)&&(n=r),r=r.next}while(r!==t);return n}function v(t,r,n,i,e,s,o,h){return(e-o)*(r-h)>=(t-o)*(s-h)&&(t-o)*(i-h)>=(n-o)*(r-h)&&(n-o)*(s-h)>=(e-o)*(i-h)}function x(t,r){return t.next.i!==r.i&&t.prev.i!==r.i&&!function(t,r){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==r.i&&n.next.i!==r.i&&_(n,n.next,t,r))return!0;n=n.next}while(n!==t);return!1}(t,r)&&(z(t,r)&&z(r,t)&&function(t,r){var n=t,i=!1,e=(t.x+r.x)/2,s=(t.y+r.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&e<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==t);return i}(t,r)&&(d(t.prev,t,r.prev)||d(t,r.prev,r))||g(t,r)&&d(t.prev,t,t.next)>0&&d(r.prev,r,r.next)>0)}function d(t,r,n){return(r.y-t.y)*(n.x-r.x)-(r.x-t.x)*(n.y-r.y)}function g(t,r){return t.x===r.x&&t.y===r.y}function _(t,r,n,i){var e=w(d(t,r,n)),s=w(d(t,r,i)),o=w(d(n,i,t)),h=w(d(n,i,r));return e!==s&&o!==h||(!(0!==e||!m(t,n,r))||(!(0!==s||!m(t,i,r))||(!(0!==o||!m(n,t,i))||!(0!==h||!m(n,r,i)))))}function m(t,r,n){return r.x<=Math.max(t.x,n.x)&&r.x>=Math.min(t.x,n.x)&&r.y<=Math.max(t.y,n.y)&&r.y>=Math.min(t.y,n.y)}function w(t){return t>0?1:t<0?-1:0}function z(t,r){return d(t.prev,t,t.next)<0?d(t,r,t.next)>=0&&d(t,t.prev,r)>=0:d(t,r,t.prev)<0||d(t,t.next,r)<0}function M(t,r){var n=new S(t.i,t.x,t.y),i=new S(r.i,r.x,r.y),e=t.next,s=r.prev;return t.next=r,r.prev=t,n.next=e,e.prev=n,i.next=n,n.prev=i,s.next=i,i.prev=s,i}function b(t,r,n,i){var e=new S(t,r,n);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,r,n){this.i=t,this.x=r,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function A(t,r,n,i){for(var e=0,s=r,o=n-i;s<n;s+=i)e+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return e}r.exports=n,r.exports.default=n,n.deviation=function(t,r,n,i){var e=r&&r.length,s=e?r[0]*n:t.length,o=Math.abs(A(t,0,s,n));if(e)for(var h=0,a=r.length;h<a;h++){var u=r[h]*n,c=h<a-1?r[h+1]*n:t.length;o-=Math.abs(A(t,u,c,n))}var l=0;for(h=0;h<i.length;h+=3){var f=i[h]*n,y=i[h+1]*n,p=i[h+2]*n;l+=Math.abs((t[f]-t[p])*(t[y+1]-t[f+1])-(t[f]-t[y])*(t[p+1]-t[f+1]))}return 0===o&&0===l?0:Math.abs((l-o)/o)},n.flatten=function(t){for(var r=t[0][0].length,n={vertices:[],holes:[],dimensions:r},i=0,e=0;e<t.length;e++){for(var s=0;s<t[e].length;s++)for(var o=0;o<r;o++)n.vertices.push(t[e][s][o]);e>0&&(i+=t[e-1].length,n.holes.push(i))}return n};var L=r.exports;function k(t){for(var r,n,i=0,e=1,s=t.length;e<s;)r=n||t[0],i+=((n=t[e])[0]-r[0])*(n[1]+r[1]),e++;return i>0}function C(t,r,n){return t[0]=r[0]-n[0],t[1]=r[1]-n[1],t[2]=r[2]-n[2],t}function E(t,r){var n=r[0],i=r[1],e=r[2],s=Math.sqrt(n*n+i*i+e*e)||1;return t[0]=n/s,t[1]=i/s,t[2]=e/s,t}function F(t,r){function n(t,r,n,i){t[0]=r,t[1]=n,t[2]=i}for(var i,e,s,o,h,a,u,c,l,f=[],y=[],p=[],v=[],x=[],d=[],g=t.length,_=new Float32Array(r.length),m=0;m<g;){var w=3*t[m],z=3*t[m+1],M=3*t[m+2];n(f,r[w],r[w+1],r[w+2]),n(y,r[z],r[z+1],r[z+2]),n(p,r[M],r[M+1],r[M+2]),C(x,p,y),C(v,f,y),i=d,s=v,o=void 0,h=void 0,a=void 0,u=void 0,c=void 0,l=void 0,o=(e=x)[0],h=e[1],a=e[2],u=s[0],c=s[1],l=s[2],i[0]=h*l-a*c,i[1]=a*u-o*l,i[2]=o*c-h*u;for(var b=0;b<3;b++)_[w+b]+=d[b],_[z+b]+=d[b],_[M+b]+=d[b];m+=3}for(var P=0,S=_.length;P<S;)n(d,_[P],_[P+1],_[P+2]),E(d,d),_[P]=d[0]||0,_[P+1]=d[1]||0,_[P+2]=d[2]||0,P+=3;return _}function Z(t){if(1===t.length)return{position:t[0].position,normal:t[0].normal,uv:t[0].uv,indices:t[0].indices,results:t};for(var r=0,n=0,i=0,e=t.length;i<e;i++){var s=t[i],o=s.position,h=s.indices;r+=o.length,n+=h.length}for(var a={position:new Float32Array(r),normal:new Float32Array(r),uv:new Float32Array(r/3*2),indices:new Uint32Array(n),results:t},u=0,c=0,l=0,f=0,y=0,p=t.length;y<p;y++){var v=t[y],x=v.position,d=v.indices,g=v.normal,_=v.uv;a.position.set(x,u),a.normal.set(g,u),a.uv.set(_,f);for(var m=0,w=d.length;m<w;){var z=d[m]+c;a.indices[l]=z,l++,m++}f+=_.length,u+=x.length,c+=x.length/3}return a}function O(t){return 180*t/Math.PI}function V(t){return t/180*Math.PI}function j(t,r,n,i,e,s){var o=3*n,h=3*i,a=3*e,u=3*s,c=r[o],l=r[o+1],f=r[o+2],y=r[h],p=r[h+1],v=r[h+2],x=r[a],d=r[a+1],g=r[a+2],_=r[u],m=r[u+1],w=r[u+2];Math.abs(l-p)<Math.abs(c-y)?(t.push(c,1-f),t.push(y,1-v),t.push(x,1-g),t.push(_,1-w)):(t.push(l,1-f),t.push(p,1-v),t.push(d,1-g),t.push(m,1-w))}function I(t){q(t)||t.push(t[0])}function q(t){var r=t.length,n=t[0],i=n[0],e=n[1],s=t[r-1],o=s[0],h=s[1];return i===o&&e===h}function N(t){t.lineWidth=Math.max(0,t.lineWidth),t.depth=Math.max(0,t.depth),t.sideDepth=Math.max(0,t.sideDepth)}function T(t,r){var n=r.bottomStickGround,i=r.depth,e=t.depths,s=i,o=i;e&&(s=e[0],o=e[1]);for(var h=[],a=[],u=[],c=t.leftPoints,l=t.rightPoints,f=0,y=c.length;f<y;){var p=3*f,v=c[f],x=v[0],d=v[1],g=v[2];h[p]=x,h[p+1]=d,h[p+2]=s+g;var _=l[f],m=_[0],w=_[1],z=_[2],M=3*y+p;h[M]=m,h[M+1]=w,h[M+2]=o+z;var b=2*y*3+p;h[b]=x,h[b+1]=d,h[b+2]=g,n&&(h[b+2]=0);var P=2*y*3+3*y+p;h[P]=m,h[P+1]=w,h[P+2]=z,n&&(h[P+2]=0),f++}for(f=0,y=h.length;f<y;){var S=h[f],A=h[f+1];u.push(S,A),f+=3}for(f=0,y=c.length;f<y-1;){var L=f,k=f+1,C=L+y,E=k+y;a.push(L,C,k),a.push(C,E,k);var F=f+2*y,Z=F+1,O=F+y,V=Z+y;a.push(F,O,Z),a.push(O,V,Z),f++}if(t.index=a,t.points=h,t.uvs=u,e)for(y=c.length,f=0;f<y;)c[f].depth=s,l[f].depth=o,f++}function U(t,r){var n=t.points,i=t.index,e=t.leftPoints,s=t.rightPoints,o=t.uvs,h=r.depth,a=r.bottomStickGround,u=[e,s],c=t.depths;function l(t,r){var e=n.length/3,s=n.length-1;n[++s]=t[0],n[++s]=t[1],n[++s]=(c?t.depth:h)+t[2],n[++s]=r[0],n[++s]=r[1],n[++s]=(c?r.depth:h)+r[2],n[++s]=t[0],n[++s]=t[1],n[++s]=a?0:t[2],n[++s]=r[0],n[++s]=r[1],n[++s]=a?0:r[2];var u=e+2,l=e+3,f=e,y=e+1;i.push(u,f,l,f,y,l),j(o,n,u,l,f,y)}for(var f=0,y=u.length;f<y;f++){var p=u[f];f>0&&(p=(p=p.map((function(t){return t}))).reverse());for(var v=0,x=p.length-1;v<x;){l(p[v],p[v+1]),v++}}for(var d=e.length,g=[s[0],e[0],e[d-1],s[d-1]],_=0;_<g.length;_+=2){l(g[_],g[_+1])}}var G={x:0,y:0},Q={x:0,y:0};function R(t,r){for(var n=r.lineWidth/2,i=[],e=[],s=[],o=t.length,h=0;h<o;){var a=t[h],u=t[h+1],c=t[h];h===o-1&&(a=t[o-2],u=t[o-1]);var l=u[1]-a[1],f=u[0]-a[0],y=0,p=O(Math.atan(l/f));if(0===h||h===o-1)y=p,y-=90;else{var v=t[h-1];G.x=v[0]-a[0],G.y=v[1]-a[1],Q.x=u[0]-a[0],Q.y=u[1]-a[1],y=p-Y(G,Q)/2}var x=V(y),d=c,g=[Math.cos(x)+d[0],Math.sin(x)+d[1]],_=X(a,u,n),m=_[0],w=_[1],z=B(m[0],m[1],d,g),M=B(w[0],w[1],d,g);if(!z||!M){var b=i.length,P=i[b-2],S=i[b-1];if(!P||!S)continue;z=[P[0],P[1]],M=[S[0],S[1]]}z[2]=c[2]||0,M[2]=c[2]||0,i.push(z,M),W(z,a,u)?(e.push(z),s.push(M)):(e.push(M),s.push(z)),h++}return{offsetPoints:i,leftPoints:e,rightPoints:s}}var Y=function(t,r){var n=t.x,i=t.y,e=r.x,s=r.y,o=n*e+i*s,h=n*s-i*e;return(Math.atan2(h,o)/Math.PI*180+360)%360};function W(t,r,n){var i=r[0],e=r[1],s=n[0],o=n[1];return(e-o)*t[0]+(s-i)*t[1]+i*o-s*e>0}function X(t,r,n){var i=r[1]-t[1],e=r[0]-t[0],s=Math.atan2(i,e),o=s+Math.PI/2,h=Math.cos(o)*n,a=Math.sin(o)*n,u=[t[0]+h,t[1]+a],c=[r[0]+h,r[1]+a],l=s-Math.PI/2;return h=Math.cos(l)*n,a=Math.sin(l)*n,[[u,c],[[t[0]+h,t[1]+a],[r[0]+h,r[1]+a]]]}function B(t,r,n,i){var e=r[0]-t[0],s=r[1]-t[1],o=i[0]-n[0],h=i[1]-n[1];if(0===e&&0===o)return null;if(0===s&&0===h)return null;var a,u,c=s/e,l=h/o,f=t[1]-c*t[0],y=n[1]-l*n[0];return 0===e?u=l*(a=t[0])+y:0===o?u=c*(a=n[0])+f:0===s?a=((u=t[1])-y)/l:0===h?a=((u=n[1])-f)/c:u=c*(a=(y-f)/(c-l))+f,[a,u]}function D(){
|
4
|
+
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).polyextrude=t.polyextrude||{})}(this,(function(t){"use strict";var n={exports:{}};function r(t,n,r){r=r||2;var e,o,a,h,u,f,y,p=n&&n.length,x=p?n[0]*r:t.length,d=i(t,0,x,r,!0),g=[];if(!d||d.next===d.prev)return g;if(p&&(d=function(t,n,r,e){var s,o,a,h=[];for(s=0,o=n.length;s<o;s++)(a=i(t,n[s]*e,s<o-1?n[s+1]*e:t.length,e,!1))===a.next&&(a.steiner=!0),h.push(v(a));for(h.sort(c),s=0;s<h.length;s++)r=l(h[s],r);return r}(t,n,d,r)),t.length>80*r){e=a=t[0],o=h=t[1];for(var _=r;_<x;_+=r)(u=t[_])<e&&(e=u),(f=t[_+1])<o&&(o=f),u>a&&(a=u),f>h&&(h=f);y=0!==(y=Math.max(a-e,h-o))?32767/y:0}return s(d,g,r,e,o,y,0),g}function i(t,n,r,i,e){var s,o;if(e===A(t,n,r,i)>0)for(s=n;s<r;s+=i)o=b(s,t[s],t[s+1],o);else for(s=r-i;s>=n;s-=i)o=b(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!==d(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,f){if(t){!f&&l&&function(t,n,r,i){var e=t;do{0===e.z&&(e.z=y(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;n<u&&(a++,i=i.nextZ);n++);for(h=u;a>0||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 v,p,x=t;t.prev!==t.next;)if(v=t.prev,p=t.next,l?a(t,i,c,l):o(t))n.push(v.i/r|0),n.push(t.i/r|0),n.push(p.i/r|0),P(t),t=p.next,x=p.next;else if((t=p)===x){f?1===f?s(t=h(e(t),n,r),n,r,i,c,l,2):2===f&&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(d(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=e<s?e<o?e:o:s<o?s:o,l=a<h?a<u?a:u:h<u?h:u,f=e>s?e>o?e:o:s>o?s:o,y=a>h?a>u?a:u:h>u?h:u,v=i.next;v!==n;){if(v.x>=c&&v.x<=f&&v.y>=l&&v.y<=y&&p(e,a,s,h,o,u,v.x,v.y)&&d(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function a(t,n,r,i){var e=t.prev,s=t,o=t.next;if(d(e,s,o)>=0)return!1;for(var a=e.x,h=s.x,u=o.x,c=e.y,l=s.y,f=o.y,v=a<h?a<u?a:u:h<u?h:u,x=c<l?c<f?c:f:l<f?l:f,g=a>h?a>u?a:u:h>u?h:u,_=c>l?c>f?c:f:l>f?l:f,m=y(v,x,n,r,i),w=y(g,_,n,r,i),z=t.prevZ,M=t.nextZ;z&&z.z>=m&&M&&M.z<=w;){if(z.x>=v&&z.x<=g&&z.y>=x&&z.y<=_&&z!==e&&z!==o&&p(a,c,h,l,u,f,z.x,z.y)&&d(z.prev,z,z.next)>=0)return!1;if(z=z.prevZ,M.x>=v&&M.x<=g&&M.y>=x&&M.y<=_&&M!==e&&M!==o&&p(a,c,h,l,u,f,M.x,M.y)&&d(M.prev,M,M.next)>=0)return!1;M=M.nextZ}for(;z&&z.z>=m;){if(z.x>=v&&z.x<=g&&z.y>=x&&z.y<=_&&z!==e&&z!==o&&p(a,c,h,l,u,f,z.x,z.y)&&d(z.prev,z,z.next)>=0)return!1;z=z.prevZ}for(;M&&M.z<=w;){if(M.x>=v&&M.x<=g&&M.y>=x&&M.y<=_&&M!==e&&M!==o&&p(a,c,h,l,u,f,M.x,M.y)&&d(M.prev,M,M.next)>=0)return!1;M=M.nextZ}return!0}function h(t,n,r){var i=t;do{var s=i.prev,o=i.next.next;!g(s,o)&&_(s,i,i.next,o)&&z(s,o)&&z(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&&x(h,u)){var c=M(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.next.x?i:i.next,a===e))return r}i=i.next}while(i!==n);if(!r)return null;var h,u=r,c=r.x,l=r.y,y=1/0;i=r;do{e>=i.x&&i.x>=c&&e!==i.x&&p(s<l?e:o,s,c,l,s<l?o:e,s,i.x,i.y)&&(h=Math.abs(s-i.y)/(e-i.x),z(i,t)&&(h<y||h===y&&(i.x>r.x||i.x===r.x&&f(r,i)))&&(r=i,y=h)),i=i.next}while(i!==u);return r}(t,n);if(!r)return n;var i=M(r,t);return e(i,i.next),e(r,r.next)}function f(t,n){return d(t.prev,t,n.prev)<0&&d(n.next,t,t.next)<0}function y(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 v(t){var n=t,r=t;do{(n.x<r.x||n.x===r.x&&n.y<r.y)&&(r=n),n=n.next}while(n!==t);return r}function p(t,n,r,i,e,s,o,a){return(e-o)*(n-a)>=(t-o)*(s-a)&&(t-o)*(i-a)>=(r-o)*(n-a)&&(r-o)*(s-a)>=(e-o)*(i-a)}function x(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&&_(r,r.next,t,n))return!0;r=r.next}while(r!==t);return!1}(t,n)&&(z(t,n)&&z(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)&&(d(t.prev,t,n.prev)||d(t,n.prev,n))||g(t,n)&&d(t.prev,t,t.next)>0&&d(n.prev,n,n.next)>0)}function d(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 _(t,n,r,i){var e=w(d(t,n,r)),s=w(d(t,n,i)),o=w(d(r,i,t)),a=w(d(r,i,n));return e!==s&&o!==a||(!(0!==e||!m(t,r,n))||(!(0!==s||!m(t,i,n))||(!(0!==o||!m(r,t,i))||!(0!==a||!m(r,n,i)))))}function m(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 z(t,n){return d(t.prev,t,t.next)<0?d(t,n,t.next)>=0&&d(t,t.prev,n)>=0:d(t,n,t.prev)<0||d(t,t.next,n)<0}function M(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 b(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 A(t,n,r,i){for(var e=0,s=n,o=r-i;s<r;s+=i)e+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return e}n.exports=r,n.exports.default=r,r.deviation=function(t,n,r,i){var e=n&&n.length,s=e?n[0]*r:t.length,o=Math.abs(A(t,0,s,r));if(e)for(var a=0,h=n.length;a<h;a++){var u=n[a]*r,c=a<h-1?n[a+1]*r:t.length;o-=Math.abs(A(t,u,c,r))}var l=0;for(a=0;a<i.length;a+=3){var f=i[a]*r,y=i[a+1]*r,v=i[a+2]*r;l+=Math.abs((t[f]-t[v])*(t[y+1]-t[f+1])-(t[f]-t[y])*(t[v+1]-t[f+1]))}return 0===o&&0===l?0:Math.abs((l-o)/o)},r.flatten=function(t){for(var n=t[0][0].length,r={vertices:[],holes:[],dimensions:n},i=0,e=0;e<t.length;e++){for(var s=0;s<t[e].length;s++)for(var o=0;o<n;o++)r.vertices.push(t[e][s][o]);e>0&&(i+=t[e-1].length,r.holes.push(i))}return r};var L=n.exports;function k(t){for(var n,r,i=0,e=1,s=t.length;e<s;)n=r||t[0],i+=((r=t[e])[0]-n[0])*(r[1]+n[1]),e++;return i>0}function C(t,n,r){return t[0]=n[0]-r[0],t[1]=n[1]-r[1],t[2]=n[2]-r[2],t}function E(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 F(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,f=[],y=[],v=[],p=[],x=[],d=[],g=t.length,_=new Float32Array(n.length),m=0;m<g;){var w=3*t[m],z=3*t[m+1],M=3*t[m+2];r(f,n[w],n[w+1],n[w+2]),r(y,n[z],n[z+1],n[z+2]),r(v,n[M],n[M+1],n[M+2]),C(x,v,y),C(p,f,y),i=d,s=p,o=void 0,a=void 0,h=void 0,u=void 0,c=void 0,l=void 0,o=(e=x)[0],a=e[1],h=e[2],u=s[0],c=s[1],l=s[2],i[0]=a*l-h*c,i[1]=h*u-o*l,i[2]=o*c-a*u;for(var b=0;b<3;b++)_[w+b]+=d[b],_[z+b]+=d[b],_[M+b]+=d[b];m+=3}for(var P=0,S=_.length;P<S;)r(d,_[P],_[P+1],_[P+2]),E(d,d),_[P]=d[0]||0,_[P+1]=d[1]||0,_[P+2]=d[2]||0,P+=3;return _}function Z(t){if(1===t.length)return{position:t[0].position,normal:t[0].normal,uv:t[0].uv,indices:t[0].indices,results:t};for(var n=0,r=0,i=0,e=t.length;i<e;i++){var s=t[i],o=s.position,a=s.indices;n+=o.length,r+=a.length}for(var h={position:new Float32Array(n),normal:new Float32Array(n),uv:new Float32Array(n/3*2),indices:new Uint32Array(r),results:t},u=0,c=0,l=0,f=0,y=0,v=t.length;y<v;y++){var p=t[y],x=p.position,d=p.indices,g=p.normal,_=p.uv;h.position.set(x,u),h.normal.set(g,u),h.uv.set(_,f);for(var m=0,w=d.length;m<w;){var z=d[m]+c;h.indices[l]=z,l++,m++}f+=_.length,u+=x.length,c+=x.length/3}return h}function O(t){return 180*t/Math.PI}function V(t){return t/180*Math.PI}function j(t,n,r,i,e,s){var o=3*r,a=3*i,h=3*e,u=3*s,c=n[o],l=n[o+1],f=n[o+2],y=n[a],v=n[a+1],p=n[a+2],x=n[h],d=n[h+1],g=n[h+2],_=n[u],m=n[u+1],w=n[u+2],z=t.length-1;Math.abs(l-v)<Math.abs(c-y)?(t[++z]=c,t[++z]=1-f,t[++z]=y,t[++z]=1-p,t[++z]=x,t[++z]=1-g,t[++z]=_,t[++z]=1-w):(t[++z]=l,t[++z]=1-f,t[++z]=v,t[++z]=1-p,t[++z]=d,t[++z]=1-g,t[++z]=m,t[++z]=1-w)}function I(t){q(t)||t.push(t[0])}function q(t){var n=t.length,r=t[0],i=r[0],e=r[1],s=t[n-1],o=s[0],a=s[1];return i===o&&e===a}function N(t){t.lineWidth=Math.max(0,t.lineWidth),t.depth=Math.max(0,t.depth),t.sideDepth=Math.max(0,t.sideDepth)}function T(t,n){var r=n.bottomStickGround,i=n.depth,e=t.depths,s=i,o=i;e&&(s=e[0],o=e[1]);for(var a=[],h=[],u=[],c=t.leftPoints,l=t.rightPoints,f=0,y=c.length;f<y;){var v=3*f,p=c[f],x=p[0],d=p[1],g=p[2];a[v]=x,a[v+1]=d,a[v+2]=s+g;var _=l[f],m=_[0],w=_[1],z=_[2],M=3*y+v;a[M]=m,a[M+1]=w,a[M+2]=o+z;var b=2*y*3+v;a[b]=x,a[b+1]=d,a[b+2]=g,r&&(a[b+2]=0);var P=2*y*3+3*y+v;a[P]=m,a[P+1]=w,a[P+2]=z,r&&(a[P+2]=0),f++}f=0,y=a.length;for(var S=u.length-1;f<y;){var A=a[f],L=a[f+1];u[++S]=A,u[++S]=L,f+=3}f=0,y=c.length;for(var k=h.length-1;f<y-1;){var C=f,E=f+1,F=C+y,Z=E+y;h[++k]=C,h[++k]=F,h[++k]=E,h[++k]=F,h[++k]=Z,h[++k]=E;var O=f+2*y,V=O+1,j=O+y,I=V+y;h[++k]=O,h[++k]=j,h[++k]=V,h[++k]=j,h[++k]=I,h[++k]=V,f++}if(t.indices=h,t.points=a,t.uv=u,e)for(y=c.length,f=0;f<y;)c[f].depth=s,l[f].depth=o,f++}function U(t,n){var r=t.points,i=t.indices,e=t.leftPoints,s=t.rightPoints,o=t.uv,a=n.depth,h=n.bottomStickGround,u=[e,s],c=t.depths,l=r.length-1,f=i.length-1;function y(t,n){var e=r.length/3;r[++l]=t[0],r[++l]=t[1],r[++l]=(c?t.depth:a)+t[2],r[++l]=n[0],r[++l]=n[1],r[++l]=(c?n.depth:a)+n[2],r[++l]=t[0],r[++l]=t[1],r[++l]=h?0:t[2],r[++l]=n[0],r[++l]=n[1],r[++l]=h?0:n[2];var s=e+2,u=e+3,y=e,v=e+1;i[++f]=s,i[++f]=y,i[++f]=u,i[++f]=y,i[++f]=v,i[++f]=u,j(o,r,s,u,y,v)}for(var v=0,p=u.length;v<p;v++){var x=u[v];v>0&&(x=(x=x.map((function(t){return t}))).reverse());for(var d=0,g=x.length-1;d<g;){y(x[d],x[d+1]),d++}}for(var _=e.length,m=[s[0],e[0],e[_-1],s[_-1]],w=0;w<m.length;w+=2){y(m[w],m[w+1])}}var G={x:0,y:0},Q={x:0,y:0};function R(t,n){for(var r=n.lineWidth/2,i=[],e=[],s=[],o=t.length,a=0;a<o;){var h=t[a],u=t[a+1],c=t[a];a===o-1&&(h=t[o-2],u=t[o-1]);var l=u[1]-h[1],f=u[0]-h[0],y=0,v=O(Math.atan(l/f));if(0===a||a===o-1)y=v,y-=90;else{var p=t[a-1];G.x=p[0]-h[0],G.y=p[1]-h[1],Q.x=u[0]-h[0],Q.y=u[1]-h[1],y=v-Y(G,Q)/2}var x=V(y),d=c,g=[Math.cos(x)+d[0],Math.sin(x)+d[1]],_=X(h,u,r),m=_[0],w=_[1],z=B(m[0],m[1],d,g),M=B(w[0],w[1],d,g);if(!z||!M){var b=i.length,P=i[b-2],S=i[b-1];if(!P||!S)continue;z=[P[0],P[1]],M=[S[0],S[1]]}z[2]=c[2]||0,M[2]=c[2]||0,i.push(z,M),W(z,h,u)?(e.push(z),s.push(M)):(e.push(M),s.push(z)),a++}return{offsetPoints:i,leftPoints:e,rightPoints:s}}var Y=function(t,n){var r=t.x,i=t.y,e=n.x,s=n.y,o=r*e+i*s,a=r*s-i*e;return(Math.atan2(a,o)/Math.PI*180+360)%360};function W(t,n,r){var i=n[0],e=n[1],s=r[0],o=r[1];return(e-o)*t[0]+(s-i)*t[1]+i*o-s*e>0}function X(t,n,r){var i=n[1]-t[1],e=n[0]-t[0],s=Math.atan2(i,e),o=s+Math.PI/2,a=Math.cos(o)*r,h=Math.sin(o)*r,u=[t[0]+a,t[1]+h],c=[n[0]+a,n[1]+h],l=s-Math.PI/2;return a=Math.cos(l)*r,h=Math.sin(l)*r,[[u,c],[[t[0]+a,t[1]+h],[n[0]+a,n[1]+h]]]}function B(t,n,r,i){var e=n[0]-t[0],s=n[1]-t[1],o=i[0]-r[0],a=i[1]-r[1];if(0===e&&0===o)return null;if(0===s&&0===a)return null;var h,u,c=s/e,l=a/o,f=t[1]-c*t[0],y=r[1]-l*r[0];return 0===e?u=l*(h=t[0])+y:0===o?u=c*(h=r[0])+f:0===s?h=((u=t[1])-y)/l:0===a?h=((u=r[1])-f)/c:u=c*(h=(y-f)/(c-l))+f,[h,u]}function D(){
|
5
5
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
6
|
-
D=function(){return t};var t={},r=Object.prototype,n=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},e=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag";function h(t,r,n){return Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{h({},"")}catch(t){h=function(t,r,n){return t[r]=n}}function a(t,r,n,i){var e=r&&r.prototype instanceof l?r:l,s=Object.create(e.prototype),o=new M(i||[]);return s._invoke=function(t,r,n){var i="suspendedStart";return function(e,s){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===e)throw s;return P()}for(n.method=e,n.arg=s;;){var o=n.delegate;if(o){var h=m(o,n);if(h){if(h===c)continue;return h}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var a=u(t,r,n);if("normal"===a.type){if(i=n.done?"completed":"suspendedYield",a.arg===c)continue;return{value:a.arg,done:n.done}}"throw"===a.type&&(i="completed",n.method="throw",n.arg=a.arg)}}}(t,n,o),s}function u(t,r,n){try{return{type:"normal",arg:t.call(r,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=a;var c={};function l(){}function f(){}function y(){}var p={};h(p,e,(function(){return this}));var v=Object.getPrototypeOf,x=v&&v(v(b([])));x&&x!==r&&n.call(x,e)&&(p=x);var d=y.prototype=l.prototype=Object.create(p);function g(t){["next","throw","return"].forEach((function(r){h(t,r,(function(t){return this._invoke(r,t)}))}))}function _(t,r){function i(e,s,o,h){var a=u(t[e],t,s);if("throw"!==a.type){var c=a.arg,l=c.value;return l&&"object"==typeof l&&n.call(l,"__await")?r.resolve(l.__await).then((function(t){i("next",t,o,h)}),(function(t){i("throw",t,o,h)})):r.resolve(l).then((function(t){c.value=t,o(c)}),(function(t){return i("throw",t,o,h)}))}h(a.arg)}var e;this._invoke=function(t,n){function s(){return new r((function(r,e){i(t,n,r,e)}))}return e=e?e.then(s,s):s()}}function m(t,r){var n=t.iterator[r.method];if(void 0===n){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,m(t,r),"throw"===r.method))return c;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var i=u(n,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,c;var e=i.arg;return e?e.done?(r[t.resultName]=e.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,c):e:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,c)}function w(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function z(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function M(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function b(t){if(t){var r=t[e];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,s=function r(){for(;++i<t.length;)if(n.call(t,i))return r.value=t[i],r.done=!1,r;return r.value=void 0,r.done=!0,r};return s.next=s}}return{next:P}}function P(){return{value:void 0,done:!0}}return f.prototype=y,h(d,"constructor",y),h(y,"constructor",f),f.displayName=h(y,o,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===f||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,h(t,o,"GeneratorFunction")),t.prototype=Object.create(d),t},t.awrap=function(t){return{__await:t}},g(_.prototype),h(_.prototype,s,(function(){return this})),t.AsyncIterator=_,t.async=function(r,n,i,e,s){void 0===s&&(s=Promise);var o=new _(a(r,n,i,e),s);return t.isGeneratorFunction(n)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},g(d),h(d,o,"Generator"),h(d,e,(function(){return this})),h(d,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var r=[];for(var n in t)r.push(n);return r.reverse(),function n(){for(;r.length;){var i=r.pop();if(i in t)return n.value=i,n.done=!1,n}return n.done=!0,n}},t.values=b,M.prototype={constructor:M,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(z),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function i(n,i){return o.type="throw",o.arg=t,r.next=n,i&&(r.method="next",r.arg=void 0),!!i}for(var e=this.tryEntries.length-1;e>=0;--e){var s=this.tryEntries[e],o=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var h=n.call(s,"catchLoc"),a=n.call(s,"finallyLoc");if(h&&a){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(h){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!a)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(t,r){for(var i=this.tryEntries.length-1;i>=0;--i){var e=this.tryEntries[i];if(e.tryLoc<=this.prev&&n.call(e,"finallyLoc")&&this.prev<e.finallyLoc){var s=e;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=r&&r<=s.finallyLoc&&(s=null);var o=s?s.completion:{};return o.type=t,o.arg=r,s?(this.method="next",this.next=s.finallyLoc,c):this.complete(o)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),c},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),z(n),c}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var e=i.arg;z(n)}return e}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:b(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=void 0),c}},t}function H(t,r){for(var n=0;n<r.length;n++){var i=r[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function J(t,r){return J=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},J(t,r)}var K=new(function(t){function r(t,r,n,i){void 0===t&&(t=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===i&&(i=1),this.isQuaternion=!0,this._x=t,this._y=r,this._z=n,this._w=i}r.slerpFlat=function(t,r,n,i,e,s,o){var h=n[i+0],a=n[i+1],u=n[i+2],c=n[i+3],l=e[s+0],f=e[s+1],y=e[s+2],p=e[s+3];if(0===o)return t[r+0]=h,t[r+1]=a,t[r+2]=u,void(t[r+3]=c);if(1===o)return t[r+0]=l,t[r+1]=f,t[r+2]=y,void(t[r+3]=p);if(c!==p||h!==l||a!==f||u!==y){var v=1-o,x=h*l+a*f+u*y+c*p,d=x>=0?1:-1,g=1-x*x;if(g>Number.EPSILON){var _=Math.sqrt(g),m=Math.atan2(_,x*d);v=Math.sin(v*m)/_,o=Math.sin(o*m)/_}var w=o*d;if(h=h*v+l*w,a=a*v+f*w,u=u*v+y*w,c=c*v+p*w,v===1-o){var z=1/Math.sqrt(h*h+a*a+u*u+c*c);h*=z,a*=z,u*=z,c*=z}}t[r]=h,t[r+1]=a,t[r+2]=u,t[r+3]=c},r.multiplyQuaternionsFlat=function(t,r,n,i,e,s){var o=n[i],h=n[i+1],a=n[i+2],u=n[i+3],c=e[s],l=e[s+1],f=e[s+2],y=e[s+3];return t[r]=o*y+u*c+h*f-a*l,t[r+1]=h*y+u*l+a*c-o*f,t[r+2]=a*y+u*f+o*l-h*c,t[r+3]=u*y-o*c-h*l-a*f,t};var n,i,e,s=r.prototype;return s.set=function(t,r,n,i){return this._x=t,this._y=r,this._z=n,this._w=i,this._onChangeCallback(),this},s.clone=function(){return new this.constructor(this._x,this._y,this._z,this._w)},s.copy=function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this},s.setFromEuler=function(t,r){void 0===r&&(r=!0);var n=t._x,i=t._y,e=t._z,s=t._order,o=Math.cos,h=Math.sin,a=o(n/2),u=o(i/2),c=o(e/2),l=h(n/2),f=h(i/2),y=h(e/2);switch(s){case"XYZ":this._x=l*u*c+a*f*y,this._y=a*f*c-l*u*y,this._z=a*u*y+l*f*c,this._w=a*u*c-l*f*y;break;case"YXZ":this._x=l*u*c+a*f*y,this._y=a*f*c-l*u*y,this._z=a*u*y-l*f*c,this._w=a*u*c+l*f*y;break;case"ZXY":this._x=l*u*c-a*f*y,this._y=a*f*c+l*u*y,this._z=a*u*y+l*f*c,this._w=a*u*c-l*f*y;break;case"ZYX":this._x=l*u*c-a*f*y,this._y=a*f*c+l*u*y,this._z=a*u*y-l*f*c,this._w=a*u*c+l*f*y;break;case"YZX":this._x=l*u*c+a*f*y,this._y=a*f*c+l*u*y,this._z=a*u*y-l*f*c,this._w=a*u*c-l*f*y;break;case"XZY":this._x=l*u*c-a*f*y,this._y=a*f*c-l*u*y,this._z=a*u*y+l*f*c,this._w=a*u*c+l*f*y;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!0===r&&this._onChangeCallback(),this},s.setFromAxisAngle=function(t,r){var n=r/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this},s.setFromRotationMatrix=function(t){var r=t.elements,n=r[0],i=r[4],e=r[8],s=r[1],o=r[5],h=r[9],a=r[2],u=r[6],c=r[10],l=n+o+c;if(l>0){var f=.5/Math.sqrt(l+1);this._w=.25/f,this._x=(u-h)*f,this._y=(e-a)*f,this._z=(s-i)*f}else if(n>o&&n>c){var y=2*Math.sqrt(1+n-o-c);this._w=(u-h)/y,this._x=.25*y,this._y=(i+s)/y,this._z=(e+a)/y}else if(o>c){var p=2*Math.sqrt(1+o-n-c);this._w=(e-a)/p,this._x=(i+s)/p,this._y=.25*p,this._z=(h+u)/p}else{var v=2*Math.sqrt(1+c-n-o);this._w=(s-i)/v,this._x=(e+a)/v,this._y=(h+u)/v,this._z=.25*v}return this._onChangeCallback(),this},s.setFromUnitVectors=function(t,r){var n=t.dot(r)+1;return n<Number.EPSILON?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*r.z-t.z*r.y,this._y=t.z*r.x-t.x*r.z,this._z=t.x*r.y-t.y*r.x,this._w=n),this.normalize()},s.rotateTowards=function(t,r){var n=this.angleTo(t);if(0===n)return this;var i=Math.min(1,r/n);return this.slerp(t,i),this},s.identity=function(){return this.set(0,0,0,1)},s.invert=function(){return this.conjugate()},s.conjugate=function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},s.dot=function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},s.lengthSq=function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},s.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},s.normalize=function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this},s.multiply=function(t){return this.multiplyQuaternions(this,t)},s.premultiply=function(t){return this.multiplyQuaternions(t,this)},s.multiplyQuaternions=function(t,r){var n=t._x,i=t._y,e=t._z,s=t._w,o=r._x,h=r._y,a=r._z,u=r._w;return this._x=n*u+s*o+i*a-e*h,this._y=i*u+s*h+e*o-n*a,this._z=e*u+s*a+n*h-i*o,this._w=s*u-n*o-i*h-e*a,this._onChangeCallback(),this},s.slerp=function(t,r){if(0===r)return this;if(1===r)return this.copy(t);var n=this._x,i=this._y,e=this._z,s=this._w,o=s*t._w+n*t._x+i*t._y+e*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=s,this._x=n,this._y=i,this._z=e,this;var h=1-o*o;if(h<=Number.EPSILON){var a=1-r;return this._w=a*s+r*this._w,this._x=a*n+r*this._x,this._y=a*i+r*this._y,this._z=a*e+r*this._z,this.normalize(),this}var u=Math.sqrt(h),c=Math.atan2(u,o),l=Math.sin((1-r)*c)/u,f=Math.sin(r*c)/u;return this._w=s*l+this._w*f,this._x=n*l+this._x*f,this._y=i*l+this._y*f,this._z=e*l+this._z*f,this._onChangeCallback(),this},s.slerpQuaternions=function(t,r,n){return this.copy(t).slerp(r,n)},s.random=function(){var t=2*Math.PI*Math.random(),r=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),e=Math.sqrt(n);return this.set(i*Math.sin(t),i*Math.cos(t),e*Math.sin(r),e*Math.cos(r))},s.equals=function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},s.fromArray=function(t,r){return void 0===r&&(r=0),this._x=t[r],this._y=t[r+1],this._z=t[r+2],this._w=t[r+3],this._onChangeCallback(),this},s.toArray=function(t,r){return void 0===t&&(t=[]),void 0===r&&(r=0),t[r]=this._x,t[r+1]=this._y,t[r+2]=this._z,t[r+3]=this._w,t},s.fromBufferAttribute=function(t,r){return this._x=t.getX(r),this._y=t.getY(r),this._z=t.getZ(r),this._w=t.getW(r),this._onChangeCallback(),this},s.toJSON=function(){return this.toArray()},s._onChange=function(t){return this._onChangeCallback=t,this},s._onChangeCallback=function(){},s[t]=D().mark((function t(){return D().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._x;case 2:return t.next=4,this._y;case 4:return t.next=6,this._z;case 6:return t.next=8,this._w;case 8:case"end":return t.stop()}}),t,this)})),n=r,(i=[{key:"x",get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},{key:"w",get:function(){return this._w},set:function(t){this._w=t,this._onChangeCallback()}}])&&H(n.prototype,i),e&&H(n,e),Object.defineProperty(n,"prototype",{writable:!1}),r}(Symbol.iterator)),$=function(){function t(t,r,n){void 0===t&&(t=0),void 0===r&&(r=0),void 0===n&&(n=0),this.x=t,this.y=r,this.z=n}var r=t.prototype;return r.set=function(t,r,n){return void 0===n&&(n=this.z),this.x=t,this.y=r,this.z=n,this},r.clone=function(){return new this.constructor(this.x,this.y,this.z)},r.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},r.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},r.addScalar=function(t){return this.x+=t,this.y+=t,this.z+=t,this},r.addVectors=function(t,r){return this.x=t.x+r.x,this.y=t.y+r.y,this.z=t.z+r.z,this},r.addScaledVector=function(t,r){return this.x+=t.x*r,this.y+=t.y*r,this.z+=t.z*r,this},r.sub=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},r.subScalar=function(t){return this.x-=t,this.y-=t,this.z-=t,this},r.subVectors=function(t,r){return this.x=t.x-r.x,this.y=t.y-r.y,this.z=t.z-r.z,this},r.multiply=function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this},r.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},r.multiplyVectors=function(t,r){return this.x=t.x*r.x,this.y=t.y*r.y,this.z=t.z*r.z,this},r.applyAxisAngle=function(t,r){return this.applyQuaternion(K.setFromAxisAngle(t,r))},r.applyMatrix4=function(t){var r=this.x,n=this.y,i=this.z,e=t.elements,s=1/(e[3]*r+e[7]*n+e[11]*i+e[15]);return this.x=(e[0]*r+e[4]*n+e[8]*i+e[12])*s,this.y=(e[1]*r+e[5]*n+e[9]*i+e[13])*s,this.z=(e[2]*r+e[6]*n+e[10]*i+e[14])*s,this},r.applyQuaternion=function(t){var r=this.x,n=this.y,i=this.z,e=t.x,s=t.y,o=t.z,h=t.w,a=h*r+s*i-o*n,u=h*n+o*r-e*i,c=h*i+e*n-s*r,l=-e*r-s*n-o*i;return this.x=a*h+l*-e+u*-o-c*-s,this.y=u*h+l*-s+c*-e-a*-o,this.z=c*h+l*-o+a*-s-u*-e,this},r.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},r.divideScalar=function(t){return this.multiplyScalar(1/t)},r.min=function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},r.max=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},r.clamp=function(t,r){return this.x=Math.max(t.x,Math.min(r.x,this.x)),this.y=Math.max(t.y,Math.min(r.y,this.y)),this.z=Math.max(t.z,Math.min(r.z,this.z)),this},r.clampScalar=function(t,r){return this.x=Math.max(t,Math.min(r,this.x)),this.y=Math.max(t,Math.min(r,this.y)),this.z=Math.max(t,Math.min(r,this.z)),this},r.clampLength=function(t,r){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(r,n)))},r.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},r.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z},r.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},r.normalize=function(){return this.divideScalar(this.length()||1)},r.setLength=function(t){return this.normalize().multiplyScalar(t)},r.lerp=function(t,r){return this.x+=(t.x-this.x)*r,this.y+=(t.y-this.y)*r,this.z+=(t.z-this.z)*r,this},r.lerpVectors=function(t,r,n){return this.x=t.x+(r.x-t.x)*n,this.y=t.y+(r.y-t.y)*n,this.z=t.z+(r.z-t.z)*n,this},r.cross=function(t){return this.crossVectors(this,t)},r.crossVectors=function(t,r){var n=t.x,i=t.y,e=t.z,s=r.x,o=r.y,h=r.z;return this.x=i*h-e*o,this.y=e*s-n*h,this.z=n*o-i*s,this},r.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},r.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},r.fromArray=function(t,r){return void 0===r&&(r=0),this.x=t[r],this.y=t[r+1],this.z=t[r+2],this},r.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},t}(),tt=function(){function t(){this.pos=new $,this.dir=new $,this.right=new $,this.up=new $,this.dist=0,this.widthScale=1,this.sharp=!1}var r=t.prototype;return r.lerpPathPoints=function(t,r,n){this.pos.lerpVectors(t.pos,r.pos,n),this.dir.lerpVectors(t.dir,r.dir,n),this.up.lerpVectors(t.up,r.up,n),this.right.lerpVectors(t.right,r.right,n),this.dist=(r.dist-t.dist)*n+t.dist,this.widthScale=(r.widthScale-t.widthScale)*n+t.widthScale},r.copy=function(t){this.pos.copy(t.pos),this.dir.copy(t.dir),this.up.copy(t.up),this.right.copy(t.right),this.dist=t.dist,this.widthScale=t.widthScale},t}(),rt=function(){function t(t,r,n,i,e,s,o,h,a,u,c,l,f,y,p,v){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,r,n,i,e,s,o,h,a,u,c,l,f,y,p,v)}var r=t.prototype;return r.set=function(t,r,n,i,e,s,o,h,a,u,c,l,f,y,p,v){var x=this.elements;return x[0]=t,x[4]=r,x[8]=n,x[12]=i,x[1]=e,x[5]=s,x[9]=o,x[13]=h,x[2]=a,x[6]=u,x[10]=c,x[14]=l,x[3]=f,x[7]=y,x[11]=p,x[15]=v,this},r.multiply=function(t){return this.multiplyMatrices(this,t)},r.makeRotationAxis=function(t,r){var n=Math.cos(r),i=Math.sin(r),e=1-n,s=t.x,o=t.y,h=t.z,a=e*s,u=e*o;return this.set(a*s+n,a*o-i*h,a*h+i*o,0,a*o+i*h,u*o+n,u*h-i*s,0,a*h-i*o,u*h+i*s,e*h*h+n,0,0,0,0,1),this},r.equals=function(t){for(var r=this.elements,n=t.elements,i=0;i<16;i++)if(r[i]!==n[i])return!1;return!0},t}();function nt(t,r,n,i){return function(t,r){var n=1-t;return n*n*r}(t,r)+function(t,r){return 2*(1-t)*t*r}(t,n)+function(t,r){return t*t*r}(t,i)}var it=function(t){var r,n;function i(r,n,i){var e;return void 0===r&&(r=new $),void 0===n&&(n=new $),void 0===i&&(i=new $),(e=t.call(this)||this).isQuadraticBezierCurve3=!0,e.type="QuadraticBezierCurve3",e.v0=r,e.v1=n,e.v2=i,e}return n=t,(r=i).prototype=Object.create(n.prototype),r.prototype.constructor=r,J(r,n),i.prototype.getPoint=function(t,r){void 0===r&&(r=new $);var n=r,i=this.v0,e=this.v1,s=this.v2;return n.set(nt(t,i.x,e.x,s.x),nt(t,i.y,e.y,s.y),nt(t,i.z,e.z,s.z)),n},i}(function(){function t(){this.type="Curve",this.arcLengthDivisions=200}var r=t.prototype;return r.getPoint=function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},r.getPointAt=function(t,r){var n=this.getUtoTmapping(t);return this.getPoint(n,r)},r.getPoints=function(t){void 0===t&&(t=5);for(var r=[],n=0;n<=t;n++)r.push(this.getPoint(n/t));return r},r.getLength=function(){var t=this.getLengths();return t[t.length-1]},r.getLengths=function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var r,n=[],i=this.getPoint(0),e=0;n.push(0);for(var s=1;s<=t;s++)e+=(r=this.getPoint(s/t)).distanceTo(i),n.push(e),i=r;return this.cacheArcLengths=n,n},r.getUtoTmapping=function(t,r){var n,i=this.getLengths(),e=0,s=i.length;n=r||t*i[s-1];for(var o,h=0,a=s-1;h<=a;)if((o=i[e=Math.floor(h+(a-h)/2)]-n)<0)h=e+1;else{if(!(o>0)){a=e;break}a=e-1}if(i[e=a]===n)return e/(s-1);var u=i[e];return(e+(n-u)/(i[e+1]-u))/(s-1)},t}()),et=new $,st=new $,ot=new $,ht=new rt,at=new it;var ut=function(){function t(){this.array=[],this.count=0}var r=t.prototype;return r.set=function(t,r,n,i,e){if(void 0===r&&(r=.1),void 0===n&&(n=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 $).copy(t[0]));for(var s=0,o=t.length;s<o;s++)if(0===s)this._start(t[s],t[s+1],i);else if(s===o-1)if(e){this._corner(t[s],t[1],r,n,i);var h=this.array[0].dist;this.array[0].copy(this.array[this.count-1]),this.array[0].dist=h}else this._end(t[s]);else this._corner(t[s],t[s+1],r,n,i)},r.distance=function(){return this.count>0?this.array[this.count-1].dist:0},r._getByIndex=function(t){return this.array[t]||(this.array[t]=new tt),this.array[t]},r._start=function(t,r,n){this.count=0;var i=this._getByIndex(this.count);if(i.pos.copy(t),i.dir.subVectors(r,t),n)i.up.copy(n);else{var e=Number.MAX_VALUE,s=Math.abs(i.dir.x),o=Math.abs(i.dir.y),h=Math.abs(i.dir.z);s<e&&(e=s,i.up.set(1,0,0)),o<e&&(e=o,i.up.set(0,1,0)),h<e&&i.up.set(0,0,1)}i.right.crossVectors(i.dir,i.up).normalize(),i.up.crossVectors(i.right,i.dir).normalize(),i.dist=0,i.widthScale=1,i.sharp=!1,i.dir.normalize(),this.count++},r._end=function(t){var r=this.array[this.count-1],n=this._getByIndex(this.count);n.pos.copy(t),n.dir.subVectors(t,r.pos);var i=n.dir.length();n.dir.normalize(),n.up.copy(r.up);var e=et.crossVectors(r.dir,n.dir);if(e.length()>Number.EPSILON){e.normalize();var s=Math.acos(Math.min(Math.max(r.dir.dot(n.dir),-1),1));n.up.applyMatrix4(ht.makeRotationAxis(e,s))}n.right.crossVectors(n.dir,n.up).normalize(),n.dist=r.dist+i,n.widthScale=1,n.sharp=!1,this.count++},r._corner=function(t,r,n,i,e){if(n>0&&i>0){for(var s=function(t,r,n,i,e,s){var o=et.subVectors(r,t),h=st.subVectors(n,r),a=o.length(),u=h.length();o.normalize(),h.normalize();var c=Math.min(.999999*(e?a/2:a),i);s.v0.copy(r).sub(o.multiplyScalar(c)),s.v1.copy(r);var l=Math.min(u/2*.999999,i);return s.v2.copy(r).add(h.multiplyScalar(l)),s}(this.array[this.count-1].pos,t,r,n,this.count-1==0,at),o=s.getPoints(i),h=0;h<i;h++)this._sharpCorner(o[h],o[h+1],e,0===h?1:0);o[i].equals(r)||this._sharpCorner(o[i],r,e,2)}else this._sharpCorner(t,r,e,0,!0)},r._sharpCorner=function(t,r,n,i,e){void 0===i&&(i=0),void 0===e&&(e=!1);var s=this.array[this.count-1],o=this._getByIndex(this.count),h=et.subVectors(t,s.pos),a=st.subVectors(r,t),u=h.length();if(h.normalize(),a.normalize(),o.pos.copy(t),1===i?o.dir.copy(h):2===i?o.dir.copy(a):(o.dir.addVectors(h,a),o.dir.normalize()),n)1===o.dir.dot(n)?o.right.crossVectors(a,n).normalize():o.right.crossVectors(o.dir,n).normalize(),o.up.crossVectors(o.right,o.dir).normalize();else{o.up.copy(s.up);var c=ot.crossVectors(s.dir,o.dir);if(c.length()>Number.EPSILON){c.normalize();var l=Math.acos(Math.min(Math.max(s.dir.dot(o.dir),-1),1));o.up.applyMatrix4(ht.makeRotationAxis(c,l))}o.right.crossVectors(o.dir,o.up).normalize()}o.dist=s.dist+u;var f=h.dot(a);o.widthScale=Math.min(1/Math.sqrt((1+f)/2),1.415)||1,o.sharp=Math.abs(f-1)>.05&&e,this.count++},t}(),ct=new $(0,0,1);var lt=new $(0,0,1);t.cylinder=function(t,r){void 0===r&&(r={}),r=Object.assign({},{radius:1,height:2,radialSegments:6},r);for(var n=Math.round(Math.max(4,r.radialSegments)),i=r,e=i.radius,s=i.height,o=360/n/360*Math.PI*2,h=n+1,a=new Float32Array(3*h*2),u=t[0],c=t[1],l=0,f=0,y=3*h,p=2*h,v=[],x=[],d=-1;d<n;d++){var g=o*d,_=Math.cos(g)*e+u,m=Math.sin(g)*e+c;a[l]=_,a[l+1]=m,a[l+2]=0,a[l+y]=_,a[l+1+y]=m,a[l+2+y]=s;var w,z;w=.5+_/e/2,z=.5+m/e/2,x[f]=w,x[f+1]=z,x[f+p]=w,x[f+1+p]=z,l+=3,f+=2,d>1&&v.push(0,d-1,d)}a[l-=3]=a[0],a[l+1]=a[1],a[l+2]=a[2];var M=a.length;a[M-3]=a[0],a[M-2]=a[1],a[M-1]=s;for(var b=v.length,P=0;P<b;P++){var S=v[P];v.push(S+h)}var A=new Float32Array(2*(3*h*2-6)),L=-1;l=2*h,f=0;for(var k=0,C=a.length/2;k<C-3;k+=3){var E=a[k],Z=a[k+1],O=a[k+3],V=a[k+4];A[++L]=E,A[++L]=Z,A[++L]=s,A[++L]=O,A[++L]=V,A[++L]=s,A[++L]=E,A[++L]=Z,A[++L]=0,A[++L]=O,A[++L]=V,A[++L]=0;var j=l+2,I=l+3,q=l,N=l+1;v.push(q,j,N,j,I,N),l+=4;var T=f/h,U=(f+1)/h;x.push(T,s/e/2,U,s/e/2,T,0,U,0),f++}var G=new Float32Array(a.length+A.length);G.set(a,0),G.set(A,a.length);var Q=F(v,G);return{points:a,indices:new Uint32Array(v),position:G,normal:Q,uv:new Float32Array(x)}},t.expandLine=R,t.expandPaths=function(t,r){r=Object.assign({},{lineWidth:1,cornerRadius:0,cornerSplit:10},r);var n=t.map((function(t){var n=t.map((function(t){var r=t[0],n=t[1],i=t[2];return new $(r,n,i||0)})),i=new ut;i.set(n,r.cornerRadius,r.cornerSplit,ct);var e=function(t,r){var n=r.lineWidth||.1,i=1,e=n/2,s=n,o=t.distance(),h=i*o;if(0===o)return null;var a,u=e/s,c=0,l=[],f=[],y=[],p=[],v=0,x=new $,d=new $,g=new $,_=new $,m=new $,w=new $;function z(t){var r=0===l.length,n=t.sharp&&!r,i=t.dist/s,o=t.dir,h=t.up,a=t.right;if(x.copy(a).multiplyScalar(e*t.widthScale),d.copy(a).multiplyScalar(-e*t.widthScale),x.add(t.pos),d.add(t.pos),n){g.fromArray(l,l.length-6).sub(d),_.fromArray(l,l.length-3).sub(x);var z,M,b=g.length()-_.length();b>0?(z=g,M=d):(z=_,M=x),m.copy(z).setLength(Math.abs(b)).add(M);var P=w.copy(M).sub(m).normalize().dot(o)*w.copy(M).sub(m).length()*2;w.copy(o).setLength(P).add(m),b>0?(l.push(m.x,m.y,m.z,x.x,x.y,x.z,d.x,d.y,d.z,x.x,x.y,x.z,w.x,w.y,w.z,x.x,x.y,x.z),v+=6,p.push(v-6,v-8,v-7,v-6,v-7,v-5,v-4,v-6,v-5,v-2,v-4,v-1),c+=12):(l.push(d.x,d.y,d.z,m.x,m.y,m.z,d.x,d.y,d.z,x.x,x.y,x.z,d.x,d.y,d.z,w.x,w.y,w.z),v+=6,p.push(v-6,v-8,v-7,v-6,v-7,v-5,v-6,v-5,v-3,v-2,v-3,v-1),c+=12),f.push(h.x,h.y,h.z,h.x,h.y,h.z,h.x,h.y,h.z,h.x,h.y,h.z,h.x,h.y,h.z,h.x,h.y,h.z),y.push(i-u,0,i-u,1,i,0,i,1,i+u,0,i+u,1)}else l.push(d.x,d.y,d.z,x.x,x.y,x.z),f.push(h.x,h.y,h.z,h.x,h.y,h.z),y.push(i,0,i,1),v+=2,r||(p.push(v-2,v-4,v-3,v-2,v-3,v-1),c+=6)}if(h>0)for(var M=0;M<t.count;M++){var b=t.array[M];if(b.dist>h){var P=t.array[M-1];a=new tt;var S=(h-P.dist)/(b.dist-P.dist);a.lerpPathPoints(P,b,S),z(a);break}z(b)}else a=t.array[0];return{points:l,normal:f,uvs:y,index:p,count:c}}(i,r);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=Z(n);return i.lines=t,i},t.expandTubes=function(t,r){r=Object.assign({},{radius:1,cornerSplit:0,radialSegments:8,startRad:-Math.PI/4},r);var n=t.map((function(t){var n=t.map((function(t){var r=t[0],n=t[1],i=t[2];return new $(r,n,i||0)})),i=new ut;i.set(n,r.cornerRadius,r.cornerSplit,lt);var e=function(t,r){var n=Math.max(r.radius||1,1e-8),i=void 0!==r.progress?r.progress:1,e=Math.max(3,r.radialSegments||8),s=r.startRad||0,o=2*n*Math.PI,h=t.distance(),a=i*h;if(0===a)return null;var u=0,c=[],l=[],f=[],y=[],p=0,v=new $,x=-1,d=-1,g=-1,_=-1;function m(t,r,n){for(var i=0===c.length,e=t.dist/o,h=0;h<=n;h++){var a=h;a===n&&(a=0),v.copy(t.up).applyAxisAngle(t.dir,s+2*Math.PI*a/n).normalize();var m=r*t.widthScale;c[++x]=t.pos.x+v.x*m,c[++x]=t.pos.y+v.y*m,c[++x]=t.pos.z+v.z*m,l[++d]=v.x,l[++d]=v.y,l[++d]=v.z,f[++g]=e,f[++g]=h/n,p++}if(!i)for(var w=p-2*(n+1),z=p-(n+1),M=0;M<n;M++)y[++_]=z+M,y[++_]=w+M,y[++_]=w+M+1,y[++_]=z+M,y[++_]=w+M+1,y[++_]=z+M+1,u+=6}if(a>0)for(var w=0;w<t.count;w++){var z=t.array[w];if(z.dist>a){var M=t.array[w-1],b=new tt,P=(a-M.dist)/(z.dist-M.dist);b.lerpPathPoints(M,z,P),m(b,n,e);break}m(z,n,e)}return{points:c,normal:l,uvs:f,index:y,count:u}}(i,r);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=Z(n);return i.lines=t,i},t.extrudePolygons=function(t,r){r=Object.assign({},{depth:2},r);var n=t.map((function(t){for(var n=0,i=t.length;n<i;n++){var e=t[n];I(e),0===n?k(e)||(t[n]=e.reverse()):k(e)&&(t[n]=e.reverse()),q(e)&&e.splice(e.length-1,1)}var s=function(t,r){for(var n=function(t){var r=0,n=0,i=t.length;for(;n<i;)r+=t[n].length,n++;return r}(t),i=t.length,e=[],s=new Float32Array(2*n),o=[],h=[],a=3*n,u=2*n,c=r.depth,l=0,f=0,y=0,p=0;p<i;p++){var v=t[p];p>0&&e.push(l/2);for(var x=0,d=v.length;x<d;){var g=v[x],_=g[0],m=g[1];s[l++]=_,s[l++]=m,o[f]=_,o[f+1]=m,o[f+2]=c,o[a+f]=_,o[a+f+1]=m,o[a+f+2]=0,h[y]=_,h[y+1]=m,h[u+y]=_,h[u+y+1]=m,f+=3,y+=2,x++}}return{flatVertices:s,holes:e,points:o,count:n,uvs:h}}(t,r);return s.polygon=t,function(t,r){for(var n=[],i=t.count,e=0,s=r.length;e<s;e+=3){var o=r[e],h=r[e+1],a=r[e+2];n[e]=o,n[e+1]=h,n[e+2]=a;var u=s+e,c=i+o,l=i+h,f=i+a;n[u]=c,n[u+1]=l,n[u+2]=f}t.index=n}(s,L(s.flatVertices,s.holes,2)),function(t,r){for(var n=t.points,i=t.index,e=t.polygon,s=t.uvs,o=r.depth,h=0,a=e.length;h<a;h++)for(var u=e[h],c=0,l=u.length;c<l;){var f=u[c],y=u[c+1];c===l-1&&(y=u[0]);var p=n.length/3,v=f[0],x=f[1],d=y[0],g=y[1];n.push(v,x,o,d,g,o,v,x,0,d,g,0);var _=p+2,m=p+3,w=p,z=p+1;i.push(_,w,m,w,z,m),j(s,n,_,m,w,z),c++}}(s,r),s.position=new Float32Array(s.points),s.indices=new Uint32Array(s.index),s.uv=new Float32Array(s.uvs),s.normal=F(s.indices,s.position),s})),i=Z(n);return i.polygons=t,i},t.extrudePolylines=function(t,r){N(r=Object.assign({},{depth:2,lineWidth:1,bottomStickGround:!1},r));var n=t.map((function(t){var n=R(t,r);return n.line=t,T(n,r),U(n,r),n.position=new Float32Array(n.points),n.indices=new Uint32Array(n.index),n.uv=new Float32Array(n.uvs),n.normal=F(n.indices,n.position),n})),i=Z(n);return i.lines=t,i},t.extrudeSlopes=function(t,r){N(r=Object.assign({},{depth:2,lineWidth:1,side:"left",sideDepth:0,bottomStickGround:!1},r));var n=r,i=n.depth,e=n.side,s=n.sideDepth,o=t.map((function(t){var n=R(t,r);n.line=t;for(var o,h=n.leftPoints,a=n.rightPoints,u={line:t},c=0,l=t.length;c<l;c++)t[c][2]=t[c][2]||0;return"left"===e?(u.leftPoints=h,u.rightPoints=t,o=[s,i]):(u.leftPoints=t,u.rightPoints=a,o=[i,s]),u.depths=o,T(u,r),U(u,r),u.position=new Float32Array(u.points),u.indices=new Uint32Array(u.index),u.uv=new Float32Array(u.uvs),u.normal=F(u.indices,u.position),u})),h=Z(o);return h.lines=t,h},t.leftOnLine=W,Object.defineProperty(t,"__esModule",{value:!0})}));
|
6
|
+
D=function(){return t};var t={},n=Object.prototype,r=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},e=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag";function a(t,n,r){return Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[n]}try{a({},"")}catch(t){a=function(t,n,r){return t[n]=r}}function h(t,n,r,i){var e=n&&n.prototype instanceof l?n:l,s=Object.create(e.prototype),o=new M(i||[]);return s._invoke=function(t,n,r){var i="suspendedStart";return function(e,s){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===e)throw s;return P()}for(r.method=e,r.arg=s;;){var o=r.delegate;if(o){var a=m(o,r);if(a){if(a===c)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===i)throw i="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i="executing";var h=u(t,n,r);if("normal"===h.type){if(i=r.done?"completed":"suspendedYield",h.arg===c)continue;return{value:h.arg,done:r.done}}"throw"===h.type&&(i="completed",r.method="throw",r.arg=h.arg)}}}(t,r,o),s}function u(t,n,r){try{return{type:"normal",arg:t.call(n,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=h;var c={};function l(){}function f(){}function y(){}var v={};a(v,e,(function(){return this}));var p=Object.getPrototypeOf,x=p&&p(p(b([])));x&&x!==n&&r.call(x,e)&&(v=x);var d=y.prototype=l.prototype=Object.create(v);function g(t){["next","throw","return"].forEach((function(n){a(t,n,(function(t){return this._invoke(n,t)}))}))}function _(t,n){function i(e,s,o,a){var h=u(t[e],t,s);if("throw"!==h.type){var c=h.arg,l=c.value;return l&&"object"==typeof l&&r.call(l,"__await")?n.resolve(l.__await).then((function(t){i("next",t,o,a)}),(function(t){i("throw",t,o,a)})):n.resolve(l).then((function(t){c.value=t,o(c)}),(function(t){return i("throw",t,o,a)}))}a(h.arg)}var e;this._invoke=function(t,r){function s(){return new n((function(n,e){i(t,r,n,e)}))}return e=e?e.then(s,s):s()}}function m(t,n){var r=t.iterator[n.method];if(void 0===r){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=void 0,m(t,n),"throw"===n.method))return c;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var i=u(r,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,c;var e=i.arg;return e?e.done?(n[t.resultName]=e.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,c):e:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,c)}function w(t){var n={tryLoc:t[0]};1 in t&&(n.catchLoc=t[1]),2 in t&&(n.finallyLoc=t[2],n.afterLoc=t[3]),this.tryEntries.push(n)}function z(t){var n=t.completion||{};n.type="normal",delete n.arg,t.completion=n}function M(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function b(t){if(t){var n=t[e];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,s=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=void 0,n.done=!0,n};return s.next=s}}return{next:P}}function P(){return{value:void 0,done:!0}}return f.prototype=y,a(d,"constructor",y),a(y,"constructor",f),f.displayName=a(y,o,"GeneratorFunction"),t.isGeneratorFunction=function(t){var n="function"==typeof t&&t.constructor;return!!n&&(n===f||"GeneratorFunction"===(n.displayName||n.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,a(t,o,"GeneratorFunction")),t.prototype=Object.create(d),t},t.awrap=function(t){return{__await:t}},g(_.prototype),a(_.prototype,s,(function(){return this})),t.AsyncIterator=_,t.async=function(n,r,i,e,s){void 0===s&&(s=Promise);var o=new _(h(n,r,i,e),s);return t.isGeneratorFunction(r)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},g(d),a(d,o,"Generator"),a(d,e,(function(){return this})),a(d,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var n=[];for(var r in t)n.push(r);return n.reverse(),function r(){for(;n.length;){var i=n.pop();if(i in t)return r.value=i,r.done=!1,r}return r.done=!0,r}},t.values=b,M.prototype={constructor:M,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(z),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return o.type="throw",o.arg=t,n.next=r,i&&(n.method="next",n.arg=void 0),!!i}for(var e=this.tryEntries.length-1;e>=0;--e){var s=this.tryEntries[e],o=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var a=r.call(s,"catchLoc"),h=r.call(s,"finallyLoc");if(a&&h){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(a){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!h)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(t,n){for(var i=this.tryEntries.length-1;i>=0;--i){var e=this.tryEntries[i];if(e.tryLoc<=this.prev&&r.call(e,"finallyLoc")&&this.prev<e.finallyLoc){var s=e;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=n&&n<=s.finallyLoc&&(s=null);var o=s?s.completion:{};return o.type=t,o.arg=n,s?(this.method="next",this.next=s.finallyLoc,c):this.complete(o)},complete:function(t,n){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&n&&(this.next=n),c},finish:function(t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),z(r),c}},catch:function(t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc===t){var i=r.completion;if("throw"===i.type){var e=i.arg;z(r)}return e}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:b(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},t}function H(t,n){for(var r=0;r<n.length;r++){var i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function J(t,n){return J=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},J(t,n)}var K=new(function(t){function n(t,n,r,i){void 0===t&&(t=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===i&&(i=1),this.isQuaternion=!0,this._x=t,this._y=n,this._z=r,this._w=i}n.slerpFlat=function(t,n,r,i,e,s,o){var a=r[i+0],h=r[i+1],u=r[i+2],c=r[i+3],l=e[s+0],f=e[s+1],y=e[s+2],v=e[s+3];if(0===o)return t[n+0]=a,t[n+1]=h,t[n+2]=u,void(t[n+3]=c);if(1===o)return t[n+0]=l,t[n+1]=f,t[n+2]=y,void(t[n+3]=v);if(c!==v||a!==l||h!==f||u!==y){var p=1-o,x=a*l+h*f+u*y+c*v,d=x>=0?1:-1,g=1-x*x;if(g>Number.EPSILON){var _=Math.sqrt(g),m=Math.atan2(_,x*d);p=Math.sin(p*m)/_,o=Math.sin(o*m)/_}var w=o*d;if(a=a*p+l*w,h=h*p+f*w,u=u*p+y*w,c=c*p+v*w,p===1-o){var z=1/Math.sqrt(a*a+h*h+u*u+c*c);a*=z,h*=z,u*=z,c*=z}}t[n]=a,t[n+1]=h,t[n+2]=u,t[n+3]=c},n.multiplyQuaternionsFlat=function(t,n,r,i,e,s){var o=r[i],a=r[i+1],h=r[i+2],u=r[i+3],c=e[s],l=e[s+1],f=e[s+2],y=e[s+3];return t[n]=o*y+u*c+a*f-h*l,t[n+1]=a*y+u*l+h*c-o*f,t[n+2]=h*y+u*f+o*l-a*c,t[n+3]=u*y-o*c-a*l-h*f,t};var r,i,e,s=n.prototype;return s.set=function(t,n,r,i){return this._x=t,this._y=n,this._z=r,this._w=i,this._onChangeCallback(),this},s.clone=function(){return new this.constructor(this._x,this._y,this._z,this._w)},s.copy=function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this},s.setFromEuler=function(t,n){void 0===n&&(n=!0);var r=t._x,i=t._y,e=t._z,s=t._order,o=Math.cos,a=Math.sin,h=o(r/2),u=o(i/2),c=o(e/2),l=a(r/2),f=a(i/2),y=a(e/2);switch(s){case"XYZ":this._x=l*u*c+h*f*y,this._y=h*f*c-l*u*y,this._z=h*u*y+l*f*c,this._w=h*u*c-l*f*y;break;case"YXZ":this._x=l*u*c+h*f*y,this._y=h*f*c-l*u*y,this._z=h*u*y-l*f*c,this._w=h*u*c+l*f*y;break;case"ZXY":this._x=l*u*c-h*f*y,this._y=h*f*c+l*u*y,this._z=h*u*y+l*f*c,this._w=h*u*c-l*f*y;break;case"ZYX":this._x=l*u*c-h*f*y,this._y=h*f*c+l*u*y,this._z=h*u*y-l*f*c,this._w=h*u*c+l*f*y;break;case"YZX":this._x=l*u*c+h*f*y,this._y=h*f*c+l*u*y,this._z=h*u*y-l*f*c,this._w=h*u*c-l*f*y;break;case"XZY":this._x=l*u*c-h*f*y,this._y=h*f*c-l*u*y,this._z=h*u*y+l*f*c,this._w=h*u*c+l*f*y;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!0===n&&this._onChangeCallback(),this},s.setFromAxisAngle=function(t,n){var r=n/2,i=Math.sin(r);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(r),this._onChangeCallback(),this},s.setFromRotationMatrix=function(t){var n=t.elements,r=n[0],i=n[4],e=n[8],s=n[1],o=n[5],a=n[9],h=n[2],u=n[6],c=n[10],l=r+o+c;if(l>0){var f=.5/Math.sqrt(l+1);this._w=.25/f,this._x=(u-a)*f,this._y=(e-h)*f,this._z=(s-i)*f}else if(r>o&&r>c){var y=2*Math.sqrt(1+r-o-c);this._w=(u-a)/y,this._x=.25*y,this._y=(i+s)/y,this._z=(e+h)/y}else if(o>c){var v=2*Math.sqrt(1+o-r-c);this._w=(e-h)/v,this._x=(i+s)/v,this._y=.25*v,this._z=(a+u)/v}else{var p=2*Math.sqrt(1+c-r-o);this._w=(s-i)/p,this._x=(e+h)/p,this._y=(a+u)/p,this._z=.25*p}return this._onChangeCallback(),this},s.setFromUnitVectors=function(t,n){var r=t.dot(n)+1;return r<Number.EPSILON?(r=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=r):(this._x=0,this._y=-t.z,this._z=t.y,this._w=r)):(this._x=t.y*n.z-t.z*n.y,this._y=t.z*n.x-t.x*n.z,this._z=t.x*n.y-t.y*n.x,this._w=r),this.normalize()},s.rotateTowards=function(t,n){var r=this.angleTo(t);if(0===r)return this;var i=Math.min(1,n/r);return this.slerp(t,i),this},s.identity=function(){return this.set(0,0,0,1)},s.invert=function(){return this.conjugate()},s.conjugate=function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},s.dot=function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},s.lengthSq=function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},s.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},s.normalize=function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this},s.multiply=function(t){return this.multiplyQuaternions(this,t)},s.premultiply=function(t){return this.multiplyQuaternions(t,this)},s.multiplyQuaternions=function(t,n){var r=t._x,i=t._y,e=t._z,s=t._w,o=n._x,a=n._y,h=n._z,u=n._w;return this._x=r*u+s*o+i*h-e*a,this._y=i*u+s*a+e*o-r*h,this._z=e*u+s*h+r*a-i*o,this._w=s*u-r*o-i*a-e*h,this._onChangeCallback(),this},s.slerp=function(t,n){if(0===n)return this;if(1===n)return this.copy(t);var r=this._x,i=this._y,e=this._z,s=this._w,o=s*t._w+r*t._x+i*t._y+e*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=s,this._x=r,this._y=i,this._z=e,this;var a=1-o*o;if(a<=Number.EPSILON){var h=1-n;return this._w=h*s+n*this._w,this._x=h*r+n*this._x,this._y=h*i+n*this._y,this._z=h*e+n*this._z,this.normalize(),this}var u=Math.sqrt(a),c=Math.atan2(u,o),l=Math.sin((1-n)*c)/u,f=Math.sin(n*c)/u;return this._w=s*l+this._w*f,this._x=r*l+this._x*f,this._y=i*l+this._y*f,this._z=e*l+this._z*f,this._onChangeCallback(),this},s.slerpQuaternions=function(t,n,r){return this.copy(t).slerp(n,r)},s.random=function(){var t=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),r=Math.random(),i=Math.sqrt(1-r),e=Math.sqrt(r);return this.set(i*Math.sin(t),i*Math.cos(t),e*Math.sin(n),e*Math.cos(n))},s.equals=function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},s.fromArray=function(t,n){return void 0===n&&(n=0),this._x=t[n],this._y=t[n+1],this._z=t[n+2],this._w=t[n+3],this._onChangeCallback(),this},s.toArray=function(t,n){return void 0===t&&(t=[]),void 0===n&&(n=0),t[n]=this._x,t[n+1]=this._y,t[n+2]=this._z,t[n+3]=this._w,t},s.fromBufferAttribute=function(t,n){return this._x=t.getX(n),this._y=t.getY(n),this._z=t.getZ(n),this._w=t.getW(n),this._onChangeCallback(),this},s.toJSON=function(){return this.toArray()},s._onChange=function(t){return this._onChangeCallback=t,this},s._onChangeCallback=function(){},s[t]=D().mark((function t(){return D().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._x;case 2:return t.next=4,this._y;case 4:return t.next=6,this._z;case 6:return t.next=8,this._w;case 8:case"end":return t.stop()}}),t,this)})),r=n,(i=[{key:"x",get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},{key:"w",get:function(){return this._w},set:function(t){this._w=t,this._onChangeCallback()}}])&&H(r.prototype,i),e&&H(r,e),Object.defineProperty(r,"prototype",{writable:!1}),n}(Symbol.iterator)),$=function(){function t(t,n,r){void 0===t&&(t=0),void 0===n&&(n=0),void 0===r&&(r=0),this.x=t,this.y=n,this.z=r}var n=t.prototype;return n.set=function(t,n,r){return void 0===r&&(r=this.z),this.x=t,this.y=n,this.z=r,this},n.clone=function(){return new this.constructor(this.x,this.y,this.z)},n.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},n.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},n.addScalar=function(t){return this.x+=t,this.y+=t,this.z+=t,this},n.addVectors=function(t,n){return this.x=t.x+n.x,this.y=t.y+n.y,this.z=t.z+n.z,this},n.addScaledVector=function(t,n){return this.x+=t.x*n,this.y+=t.y*n,this.z+=t.z*n,this},n.sub=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},n.subScalar=function(t){return this.x-=t,this.y-=t,this.z-=t,this},n.subVectors=function(t,n){return this.x=t.x-n.x,this.y=t.y-n.y,this.z=t.z-n.z,this},n.multiply=function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this},n.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},n.multiplyVectors=function(t,n){return this.x=t.x*n.x,this.y=t.y*n.y,this.z=t.z*n.z,this},n.applyAxisAngle=function(t,n){return this.applyQuaternion(K.setFromAxisAngle(t,n))},n.applyMatrix4=function(t){var n=this.x,r=this.y,i=this.z,e=t.elements,s=1/(e[3]*n+e[7]*r+e[11]*i+e[15]);return this.x=(e[0]*n+e[4]*r+e[8]*i+e[12])*s,this.y=(e[1]*n+e[5]*r+e[9]*i+e[13])*s,this.z=(e[2]*n+e[6]*r+e[10]*i+e[14])*s,this},n.applyQuaternion=function(t){var n=this.x,r=this.y,i=this.z,e=t.x,s=t.y,o=t.z,a=t.w,h=a*n+s*i-o*r,u=a*r+o*n-e*i,c=a*i+e*r-s*n,l=-e*n-s*r-o*i;return this.x=h*a+l*-e+u*-o-c*-s,this.y=u*a+l*-s+c*-e-h*-o,this.z=c*a+l*-o+h*-s-u*-e,this},n.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},n.divideScalar=function(t){return this.multiplyScalar(1/t)},n.min=function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},n.max=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},n.clamp=function(t,n){return this.x=Math.max(t.x,Math.min(n.x,this.x)),this.y=Math.max(t.y,Math.min(n.y,this.y)),this.z=Math.max(t.z,Math.min(n.z,this.z)),this},n.clampScalar=function(t,n){return this.x=Math.max(t,Math.min(n,this.x)),this.y=Math.max(t,Math.min(n,this.y)),this.z=Math.max(t,Math.min(n,this.z)),this},n.clampLength=function(t,n){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(t,Math.min(n,r)))},n.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},n.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z},n.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},n.normalize=function(){return this.divideScalar(this.length()||1)},n.setLength=function(t){return this.normalize().multiplyScalar(t)},n.lerp=function(t,n){return this.x+=(t.x-this.x)*n,this.y+=(t.y-this.y)*n,this.z+=(t.z-this.z)*n,this},n.lerpVectors=function(t,n,r){return this.x=t.x+(n.x-t.x)*r,this.y=t.y+(n.y-t.y)*r,this.z=t.z+(n.z-t.z)*r,this},n.cross=function(t){return this.crossVectors(this,t)},n.crossVectors=function(t,n){var r=t.x,i=t.y,e=t.z,s=n.x,o=n.y,a=n.z;return this.x=i*a-e*o,this.y=e*s-r*a,this.z=r*o-i*s,this},n.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},n.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},n.fromArray=function(t,n){return void 0===n&&(n=0),this.x=t[n],this.y=t[n+1],this.z=t[n+2],this},n.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},t}(),tt=function(){function t(){this.pos=new $,this.dir=new $,this.right=new $,this.up=new $,this.dist=0,this.widthScale=1,this.sharp=!1}var n=t.prototype;return n.lerpPathPoints=function(t,n,r){this.pos.lerpVectors(t.pos,n.pos,r),this.dir.lerpVectors(t.dir,n.dir,r),this.up.lerpVectors(t.up,n.up,r),this.right.lerpVectors(t.right,n.right,r),this.dist=(n.dist-t.dist)*r+t.dist,this.widthScale=(n.widthScale-t.widthScale)*r+t.widthScale},n.copy=function(t){this.pos.copy(t.pos),this.dir.copy(t.dir),this.up.copy(t.up),this.right.copy(t.right),this.dist=t.dist,this.widthScale=t.widthScale},t}(),nt=function(){function t(t,n,r,i,e,s,o,a,h,u,c,l,f,y,v,p){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,n,r,i,e,s,o,a,h,u,c,l,f,y,v,p)}var n=t.prototype;return n.set=function(t,n,r,i,e,s,o,a,h,u,c,l,f,y,v,p){var x=this.elements;return x[0]=t,x[4]=n,x[8]=r,x[12]=i,x[1]=e,x[5]=s,x[9]=o,x[13]=a,x[2]=h,x[6]=u,x[10]=c,x[14]=l,x[3]=f,x[7]=y,x[11]=v,x[15]=p,this},n.multiply=function(t){return this.multiplyMatrices(this,t)},n.makeRotationAxis=function(t,n){var r=Math.cos(n),i=Math.sin(n),e=1-r,s=t.x,o=t.y,a=t.z,h=e*s,u=e*o;return this.set(h*s+r,h*o-i*a,h*a+i*o,0,h*o+i*a,u*o+r,u*a-i*s,0,h*a-i*o,u*a+i*s,e*a*a+r,0,0,0,0,1),this},n.equals=function(t){for(var n=this.elements,r=t.elements,i=0;i<16;i++)if(n[i]!==r[i])return!1;return!0},t}();function rt(t,n,r,i){return function(t,n){var r=1-t;return r*r*n}(t,n)+function(t,n){return 2*(1-t)*t*n}(t,r)+function(t,n){return t*t*n}(t,i)}var it=function(t){var n,r;function i(n,r,i){var e;return void 0===n&&(n=new $),void 0===r&&(r=new $),void 0===i&&(i=new $),(e=t.call(this)||this).isQuadraticBezierCurve3=!0,e.type="QuadraticBezierCurve3",e.v0=n,e.v1=r,e.v2=i,e}return r=t,(n=i).prototype=Object.create(r.prototype),n.prototype.constructor=n,J(n,r),i.prototype.getPoint=function(t,n){void 0===n&&(n=new $);var r=n,i=this.v0,e=this.v1,s=this.v2;return r.set(rt(t,i.x,e.x,s.x),rt(t,i.y,e.y,s.y),rt(t,i.z,e.z,s.z)),r},i}(function(){function t(){this.type="Curve",this.arcLengthDivisions=200}var n=t.prototype;return n.getPoint=function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},n.getPointAt=function(t,n){var r=this.getUtoTmapping(t);return this.getPoint(r,n)},n.getPoints=function(t){void 0===t&&(t=5);for(var n=[],r=0;r<=t;r++)n.push(this.getPoint(r/t));return n},n.getLength=function(){var t=this.getLengths();return t[t.length-1]},n.getLengths=function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var n,r=[],i=this.getPoint(0),e=0;r.push(0);for(var s=1;s<=t;s++)e+=(n=this.getPoint(s/t)).distanceTo(i),r.push(e),i=n;return this.cacheArcLengths=r,r},n.getUtoTmapping=function(t,n){var r,i=this.getLengths(),e=0,s=i.length;r=n||t*i[s-1];for(var o,a=0,h=s-1;a<=h;)if((o=i[e=Math.floor(a+(h-a)/2)]-r)<0)a=e+1;else{if(!(o>0)){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}()),et=new $,st=new $,ot=new $,at=new nt,ht=new it;var ut=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 $).copy(t[0]));for(var s=0,o=t.length;s<o;s++)if(0===s)this._start(t[s],t[s+1],i);else if(s===o-1)if(e){this._corner(t[s],t[1],n,r,i);var a=this.array[0].dist;this.array[0].copy(this.array[this.count-1]),this.array[0].dist=a}else this._end(t[s]);else this._corner(t[s],t[s+1],n,r,i)},n.distance=function(){return this.count>0?this.array[this.count-1].dist:0},n._getByIndex=function(t){return this.array[t]||(this.array[t]=new tt),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);s<e&&(e=s,i.up.set(1,0,0)),o<e&&(e=o,i.up.set(0,1,0)),a<e&&i.up.set(0,0,1)}i.right.crossVectors(i.dir,i.up).normalize(),i.up.crossVectors(i.right,i.dir).normalize(),i.dist=0,i.widthScale=1,i.sharp=!1,i.dir.normalize(),this.count++},n._end=function(t){var n=this.array[this.count-1],r=this._getByIndex(this.count);r.pos.copy(t),r.dir.subVectors(t,n.pos);var i=r.dir.length();r.dir.normalize(),r.up.copy(n.up);var e=et.crossVectors(n.dir,r.dir);if(e.length()>Number.EPSILON){e.normalize();var s=Math.acos(Math.min(Math.max(n.dir.dot(r.dir),-1),1));r.up.applyMatrix4(at.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=et.subVectors(n,t),a=st.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,ht),o=s.getPoints(i),a=0;a<i;a++)this._sharpCorner(o[a],o[a+1],e,0===a?1:0);o[i].equals(n)||this._sharpCorner(o[i],n,e,2)}else this._sharpCorner(t,n,e,0,!0)},n._sharpCorner=function(t,n,r,i,e){void 0===i&&(i=0),void 0===e&&(e=!1);var s=this.array[this.count-1],o=this._getByIndex(this.count),a=et.subVectors(t,s.pos),h=st.subVectors(n,t),u=a.length();if(a.normalize(),h.normalize(),o.pos.copy(t),1===i?o.dir.copy(a):2===i?o.dir.copy(h):(o.dir.addVectors(a,h),o.dir.normalize()),r)1===o.dir.dot(r)?o.right.crossVectors(h,r).normalize():o.right.crossVectors(o.dir,r).normalize(),o.up.crossVectors(o.right,o.dir).normalize();else{o.up.copy(s.up);var c=ot.crossVectors(s.dir,o.dir);if(c.length()>Number.EPSILON){c.normalize();var l=Math.acos(Math.min(Math.max(s.dir.dot(o.dir),-1),1));o.up.applyMatrix4(at.makeRotationAxis(c,l))}o.right.crossVectors(o.dir,o.up).normalize()}o.dist=s.dist+u;var f=a.dot(h);o.widthScale=Math.min(1/Math.sqrt((1+f)/2),1.415)||1,o.sharp=Math.abs(f-1)>.05&&e,this.count++},t}(),ct=new $(0,0,1);var lt=new $(0,0,1);t.cylinder=function(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,f=0,y=3*a,v=2*a,p=[],x=[],d=p.length-1,g=-1;g<r;g++){var _=o*g,m=Math.cos(_)*e+u,w=Math.sin(_)*e+c;h[l]=m,h[l+1]=w,h[l+2]=0,h[l+y]=m,h[l+1+y]=w,h[l+2+y]=s;var z,M;z=.5+m/e/2,M=.5+w/e/2,x[f]=z,x[f+1]=M,x[f+v]=z,x[f+1+v]=M,l+=3,f+=2,g>1&&(p[++d]=0,p[++d]=g-1,p[++d]=g)}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;var P=p.length;d=p.length-1;for(var S=0;S<P;S++){var A=p[S];p[++d]=A+a}var L=new Float32Array(2*(3*a*2-6)),k=-1;l=2*a,f=0,d=p.length-1;for(var C=x.length-1,E=0,Z=h.length/2;E<Z-3;E+=3){var O=h[E],V=h[E+1],j=h[E+3],I=h[E+4];L[++k]=O,L[++k]=V,L[++k]=s,L[++k]=j,L[++k]=I,L[++k]=s,L[++k]=O,L[++k]=V,L[++k]=0,L[++k]=j,L[++k]=I,L[++k]=0;var q=l+2,N=l+3,T=l,U=l+1;p[++d]=T,p[++d]=q,p[++d]=U,p[++d]=q,p[++d]=N,p[++d]=U,l+=4;var G=f/a,Q=(f+1)/a;x[++C]=G,x[++C]=s/e/2,x[++C]=Q,x[++C]=s/e/2,x[++C]=G,x[++C]=0,x[++C]=Q,x[++C]=0,f++}var R=new Float32Array(h.length+L.length);R.set(h,0),R.set(L,h.length);var Y=F(p,R);return{points:h,indices:new Uint32Array(p),position:R,normal:Y,uv:new Float32Array(x)}},t.expandLine=R,t.expandPaths=function(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 $(n,r,i||0)})),i=new ut;i.set(r,n.cornerRadius,n.cornerSplit,ct);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=[],f=[],y=[],v=[],p=0,x=new $,d=new $,g=new $,_=new $,m=new $,w=new $,z=l.length-1,M=f.length-1,b=y.length-1,P=v.length-1;function S(t){var n=0===l.length,r=t.sharp&&!n,i=t.dist/s,o=t.dir,a=t.up,h=t.right;if(x.copy(h).multiplyScalar(e*t.widthScale),d.copy(h).multiplyScalar(-e*t.widthScale),x.add(t.pos),d.add(t.pos),r){g.fromArray(l,l.length-6).sub(d),_.fromArray(l,l.length-3).sub(x);var S,A,L=g.length()-_.length();L>0?(S=g,A=d):(S=_,A=x),m.copy(S).setLength(Math.abs(L)).add(A);var k=w.copy(A).sub(m).normalize().dot(o)*w.copy(A).sub(m).length()*2;w.copy(o).setLength(k).add(m),L>0?(l[++z]=m.x,l[++z]=m.y,l[++z]=m.z,l[++z]=x.x,l[++z]=x.y,l[++z]=x.z,l[++z]=d.x,l[++z]=d.y,l[++z]=d.z,l[++z]=x.x,l[++z]=x.y,l[++z]=x.z,l[++z]=w.x,l[++z]=w.y,l[++z]=w.z,l[++z]=x.x,l[++z]=x.y,l[++z]=x.z,p+=6,v[++P]=p-6,v[++P]=p-8,v[++P]=p-7,v[++P]=p-6,v[++P]=p-7,v[++P]=p-5,v[++P]=p-4,v[++P]=p-6,v[++P]=p-5,v[++P]=p-2,v[++P]=p-4,v[++P]=p-1,c+=12):(l[++z]=d.x,l[++z]=d.y,l[++z]=d.z,l[++z]=m.x,l[++z]=m.y,l[++z]=m.z,l[++z]=d.x,l[++z]=d.y,l[++z]=d.z,l[++z]=x.x,l[++z]=x.y,l[++z]=x.z,l[++z]=d.x,l[++z]=d.y,l[++z]=d.z,l[++z]=w.x,l[++z]=w.y,l[++z]=w.z,p+=6,v[++P]=p-6,v[++P]=p-8,v[++P]=p-7,v[++P]=p-6,v[++P]=p-7,v[++P]=p-5,v[++P]=p-6,v[++P]=p-5,v[++P]=p-3,v[++P]=p-2,v[++P]=p-3,v[++P]=p-1,c+=12);for(var C=0;C<6;C++)f[++M]=a.x,f[++M]=a.y,f[++M]=a.z;y[++b]=i-u,y[++b]=0,y[++b]=i-u,y[++b]=1,y[++b]=i,y[++b]=0,y[++b]=i,y[++b]=1,y[++b]=i+u,y[++b]=0,y[++b]=i+u,y[++b]=1}else l[++z]=d.x,l[++z]=d.y,l[++z]=d.z,l[++z]=x.x,l[++z]=x.y,l[++z]=x.z,f[++M]=a.x,f[++M]=a.y,f[++M]=a.z,f[++M]=a.x,f[++M]=a.y,f[++M]=a.z,y[++b]=i,y[++b]=0,y[++b]=i,y[++b]=1,p+=2,n||(v[++P]=p-2,v[++P]=p-4,v[++P]=p-3,v[++P]=p-2,v[++P]=p-3,v[++P]=p-1,c+=6)}if(a>0)for(var A=0;A<t.count;A++){var L=t.array[A];if(L.dist>a){var k=t.array[A-1];h=new tt;var C=(a-k.dist)/(L.dist-k.dist);h.lerpPathPoints(k,L,C),S(h);break}S(L)}else h=t.array[0];return{position:l,normal:f,uv:y,indices:v,count:c}}(i,n);return e.line=t,e.position=new Float32Array(e.position),e.indices=new Uint32Array(e.indices),e.uv=new Float32Array(e.uv),e.normal=new Float32Array(e.normal),e})),i=Z(r);return i.lines=t,i},t.expandTubes=function(t,n){n=Object.assign({},{radius:1,cornerSplit:0,radialSegments:8,startRad:-Math.PI/4},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 $(n,r,i||0)})),i=new ut;i.set(r,n.cornerRadius,n.cornerSplit,lt);var e=function(t,n){var r=Math.max(n.radius||1,1e-8),i=void 0!==n.progress?n.progress:1,e=Math.max(3,n.radialSegments||8),s=n.startRad||0,o=2*r*Math.PI,a=t.distance(),h=i*a;if(0===h)return null;var u=0,c=[],l=[],f=[],y=[],v=0,p=new $,x=-1,d=-1,g=-1,_=-1;function m(t,n,r){for(var i=0===c.length,e=t.dist/o,a=0;a<=r;a++){var h=a;h===r&&(h=0),p.copy(t.up).applyAxisAngle(t.dir,s+2*Math.PI*h/r).normalize();var m=n*t.widthScale;c[++x]=t.pos.x+p.x*m,c[++x]=t.pos.y+p.y*m,c[++x]=t.pos.z+p.z*m,l[++d]=p.x,l[++d]=p.y,l[++d]=p.z,f[++g]=e,f[++g]=a/r,v++}if(!i)for(var w=v-2*(r+1),z=v-(r+1),M=0;M<r;M++)y[++_]=z+M,y[++_]=w+M,y[++_]=w+M+1,y[++_]=z+M,y[++_]=w+M+1,y[++_]=z+M+1,u+=6}if(h>0)for(var w=0;w<t.count;w++){var z=t.array[w];if(z.dist>h){var M=t.array[w-1],b=new tt,P=(h-M.dist)/(z.dist-M.dist);b.lerpPathPoints(M,z,P),m(b,r,e);break}m(z,r,e)}return{points:c,normal:l,uv:f,indices:y,count:u}}(i,n);return e.line=t,e.position=new Float32Array(e.points),e.indices=new Uint32Array(e.indices),e.uv=new Float32Array(e.uv),e.normal=new Float32Array(e.normal),e})),i=Z(r);return i.lines=t,i},t.extrudePolygons=function(t,n){n=Object.assign({},{depth:2},n);var r=t.map((function(t){for(var r=0,i=t.length;r<i;r++){var e=t[r];I(e),0===r?k(e)||(t[r]=e.reverse()):k(e)&&(t[r]=e.reverse()),q(e)&&e.splice(e.length-1,1)}var s=function(t,n){for(var r=function(t){var n=0,r=0,i=t.length;for(;r<i;)n+=t[r].length,r++;return n}(t),i=t.length,e=[],s=new Float32Array(2*r),o=[],a=[],h=3*r,u=2*r,c=n.depth,l=0,f=0,y=0,v=0;v<i;v++){var p=t[v];v>0&&e.push(l/2);for(var x=0,d=p.length;x<d;){var g=p[x],_=g[0],m=g[1],w=g[2]||0;s[l++]=_,s[l++]=m,o[f]=_,o[f+1]=m,o[f+2]=c+w,o[h+f]=_,o[h+f+1]=m,o[h+f+2]=w,a[y]=_,a[y+1]=m,a[u+y]=_,a[u+y+1]=m,f+=3,y+=2,x++}}return{flatVertices:s,holes:e,points:o,count:r,uv:a}}(t,n);return s.polygon=t,function(t,n){for(var r=[],i=t.count,e=0,s=n.length;e<s;e+=3){var o=n[e],a=n[e+1],h=n[e+2];r[e]=o,r[e+1]=a,r[e+2]=h;var u=s+e,c=i+o,l=i+a,f=i+h;r[u]=c,r[u+1]=l,r[u+2]=f}t.indices=r}(s,L(s.flatVertices,s.holes,2)),function(t,n){for(var r=t.points,i=t.indices,e=t.polygon,s=t.uv,o=n.depth,a=r.length-1,h=i.length-1,u=0,c=e.length;u<c;u++)for(var l=e[u],f=0,y=l.length;f<y;){var v=l[f],p=l[f+1];f===y-1&&(p=l[0]);var x=r.length/3,d=v[0],g=v[1],_=v[2]||0,m=p[0],w=p[1],z=p[2]||0;r[++a]=d,r[++a]=g,r[++a]=_+o,r[++a]=m,r[++a]=w,r[++a]=z+o,r[++a]=d,r[++a]=g,r[++a]=_,r[++a]=m,r[++a]=w,r[++a]=z;var M=x+2,b=x+3,P=x,S=x+1;i[++h]=M,i[++h]=P,i[++h]=b,i[++h]=P,i[++h]=S,i[++h]=b,j(s,r,M,b,P,S),f++}}(s,n),s.position=new Float32Array(s.points),s.indices=new Uint32Array(s.indices),s.uv=new Float32Array(s.uv),s.normal=F(s.indices,s.position),s})),i=Z(r);return i.polygons=t,i},t.extrudePolylines=function(t,n){N(n=Object.assign({},{depth:2,lineWidth:1,bottomStickGround:!1},n));var r=t.map((function(t){var r=R(t,n);return r.line=t,T(r,n),U(r,n),r.position=new Float32Array(r.points),r.indices=new Uint32Array(r.indices),r.uv=new Float32Array(r.uv),r.normal=F(r.indices,r.position),r})),i=Z(r);return i.lines=t,i},t.extrudeSlopes=function(t,n){N(n=Object.assign({},{depth:2,lineWidth:1,side:"left",sideDepth:0,bottomStickGround:!1},n));var r=n,i=r.depth,e=r.side,s=r.sideDepth,o=t.map((function(t){var r=R(t,n);r.line=t;for(var o,a=r.leftPoints,h=r.rightPoints,u={line:t},c=0,l=t.length;c<l;c++)t[c][2]=t[c][2]||0;return"left"===e?(u.leftPoints=a,u.rightPoints=t,o=[s,i]):(u.leftPoints=t,u.rightPoints=h,o=[i,s]),u.depths=o,T(u,n),U(u,n),u.position=new Float32Array(u.points),u.indices=new Uint32Array(u.indices),u.uv=new Float32Array(u.uv),u.normal=F(u.indices,u.position),u})),a=Z(o);return a.lines=t,a},t.leftOnLine=W,Object.defineProperty(t,"__esModule",{value:!0})}));
|