poly-extrude 0.7.0 → 0.8.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 +32 -9
- package/dist/poly-extrude.js.map +1 -1
- package/dist/poly-extrude.min.js +2 -2
- package/dist/poly-extrude.mjs +32 -9
- package/package.json +1 -1
- package/readme.md +22 -26
- package/src/polygon.js +28 -8
package/dist/poly-extrude.min.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
|
-
* poly-extrude v0.
|
2
|
+
* poly-extrude v0.8.0
|
3
3
|
*/
|
4
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(){
|
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={},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],w=g[2]||0;s[l++]=_,s[l++]=m,o[f]=_,o[f+1]=m,o[f+2]=c+w,o[a+f]=_,o[a+f+1]=m,o[a+f+2]=w,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=n.length-1,a=i.length-1,u=0,c=e.length;u<c;u++)for(var l=e[u],f=0,y=l.length;f<y;){var p=l[f],v=l[f+1];f===y-1&&(v=l[0]);var x=n.length/3,d=p[0],g=p[1],_=p[2]||0,m=v[0],w=v[1],z=v[2]||0;n[++h]=d,n[++h]=g,n[++h]=_+o,n[++h]=m,n[++h]=w,n[++h]=z+o,n[++h]=d,n[++h]=g,n[++h]=_,n[++h]=m,n[++h]=w,n[++h]=z;var M=x+2,b=x+3,P=x,S=x+1;i[++a]=M,i[++a]=P,i[++a]=b,i[++a]=P,i[++a]=S,i[++a]=b,j(s,n,M,b,P,S),f++}}(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})}));
|
package/dist/poly-extrude.mjs
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* poly-extrude v0.
|
2
|
+
* poly-extrude v0.8.0
|
3
3
|
*/
|
4
4
|
var earcut$2 = {exports: {}};
|
5
5
|
|
@@ -944,7 +944,9 @@ function generateSides$1(result, options) {
|
|
944
944
|
index = result.index,
|
945
945
|
polygon = result.polygon,
|
946
946
|
uvs = result.uvs;
|
947
|
-
var
|
947
|
+
var depth = options.depth;
|
948
|
+
var pIndex = points.length - 1;
|
949
|
+
var iIndex = index.length - 1;
|
948
950
|
|
949
951
|
for (var i = 0, len = polygon.length; i < len; i++) {
|
950
952
|
var ring = polygon[i];
|
@@ -962,15 +964,35 @@ function generateSides$1(result, options) {
|
|
962
964
|
var idx = points.length / 3;
|
963
965
|
var x1 = v1[0],
|
964
966
|
y1 = v1[1],
|
967
|
+
z1 = v1[2] || 0,
|
965
968
|
x2 = v2[0],
|
966
|
-
y2 = v2[1]
|
967
|
-
|
969
|
+
y2 = v2[1],
|
970
|
+
z2 = v2[2] || 0;
|
971
|
+
points[++pIndex] = x1;
|
972
|
+
points[++pIndex] = y1;
|
973
|
+
points[++pIndex] = z1 + depth;
|
974
|
+
points[++pIndex] = x2;
|
975
|
+
points[++pIndex] = y2;
|
976
|
+
points[++pIndex] = z2 + depth;
|
977
|
+
points[++pIndex] = x1;
|
978
|
+
points[++pIndex] = y1;
|
979
|
+
points[++pIndex] = z1;
|
980
|
+
points[++pIndex] = x2;
|
981
|
+
points[++pIndex] = y2;
|
982
|
+
points[++pIndex] = z2; // points.push(x1, y1, z, x2, y2, z, x1, y1, 0, x2, y2, 0);
|
983
|
+
|
968
984
|
var a = idx + 2,
|
969
985
|
b = idx + 3,
|
970
986
|
c = idx,
|
971
987
|
d = idx + 1; // points.push(p3, p4, p1, p2);
|
988
|
+
// index.push(a, c, b, c, d, b);
|
972
989
|
|
973
|
-
index
|
990
|
+
index[++iIndex] = a;
|
991
|
+
index[++iIndex] = c;
|
992
|
+
index[++iIndex] = b;
|
993
|
+
index[++iIndex] = c;
|
994
|
+
index[++iIndex] = d;
|
995
|
+
index[++iIndex] = b; // index.push(c, d, b);
|
974
996
|
|
975
997
|
generateSideWallUV(uvs, points, a, b, c, d);
|
976
998
|
j++;
|
@@ -1000,7 +1022,7 @@ function flatVertices(polygon, options) {
|
|
1000
1022
|
uvs = [];
|
1001
1023
|
var pOffset = count * 3,
|
1002
1024
|
uOffset = count * 2;
|
1003
|
-
var
|
1025
|
+
var depth = options.depth;
|
1004
1026
|
var idx0 = 0,
|
1005
1027
|
idx1 = 0,
|
1006
1028
|
idx2 = 0;
|
@@ -1018,17 +1040,18 @@ function flatVertices(polygon, options) {
|
|
1018
1040
|
while (j < len1) {
|
1019
1041
|
var c = ring[j];
|
1020
1042
|
var x = c[0],
|
1021
|
-
y = c[1]
|
1043
|
+
y = c[1],
|
1044
|
+
z = c[2] || 0;
|
1022
1045
|
flatVertices[idx0++] = x;
|
1023
1046
|
flatVertices[idx0++] = y; // top vertices
|
1024
1047
|
|
1025
1048
|
points[idx1] = x;
|
1026
1049
|
points[idx1 + 1] = y;
|
1027
|
-
points[idx1 + 2] = z; // bottom vertices
|
1050
|
+
points[idx1 + 2] = depth + z; // bottom vertices
|
1028
1051
|
|
1029
1052
|
points[pOffset + idx1] = x;
|
1030
1053
|
points[pOffset + idx1 + 1] = y;
|
1031
|
-
points[pOffset + idx1 + 2] =
|
1054
|
+
points[pOffset + idx1 + 2] = z;
|
1032
1055
|
uvs[idx2] = x;
|
1033
1056
|
uvs[idx2 + 1] = y;
|
1034
1057
|
uvs[uOffset + idx2] = x;
|
package/package.json
CHANGED
package/readme.md
CHANGED
@@ -4,29 +4,21 @@ Extrude polygons/polylines. Born in [maptalks.three](https://github.com/maptalks
|
|
4
4
|
|
5
5
|
## Examples
|
6
6
|
|
7
|
-
[building](https://deyihu.github.io/poly-extrude/test/building.html)
|
8
|
-
|
9
|
-
[buildings](https://deyihu.github.io/poly-extrude/test/buildings.html)
|
10
|
-
|
11
|
-
[multi-polygon](https://deyihu.github.io/poly-extrude/test/multi-polygon.html)<br>
|
12
|
-
|
13
|
-
[
|
14
|
-
|
15
|
-
[
|
16
|
-
|
17
|
-
[
|
18
|
-
|
19
|
-
[
|
20
|
-
|
21
|
-
[
|
22
|
-
<!--  -->
|
23
|
-
[spring](https://deyihu.github.io/poly-extrude/test/spring.html)<br>
|
24
|
-
<!--  -->
|
25
|
-
[expand paths](https://deyihu.github.io/poly-extrude/test/expand-paths-brige.html)<br>
|
26
|
-
<!--  -->
|
27
|
-
[slope](https://deyihu.github.io/poly-extrude/test/slope.html)<br>
|
28
|
-
|
29
|
-
[tube](https://deyihu.github.io/poly-extrude/test/tube.html)<br>
|
7
|
+
[](https://deyihu.github.io/poly-extrude/test/building.html)
|
8
|
+
|
9
|
+
[](https://deyihu.github.io/poly-extrude/test/buildings.html)
|
10
|
+
|
11
|
+
[](https://deyihu.github.io/poly-extrude/test/multi-polygon.html)<br>
|
12
|
+
[](https://deyihu.github.io/poly-extrude/test/street.html)<br>
|
13
|
+
[](https://deyihu.github.io/poly-extrude/test/line-uv.html)<br>
|
14
|
+
[](https://deyihu.github.io/poly-extrude/test/ny-building.html)<br>
|
15
|
+
[](https://deyihu.github.io/poly-extrude/test/cylinder.html)<br>
|
16
|
+
[](https://deyihu.github.io/poly-extrude/test/brige.html)<br>
|
17
|
+
[](https://deyihu.github.io/poly-extrude/test/spring.html)<br>
|
18
|
+
[](https://deyihu.github.io/poly-extrude/test/expand-paths-brige.html)<br>
|
19
|
+
[](https://deyihu.github.io/poly-extrude/test/slope.html)<br>
|
20
|
+
|
21
|
+
[](https://deyihu.github.io/poly-extrude/test/tube.html)<br>
|
30
22
|
|
31
23
|
## Install
|
32
24
|
|
@@ -34,7 +26,6 @@ Extrude polygons/polylines. Born in [maptalks.three](https://github.com/maptalks
|
|
34
26
|
|
35
27
|
```sh
|
36
28
|
npm i poly-extrude
|
37
|
-
|
38
29
|
```
|
39
30
|
|
40
31
|
### CDN
|
@@ -55,7 +46,7 @@ npm i poly-extrude
|
|
55
46
|
expandTubes
|
56
47
|
} from 'poly-extrude';
|
57
48
|
|
58
|
-
//if you use cdn
|
49
|
+
//if you use cdn,the namespace is polyextrude
|
59
50
|
|
60
51
|
// const {
|
61
52
|
// extrudePolygons,
|
@@ -132,7 +123,7 @@ npm i poly-extrude
|
|
132
123
|
//do something
|
133
124
|
```
|
134
125
|
|
135
|
-
|
126
|
+

|
136
127
|
### `extrudePolylines(lines, options)`
|
137
128
|
|
138
129
|
* `lines`
|
@@ -154,6 +145,7 @@ npm i poly-extrude
|
|
154
145
|
//do something
|
155
146
|
```
|
156
147
|
|
148
|
+

|
157
149
|
### `cylinder(center, options)`
|
158
150
|
|
159
151
|
* `center`
|
@@ -180,6 +172,7 @@ const {
|
|
180
172
|
//do something
|
181
173
|
```
|
182
174
|
|
175
|
+

|
183
176
|
### `expandPaths(lines, options)`
|
184
177
|
|
185
178
|
* `lines`
|
@@ -203,6 +196,8 @@ const {
|
|
203
196
|
//do something
|
204
197
|
```
|
205
198
|
|
199
|
+

|
200
|
+
|
206
201
|
### `extrudeSlopes(lines, options)`
|
207
202
|
|
208
203
|
* `lines`
|
@@ -232,6 +227,7 @@ const {
|
|
232
227
|
//do something
|
233
228
|
```
|
234
229
|
|
230
|
+

|
235
231
|
### `expandTubes(lines, options)`
|
236
232
|
|
237
233
|
* `lines`
|
package/src/polygon.js
CHANGED
@@ -57,7 +57,9 @@ function generateTopAndBottom(result, triangles) {
|
|
57
57
|
|
58
58
|
function generateSides(result, options) {
|
59
59
|
const { points, index, polygon, uvs } = result;
|
60
|
-
const
|
60
|
+
const depth = options.depth;
|
61
|
+
let pIndex = points.length - 1;
|
62
|
+
let iIndex = index.length - 1;
|
61
63
|
for (let i = 0, len = polygon.length; i < len; i++) {
|
62
64
|
const ring = polygon[i];
|
63
65
|
let j = 0;
|
@@ -69,11 +71,29 @@ function generateSides(result, options) {
|
|
69
71
|
v2 = ring[0];
|
70
72
|
}
|
71
73
|
const idx = points.length / 3;
|
72
|
-
const x1 = v1[0], y1 = v1[1], x2 = v2[0], y2 = v2[1];
|
73
|
-
points
|
74
|
+
const x1 = v1[0], y1 = v1[1], z1 = v1[2] || 0, x2 = v2[0], y2 = v2[1], z2 = v2[2] || 0;
|
75
|
+
points[++pIndex] = x1;
|
76
|
+
points[++pIndex] = y1;
|
77
|
+
points[++pIndex] = z1 + depth;
|
78
|
+
points[++pIndex] = x2;
|
79
|
+
points[++pIndex] = y2;
|
80
|
+
points[++pIndex] = z2 + depth;
|
81
|
+
points[++pIndex] = x1;
|
82
|
+
points[++pIndex] = y1;
|
83
|
+
points[++pIndex] = z1;
|
84
|
+
points[++pIndex] = x2;
|
85
|
+
points[++pIndex] = y2;
|
86
|
+
points[++pIndex] = z2;
|
87
|
+
// points.push(x1, y1, z, x2, y2, z, x1, y1, 0, x2, y2, 0);
|
74
88
|
const a = idx + 2, b = idx + 3, c = idx, d = idx + 1;
|
75
89
|
// points.push(p3, p4, p1, p2);
|
76
|
-
index.push(a, c, b, c, d, b);
|
90
|
+
// index.push(a, c, b, c, d, b);
|
91
|
+
index[++iIndex] = a;
|
92
|
+
index[++iIndex] = c;
|
93
|
+
index[++iIndex] = b;
|
94
|
+
index[++iIndex] = c;
|
95
|
+
index[++iIndex] = d;
|
96
|
+
index[++iIndex] = b;
|
77
97
|
// index.push(c, d, b);
|
78
98
|
|
79
99
|
generateSideWallUV(uvs, points, a, b, c, d);
|
@@ -98,7 +118,7 @@ function flatVertices(polygon, options) {
|
|
98
118
|
const len = polygon.length;
|
99
119
|
const holes = [], flatVertices = new Float32Array(count * 2), points = [], uvs = [];
|
100
120
|
const pOffset = count * 3, uOffset = count * 2;
|
101
|
-
const
|
121
|
+
const depth = options.depth;
|
102
122
|
|
103
123
|
let idx0 = 0, idx1 = 0, idx2 = 0;
|
104
124
|
for (let i = 0; i < len; i++) {
|
@@ -110,7 +130,7 @@ function flatVertices(polygon, options) {
|
|
110
130
|
const len1 = ring.length;
|
111
131
|
while (j < len1) {
|
112
132
|
const c = ring[j];
|
113
|
-
const x = c[0], y = c[1];
|
133
|
+
const x = c[0], y = c[1], z = c[2] || 0;
|
114
134
|
|
115
135
|
flatVertices[idx0++] = x;
|
116
136
|
flatVertices[idx0++] = y;
|
@@ -118,12 +138,12 @@ function flatVertices(polygon, options) {
|
|
118
138
|
// top vertices
|
119
139
|
points[idx1] = x;
|
120
140
|
points[idx1 + 1] = y;
|
121
|
-
points[idx1 + 2] = z;
|
141
|
+
points[idx1 + 2] = depth + z;
|
122
142
|
|
123
143
|
// bottom vertices
|
124
144
|
points[pOffset + idx1] = x;
|
125
145
|
points[pOffset + idx1 + 1] = y;
|
126
|
-
points[pOffset + idx1 + 2] =
|
146
|
+
points[pOffset + idx1 + 2] = z;
|
127
147
|
|
128
148
|
uvs[idx2] = x;
|
129
149
|
uvs[idx2 + 1] = y;
|