poly-extrude 0.15.0 → 0.17.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/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/poly-extrude.js +4367 -4081
- package/dist/poly-extrude.js.map +1 -1
- package/dist/poly-extrude.min.js +2 -2
- package/dist/poly-extrude.mjs +543 -259
- package/dist/poly-extrude.mjs.map +1 -1
- package/dist/polygon.d.ts +2 -0
- package/dist/polygon.js +56 -40
- package/dist/polygon.js.map +1 -1
- package/dist/polygonpath.d.ts +11 -0
- package/dist/polygonpath.js +262 -0
- package/dist/polygonpath.js.map +1 -0
- package/dist/util.d.ts +7 -1
- package/dist/util.js +63 -0
- package/dist/util.js.map +1 -1
- package/package.json +2 -2
- package/readme.md +3 -1
- package/src/index.ts +5 -2
- package/src/polygon.ts +65 -40
- package/src/polygonpath.ts +315 -0
- package/src/util.ts +68 -1
package/dist/poly-extrude.min.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
/*!
|
2
|
-
* poly-extrude v0.
|
2
|
+
* poly-extrude v0.17.0
|
3
3
|
*/
|
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 i(t,n,i){i=i||2;var r,o,h,a,u,f,y,p=n&&n.length,d=p?n[0]*i:t.length,v=e(t,0,d,i,!0),_=[];if(!v||v.next===v.prev)return _;if(p&&(v=function(t,n,i,r){var s,o,h,a=[];for(s=0,o=n.length;s<o;s++)(h=e(t,n[s]*r,s<o-1?n[s+1]*r:t.length,r,!1))===h.next&&(h.steiner=!0),a.push(x(h));for(a.sort(c),s=0;s<a.length;s++)i=l(a[s],i);return i}(t,n,v,i)),t.length>80*i){r=h=t[0],o=a=t[1];for(var g=i;g<d;g+=i)(u=t[g])<r&&(r=u),(f=t[g+1])<o&&(o=f),u>h&&(h=u),f>a&&(a=f);y=0!==(y=Math.max(h-r,a-o))?32767/y:0}return s(v,_,i,r,o,y,0),_}function e(t,n,i,e,r){var s,o;if(r===S(t,n,i,e)>0)for(s=n;s<i;s+=e)o=b(s,t[s],t[s+1],o);else for(s=i-e;s>=n;s-=e)o=b(s,t[s],t[s+1],o);return o&&_(o,o.next)&&(A(o),o=o.next),o}function r(t,n){if(!t)return t;n||(n=t);var i,e=t;do{if(i=!1,e.steiner||!_(e,e.next)&&0!==v(e.prev,e,e.next))e=e.next;else{if(A(e),(e=n=e.prev)===e.next)break;i=!0}}while(i||e!==n);return n}function s(t,n,i,e,c,l,f){if(t){!f&&l&&function(t,n,i,e){var r=t;do{0===r.z&&(r.z=y(r.x,r.y,n,i,e)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var n,i,e,r,s,o,h,a,u=1;do{for(i=t,t=null,s=null,o=0;i;){for(o++,e=i,h=0,n=0;n<u&&(h++,e=e.nextZ);n++);for(a=u;h>0||a>0&&e;)0!==h&&(0===a||!e||i.z<=e.z)?(r=i,i=i.nextZ,h--):(r=e,e=e.nextZ,a--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=e}s.nextZ=null,u*=2}while(o>1)}(r)}(t,e,c,l);for(var x,p,d=t;t.prev!==t.next;)if(x=t.prev,p=t.next,l?h(t,e,c,l):o(t))n.push(x.i/i|0),n.push(t.i/i|0),n.push(p.i/i|0),A(t),t=p.next,d=p.next;else if((t=p)===d){f?1===f?s(t=a(r(t),n,i),n,i,e,c,l,2):2===f&&u(t,n,i,e,c,l):s(r(t),n,i,e,c,l,1);break}}}function o(t){var n=t.prev,i=t,e=t.next;if(v(n,i,e)>=0)return!1;for(var r=n.x,s=i.x,o=e.x,h=n.y,a=i.y,u=e.y,c=r<s?r<o?r:o:s<o?s:o,l=h<a?h<u?h:u:a<u?a:u,f=r>s?r>o?r:o:s>o?s:o,y=h>a?h>u?h:u:a>u?a:u,x=e.next;x!==n;){if(x.x>=c&&x.x<=f&&x.y>=l&&x.y<=y&&p(r,h,s,a,o,u,x.x,x.y)&&v(x.prev,x,x.next)>=0)return!1;x=x.next}return!0}function h(t,n,i,e){var r=t.prev,s=t,o=t.next;if(v(r,s,o)>=0)return!1;for(var h=r.x,a=s.x,u=o.x,c=r.y,l=s.y,f=o.y,x=h<a?h<u?h:u:a<u?a:u,d=c<l?c<f?c:f:l<f?l:f,_=h>a?h>u?h:u:a>u?a:u,g=c>l?c>f?c:f:l>f?l:f,z=y(x,d,n,i,e),m=y(_,g,n,i,e),w=t.prevZ,M=t.nextZ;w&&w.z>=z&&M&&M.z<=m;){if(w.x>=x&&w.x<=_&&w.y>=d&&w.y<=g&&w!==r&&w!==o&&p(h,c,a,l,u,f,w.x,w.y)&&v(w.prev,w,w.next)>=0)return!1;if(w=w.prevZ,M.x>=x&&M.x<=_&&M.y>=d&&M.y<=g&&M!==r&&M!==o&&p(h,c,a,l,u,f,M.x,M.y)&&v(M.prev,M,M.next)>=0)return!1;M=M.nextZ}for(;w&&w.z>=z;){if(w.x>=x&&w.x<=_&&w.y>=d&&w.y<=g&&w!==r&&w!==o&&p(h,c,a,l,u,f,w.x,w.y)&&v(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;M&&M.z<=m;){if(M.x>=x&&M.x<=_&&M.y>=d&&M.y<=g&&M!==r&&M!==o&&p(h,c,a,l,u,f,M.x,M.y)&&v(M.prev,M,M.next)>=0)return!1;M=M.nextZ}return!0}function a(t,n,i){var e=t;do{var s=e.prev,o=e.next.next;!_(s,o)&&g(s,e,e.next,o)&&w(s,o)&&w(o,s)&&(n.push(s.i/i|0),n.push(e.i/i|0),n.push(o.i/i|0),A(e),A(e.next),e=t=o),e=e.next}while(e!==t);return r(e)}function u(t,n,i,e,o,h){var a=t;do{for(var u=a.next.next;u!==a.prev;){if(a.i!==u.i&&d(a,u)){var c=M(a,u);return a=r(a,a.next),c=r(c,c.next),s(a,n,i,e,o,h,0),void s(c,n,i,e,o,h,0)}u=u.next}a=a.next}while(a!==t)}function c(t,n){return t.x-n.x}function l(t,n){var i=function(t,n){var i,e=n,r=t.x,s=t.y,o=-1/0;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var h=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(h<=r&&h>o&&(o=h,i=e.x<e.next.x?e:e.next,h===r))return i}e=e.next}while(e!==n);if(!i)return null;var a,u=i,c=i.x,l=i.y,y=1/0;e=i;do{r>=e.x&&e.x>=c&&r!==e.x&&p(s<l?r:o,s,c,l,s<l?o:r,s,e.x,e.y)&&(a=Math.abs(s-e.y)/(r-e.x),w(e,t)&&(a<y||a===y&&(e.x>i.x||e.x===i.x&&f(i,e)))&&(i=e,y=a)),e=e.next}while(e!==u);return i}(t,n);if(!i)return n;var e=M(i,t);return r(e,e.next),r(i,i.next)}function f(t,n){return v(t.prev,t,n.prev)<0&&v(n.next,t,t.next)<0}function y(t,n,i,e,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-e)*r|0)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function x(t){var n=t,i=t;do{(n.x<i.x||n.x===i.x&&n.y<i.y)&&(i=n),n=n.next}while(n!==t);return i}function p(t,n,i,e,r,s,o,h){return(r-o)*(n-h)>=(t-o)*(s-h)&&(t-o)*(e-h)>=(i-o)*(n-h)&&(i-o)*(s-h)>=(r-o)*(e-h)}function d(t,n){return t.next.i!==n.i&&t.prev.i!==n.i&&!function(t,n){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==n.i&&i.next.i!==n.i&&g(i,i.next,t,n))return!0;i=i.next}while(i!==t);return!1}(t,n)&&(w(t,n)&&w(n,t)&&function(t,n){var i=t,e=!1,r=(t.x+n.x)/2,s=(t.y+n.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(e=!e),i=i.next}while(i!==t);return e}(t,n)&&(v(t.prev,t,n.prev)||v(t,n.prev,n))||_(t,n)&&v(t.prev,t,t.next)>0&&v(n.prev,n,n.next)>0)}function v(t,n,i){return(n.y-t.y)*(i.x-n.x)-(n.x-t.x)*(i.y-n.y)}function _(t,n){return t.x===n.x&&t.y===n.y}function g(t,n,i,e){var r=m(v(t,n,i)),s=m(v(t,n,e)),o=m(v(i,e,t)),h=m(v(i,e,n));return r!==s&&o!==h||(!(0!==r||!z(t,i,n))||(!(0!==s||!z(t,e,n))||(!(0!==o||!z(i,t,e))||!(0!==h||!z(i,n,e)))))}function z(t,n,i){return n.x<=Math.max(t.x,i.x)&&n.x>=Math.min(t.x,i.x)&&n.y<=Math.max(t.y,i.y)&&n.y>=Math.min(t.y,i.y)}function m(t){return t>0?1:t<0?-1:0}function w(t,n){return v(t.prev,t,t.next)<0?v(t,n,t.next)>=0&&v(t,t.prev,n)>=0:v(t,n,t.prev)<0||v(t,t.next,n)<0}function M(t,n){var i=new P(t.i,t.x,t.y),e=new P(n.i,n.x,n.y),r=t.next,s=n.prev;return t.next=n,n.prev=t,i.next=r,r.prev=i,e.next=i,i.prev=e,s.next=e,e.prev=s,e}function b(t,n,i,e){var r=new P(t,n,i);return e?(r.next=e.next,r.prev=e,e.next.prev=r,e.next=r):(r.prev=r,r.next=r),r}function A(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 P(t,n,i){this.i=t,this.x=n,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function S(t,n,i,e){for(var r=0,s=n,o=i-e;s<i;s+=e)r+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return r}n.exports=i,n.exports.default=i,i.deviation=function(t,n,i,e){var r=n&&n.length,s=r?n[0]*i:t.length,o=Math.abs(S(t,0,s,i));if(r)for(var h=0,a=n.length;h<a;h++){var u=n[h]*i,c=h<a-1?n[h+1]*i:t.length;o-=Math.abs(S(t,u,c,i))}var l=0;for(h=0;h<e.length;h+=3){var f=e[h]*i,y=e[h+1]*i,x=e[h+2]*i;l+=Math.abs((t[f]-t[x])*(t[y+1]-t[f+1])-(t[f]-t[y])*(t[x+1]-t[f+1]))}return 0===o&&0===l?0:Math.abs((l-o)/o)},i.flatten=function(t){for(var n=t[0][0].length,i={vertices:[],holes:[],dimensions:n},e=0,r=0;r<t.length;r++){for(var s=0;s<t[r].length;s++)for(var o=0;o<n;o++)i.vertices.push(t[r][s][o]);r>0&&(e+=t[r-1].length,i.holes.push(e))}return i};var C=n.exports;function k(t,n){for(var i=0;i<n.length;i++){var e=n[i];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,e.key,e)}}function V(t,n){return V=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},V(t,n)}var Z=new(function(){function t(t,n,i,e){void 0===t&&(t=0),void 0===n&&(n=0),void 0===i&&(i=0),void 0===e&&(e=1),this.isQuaternion=!0,this._x=t,this._y=n,this._z=i,this._w=e}t.slerpFlat=function(t,n,i,e,r,s,o){var h=i[e+0],a=i[e+1],u=i[e+2],c=i[e+3],l=r[s+0],f=r[s+1],y=r[s+2],x=r[s+3];if(0===o)return t[n+0]=h,t[n+1]=a,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]=x);if(c!==x||h!==l||a!==f||u!==y){var p=1-o,d=h*l+a*f+u*y+c*x,v=d>=0?1:-1,_=1-d*d;if(_>Number.EPSILON){var g=Math.sqrt(_),z=Math.atan2(g,d*v);p=Math.sin(p*z)/g,o=Math.sin(o*z)/g}var m=o*v;if(h=h*p+l*m,a=a*p+f*m,u=u*p+y*m,c=c*p+x*m,p===1-o){var w=1/Math.sqrt(h*h+a*a+u*u+c*c);h*=w,a*=w,u*=w,c*=w}}t[n]=h,t[n+1]=a,t[n+2]=u,t[n+3]=c},t.multiplyQuaternionsFlat=function(t,n,i,e,r,s){var o=i[e],h=i[e+1],a=i[e+2],u=i[e+3],c=r[s],l=r[s+1],f=r[s+2],y=r[s+3];return t[n]=o*y+u*c+h*f-a*l,t[n+1]=h*y+u*l+a*c-o*f,t[n+2]=a*y+u*f+o*l-h*c,t[n+3]=u*y-o*c-h*l-a*f,t};var n,i,e,r=t.prototype;return r.set=function(t,n,i,e){return this._x=t,this._y=n,this._z=i,this._w=e,this._onChangeCallback(),this},r.clone=function(){return new this.constructor(this._x,this._y,this._z,this._w)},r.copy=function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this},r.setFromEuler=function(t,n){void 0===n&&(n=!0);var i=t._x,e=t._y,r=t._z,s=t._order,o=Math.cos,h=Math.sin,a=o(i/2),u=o(e/2),c=o(r/2),l=h(i/2),f=h(e/2),y=h(r/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===n&&this._onChangeCallback(),this},r.setFromAxisAngle=function(t,n){var i=n/2,e=Math.sin(i);return this._x=t.x*e,this._y=t.y*e,this._z=t.z*e,this._w=Math.cos(i),this._onChangeCallback(),this},r.setFromRotationMatrix=function(t){var n=t.elements,i=n[0],e=n[4],r=n[8],s=n[1],o=n[5],h=n[9],a=n[2],u=n[6],c=n[10],l=i+o+c;if(l>0){var f=.5/Math.sqrt(l+1);this._w=.25/f,this._x=(u-h)*f,this._y=(r-a)*f,this._z=(s-e)*f}else if(i>o&&i>c){var y=2*Math.sqrt(1+i-o-c);this._w=(u-h)/y,this._x=.25*y,this._y=(e+s)/y,this._z=(r+a)/y}else if(o>c){var x=2*Math.sqrt(1+o-i-c);this._w=(r-a)/x,this._x=(e+s)/x,this._y=.25*x,this._z=(h+u)/x}else{var p=2*Math.sqrt(1+c-i-o);this._w=(s-e)/p,this._x=(r+a)/p,this._y=(h+u)/p,this._z=.25*p}return this._onChangeCallback(),this},r.setFromUnitVectors=function(t,n){var i=t.dot(n)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(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=i),this.normalize()},r.rotateTowards=function(t,n){var i=this.angleTo(t);if(0===i)return this;var e=Math.min(1,n/i);return this.slerp(t,e),this},r.identity=function(){return this.set(0,0,0,1)},r.invert=function(){return this.conjugate()},r.conjugate=function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},r.dot=function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},r.lengthSq=function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},r.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},r.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},r.multiply=function(t){return this.multiplyQuaternions(this,t)},r.premultiply=function(t){return this.multiplyQuaternions(t,this)},r.multiplyQuaternions=function(t,n){var i=t._x,e=t._y,r=t._z,s=t._w,o=n._x,h=n._y,a=n._z,u=n._w;return this._x=i*u+s*o+e*a-r*h,this._y=e*u+s*h+r*o-i*a,this._z=r*u+s*a+i*h-e*o,this._w=s*u-i*o-e*h-r*a,this._onChangeCallback(),this},r.slerp=function(t,n){if(0===n)return this;if(1===n)return this.copy(t);var i=this._x,e=this._y,r=this._z,s=this._w,o=s*t._w+i*t._x+e*t._y+r*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=i,this._y=e,this._z=r,this;var h=1-o*o;if(h<=Number.EPSILON){var a=1-n;return this._w=a*s+n*this._w,this._x=a*i+n*this._x,this._y=a*e+n*this._y,this._z=a*r+n*this._z,this.normalize(),this}var u=Math.sqrt(h),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=i*l+this._x*f,this._y=e*l+this._y*f,this._z=r*l+this._z*f,this._onChangeCallback(),this},r.slerpQuaternions=function(t,n,i){return this.copy(t).slerp(n,i)},r.random=function(){var t=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),i=Math.random(),e=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(e*Math.sin(t),e*Math.cos(t),r*Math.sin(n),r*Math.cos(n))},r.equals=function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},r.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},r.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},r.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},r.toJSON=function(){return this.toArray()},r._onChange=function(t){return this._onChangeCallback=t,this},r._onChangeCallback=function(){},n=t,(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()}}])&&k(n.prototype,i),e&&k(n,e),Object.defineProperty(n,"prototype",{writable:!1}),t}()),F=function(){function t(t,n,i){void 0===t&&(t=0),void 0===n&&(n=0),void 0===i&&(i=0),this.x=t,this.y=n,this.z=i}var n=t.prototype;return n.set=function(t,n,i){return void 0===i&&(i=this.z),this.x=t,this.y=n,this.z=i,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(Z.setFromAxisAngle(t,n))},n.applyMatrix4=function(t){var n=this.x,i=this.y,e=this.z,r=t.elements,s=1/(r[3]*n+r[7]*i+r[11]*e+r[15]);return this.x=(r[0]*n+r[4]*i+r[8]*e+r[12])*s,this.y=(r[1]*n+r[5]*i+r[9]*e+r[13])*s,this.z=(r[2]*n+r[6]*i+r[10]*e+r[14])*s,this},n.applyQuaternion=function(t){var n=this.x,i=this.y,e=this.z,r=t.x,s=t.y,o=t.z,h=t.w,a=h*n+s*e-o*i,u=h*i+o*n-r*e,c=h*e+r*i-s*n,l=-r*n-s*i-o*e;return this.x=a*h+l*-r+u*-o-c*-s,this.y=u*h+l*-s+c*-r-a*-o,this.z=c*h+l*-o+a*-s-u*-r,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 i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(n,i)))},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,i){return this.x=t.x+(n.x-t.x)*i,this.y=t.y+(n.y-t.y)*i,this.z=t.z+(n.z-t.z)*i,this},n.cross=function(t){return this.crossVectors(this,t)},n.crossVectors=function(t,n){var i=t.x,e=t.y,r=t.z,s=n.x,o=n.y,h=n.z;return this.x=e*h-r*o,this.y=r*s-i*h,this.z=i*o-e*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}();function q(t){let n,i,e=0,r=1;const s=t.length;for(;r<s;)n=i||t[0],i=t[r],e+=(i[0]-n[0])*(i[1]+n[1]),r++;return e>0}function L(t,n,i){return t[0]=n[0]-i[0],t[1]=n[1]-i[1],t[2]=n[2]-i[2],t}function O(t,n){const i=n[0],e=n[1],r=n[2],s=Math.sqrt(i*i+e*e+r*r)||1;return t[0]=i/s,t[1]=e/s,t[2]=r/s,t}function I(t,n,i){const e=n[0],r=n[1],s=n[2],o=i[0],h=i[1],a=i[2];return t[0]=r*a-s*h,t[1]=s*o-e*a,t[2]=e*h-r*o,t}function U(t,n){function i(t,n,i,e){t[0]=n,t[1]=i,t[2]=e}const e=[],r=[],s=[],o=[],h=[],a=[],u=t.length,c=new Float32Array(n.length);let l=0;for(;l<u;){const u=3*t[l],f=3*t[l+1],y=3*t[l+2];i(e,n[u],n[u+1],n[u+2]),i(r,n[f],n[f+1],n[f+2]),i(s,n[y],n[y+1],n[y+2]),L(h,s,r),L(o,e,r),I(a,h,o);for(let t=0;t<3;t++)c[u+t]+=a[t],c[f+t]+=a[t],c[y+t]+=a[t];l+=3}let f=0;const y=c.length;for(;f<y;)i(a,c[f],c[f+1],c[f+2]),O(a,a),c[f]=a[0]||0,c[f+1]=a[1]||0,c[f+2]=a[2]||0,f+=3;return c}function j(t){if(1===t.length){return{position:t[0].position,normal:t[0].normal,uv:t[0].uv,indices:t[0].indices,results:t}}let n=0,i=0;for(let e=0,r=t.length;e<r;e++){const{position:r,indices:s}=t[e];n+=r.length,i+=s.length}const e={position:new Float32Array(n),normal:new Float32Array(n),uv:new Float32Array(n/3*2),indices:new Uint32Array(i),results:t};let r=0,s=0,o=0,h=0;for(let n=0,i=t.length;n<i;n++){const{position:i,indices:a,normal:u,uv:c}=t[n];e.position.set(i,r),e.normal.set(u,r),e.uv.set(c,h);let l=0;const f=a.length;for(;l<f;){const t=a[l]+s;e.indices[o]=t,o++,l++}h+=c.length,r+=i.length,s+=i.length/3}return e}function E(t){return 180*t/Math.PI}function N(t){return t/180*Math.PI}function T(t,n,i,e,r,s){const o=3*i,h=3*e,a=3*r,u=3*s,c=n[o],l=n[o+1],f=n[o+2],y=n[h],x=n[h+1],p=n[h+2],d=n[a],v=n[a+1],_=n[a+2],g=n[u],z=n[u+1],m=n[u+2];let w=t.length-1;Math.abs(l-x)<Math.abs(c-y)?(t[++w]=c,t[++w]=1-f,t[++w]=y,t[++w]=1-p,t[++w]=d,t[++w]=1-_,t[++w]=g,t[++w]=1-m):(t[++w]=l,t[++w]=1-f,t[++w]=x,t[++w]=1-p,t[++w]=v,t[++w]=1-_,t[++w]=z,t[++w]=1-m)}function Q(t){const n=[];for(let i=0,e=t.length;i<e;i++){const e=t[i],[r,s,o]=e,h=new F(r,s,o||0);n[i]=h}return n}function R(t){W(t)||t.push(t[0])}function W(t){const n=t.length,[i,e]=t[0],[r,s]=t[n-1];return i===r&&e===s}function X(t){t.lineWidth=Math.max(0,t.lineWidth),t.depth=Math.max(0,t.depth),t.sideDepth=Math.max(0,t.sideDepth)}function B(t,n){const i=n.bottomStickGround,e=n.depth,r=t.depths;let s=e,o=e;r&&(s=r[0],o=r[1]);const{leftPoints:h,rightPoints:a}=t,u=t.line,c=n.pathUV;if(c){!function(t){let n=0;for(let i=0,e=t.length;i<e;i++){const e=t[i],r=t[i+1];if(0===i&&(e.distance=0),e&&r){const[t,i,s]=e,[o,h,a]=r,u=t-o,c=i-h,l=(s||0)-(a||0);n+=Math.sqrt(u*u+c*c+l*l),r.distance=n}}}(u);for(let t=0,n=u.length;t<n;t++)h[t].distance=a[t].distance=u[t].distance}let l=0,f=h.length;const y=[],x=[],p=[];for(;l<f;){const t=3*l,[n,e,r]=h[l];y[t]=n,y[t+1]=e,y[t+2]=s+r;const[x,d,v]=a[l],_=3*f+t;y[_]=x,y[_+1]=d,y[_+2]=o+v;const g=2*f*3+t;y[g]=n,y[g+1]=e,y[g+2]=r,i&&(y[g+2]=0);const z=2*f*3+3*f+t;if(y[z]=x,y[z+1]=d,y[z+2]=v,i&&(y[z+2]=0),c){const t=u[l].distance,n=2*l;p[n]=t,p[n+1]=1;const i=2*f+n;p[i]=t,p[i+1]=0;const e=2*f*2+n;p[e]=t,p[e+1]=1;const r=2*f*2+2*f+n;p[r]=t,p[r+1]=0}l++}if(!c){l=0,f=y.length;let t=p.length-1;for(;l<f;){const n=y[l],i=y[l+1];p[++t]=n,p[++t]=i,l+=3}}l=0,f=h.length;let d=x.length-1;for(;l<f-1;){const t=l,n=l+1,i=t+f,e=n+f;x[++d]=t,x[++d]=i,x[++d]=n,x[++d]=i,x[++d]=e,x[++d]=n;const r=l+2*f,s=r+1,o=r+f,h=s+f;x[++d]=r,x[++d]=o,x[++d]=s,x[++d]=o,x[++d]=h,x[++d]=s,l++}if(t.indices=x,t.points=y,t.uv=p,r)for(f=h.length,l=0;l<f;)h[l].depth=s,a[l].depth=o,l++}function Y(t,n){const{points:i,indices:e,leftPoints:r,rightPoints:s,uv:o}=t,h=n.depth,a=n.bottomStickGround,u=[r,s],c=t.depths,l=n.pathUV,f=n.lineWidth;let y=i.length-1,x=e.length-1,p=o.length-1;function d(t,n){const r=i.length/3,s=c?t.depth:h,u=c?n.depth:h;i[++y]=t[0],i[++y]=t[1],i[++y]=s+t[2],i[++y]=n[0],i[++y]=n[1],i[++y]=u+n[2],i[++y]=t[0],i[++y]=t[1],i[++y]=a?0:t[2],i[++y]=n[0],i[++y]=n[1],i[++y]=a?0:n[2];const d=r+2,v=r+3,_=r,g=r+1;e[++x]=d,e[++x]=_,e[++x]=v,e[++x]=_,e[++x]=g,e[++x]=v,l?(o[++p]=t.distance,o[++p]=s/f,o[++p]=n.distance,o[++p]=u/f,o[++p]=t.distance,o[++p]=0,o[++p]=n.distance,o[++p]=0):T(o,i,d,v,_,g)}for(let t=0,n=u.length;t<n;t++){let n=u[t];t>0&&(n=n.map((t=>t)),n=n.reverse());let i=0;const e=n.length-1;for(;i<e;){d(n[i],n[i+1]),i++}}const v=r.length,_=[s[0],r[0],r[v-1],s[v-1]];for(let t=0;t<_.length;t+=2){d(_[t],_[t+1])}}const D={x:0,y:0},G={x:0,y:0};function H(t,n){let i=n.lineWidth/2;n.isSlope&&(i*=2);const e=[],r=[],s=[],o=t.length;let h=0;for(;h<o;){let n=t[h],a=t[h+1];const u=t[h];h===o-1&&(n=t[o-2],a=t[o-1]);const c=a[1]-n[1],l=a[0]-n[0];let f=0;const y=E(Math.atan(c/l));if(0===h||h===o-1)f=y,f-=90;else{const i=t[h-1];D.x=i[0]-n[0],D.y=i[1]-n[1],G.x=a[0]-n[0],G.y=a[1]-n[1];f=y-J(D,G)/2}const x=N(f),p=u,d=[Math.cos(x)+p[0],Math.sin(x)+p[1]],[v,_]=$(n,a,i);let g=tt(v[0],v[1],p,d),z=tt(_[0],_[1],p,d);if(!g||!z){const t=e.length,n=e[t-2],i=e[t-1];if(!n||!i)continue;g=[n[0],n[1]],z=[i[0],i[1]]}g[2]=u[2]||0,z[2]=u[2]||0,e.push(g,z),K(g,n,a)?(r.push(g),s.push(z)):(r.push(z),s.push(g)),h++}return{offsetPoints:e,leftPoints:r,rightPoints:s,line:t}}const J=({x:t,y:n},{x:i,y:e})=>{const r=t*i+n*e,s=t*e-n*i;return(Math.atan2(s,r)/Math.PI*180+360)%360};function K(t,n,i){const[e,r]=n,[s,o]=i,[h,a]=t;return(r-o)*h+(s-e)*a+e*o-s*r>0}function $(t,n,i){const e=n[1]-t[1],r=n[0]-t[0],s=Math.atan2(e,r),o=s+Math.PI/2;let h=Math.cos(o)*i,a=Math.sin(o)*i;const u=[t[0]+h,t[1]+a],c=[n[0]+h,n[1]+a],l=s-Math.PI/2;h=Math.cos(l)*i,a=Math.sin(l)*i;return[[u,c],[[t[0]+h,t[1]+a],[n[0]+h,n[1]+a]]]}function tt(t,n,i,e){const r=n[0]-t[0],s=n[1]-t[1],o=e[0]-i[0],h=e[1]-i[1];if(0===r&&0===o)return null;if(0===s&&0===h)return null;const a=s/r,u=h/o,c=t[1]-a*t[0],l=i[1]-u*i[0];let f,y;return 0===r?(f=t[0],y=u*f+l):0===o?(f=i[0],y=a*f+c):0===s?(y=t[1],f=(y-l)/u):0===h?(y=i[1],f=(y-c)/a):(f=(l-c)/(a-u),y=a*f+c),[f,y]}var nt=function(){function t(){this.pos=new F,this.dir=new F,this.right=new F,this.up=new F,this.dist=0,this.widthScale=1,this.sharp=!1}var n=t.prototype;return n.lerpPathPoints=function(t,n,i){this.pos.lerpVectors(t.pos,n.pos,i),this.dir.lerpVectors(t.dir,n.dir,i),this.up.lerpVectors(t.up,n.up,i),this.right.lerpVectors(t.right,n.right,i),this.dist=(n.dist-t.dist)*i+t.dist,this.widthScale=(n.widthScale-t.widthScale)*i+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}(),it=function(){function t(t,n,i,e,r,s,o,h,a,u,c,l,f,y,x,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,i,e,r,s,o,h,a,u,c,l,f,y,x,p)}var n=t.prototype;return n.set=function(t,n,i,e,r,s,o,h,a,u,c,l,f,y,x,p){var d=this.elements;return d[0]=t,d[4]=n,d[8]=i,d[12]=e,d[1]=r,d[5]=s,d[9]=o,d[13]=h,d[2]=a,d[6]=u,d[10]=c,d[14]=l,d[3]=f,d[7]=y,d[11]=x,d[15]=p,this},n.multiply=function(t){return this.multiplyMatrices(this,t)},n.makeRotationAxis=function(t,n){var i=Math.cos(n),e=Math.sin(n),r=1-i,s=t.x,o=t.y,h=t.z,a=r*s,u=r*o;return this.set(a*s+i,a*o-e*h,a*h+e*o,0,a*o+e*h,u*o+i,u*h-e*s,0,a*h-e*o,u*h+e*s,r*h*h+i,0,0,0,0,1),this},n.equals=function(t){for(var n=this.elements,i=t.elements,e=0;e<16;e++)if(n[e]!==i[e])return!1;return!0},t}();function et(t,n,i,e){return function(t,n){var i=1-t;return i*i*n}(t,n)+function(t,n){return 2*(1-t)*t*n}(t,i)+function(t,n){return t*t*n}(t,e)}var rt=function(t){var n,i;function e(n,i,e){var r;return void 0===n&&(n=new F),void 0===i&&(i=new F),void 0===e&&(e=new F),(r=t.call(this)||this).isQuadraticBezierCurve3=!0,r.type="QuadraticBezierCurve3",r.v0=n,r.v1=i,r.v2=e,r}return i=t,(n=e).prototype=Object.create(i.prototype),n.prototype.constructor=n,V(n,i),e.prototype.getPoint=function(t,n){void 0===n&&(n=new F);var i=n,e=this.v0,r=this.v1,s=this.v2;return i.set(et(t,e.x,r.x,s.x),et(t,e.y,r.y,s.y),et(t,e.z,r.z,s.z)),i},e}(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 i=this.getUtoTmapping(t);return this.getPoint(i,n)},n.getPoints=function(t){void 0===t&&(t=5);for(var n=[],i=0;i<=t;i++)n.push(this.getPoint(i/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,i=[],e=this.getPoint(0),r=0;i.push(0);for(var s=1;s<=t;s++)r+=(n=this.getPoint(s/t)).distanceTo(e),i.push(r),e=n;return this.cacheArcLengths=i,i},n.getUtoTmapping=function(t,n){var i,e=this.getLengths(),r=0,s=e.length;i=n||t*e[s-1];for(var o,h=0,a=s-1;h<=a;)if((o=e[r=Math.floor(h+(a-h)/2)]-i)<0)h=r+1;else{if(!(o>0)){a=r;break}a=r-1}if(e[r=a]===i)return r/(s-1);var u=e[r];return(r+(i-u)/(e[r+1]-u))/(s-1)},t}()),st=new F,ot=new F,ht=new F,at=new it,ut=new rt;var ct=function(){function t(){this.array=[],this.count=0}var n=t.prototype;return n.set=function(t,n,i,e,r){if(void 0===n&&(n=.1),void 0===i&&(i=10),void 0===e&&(e=null),void 0===r&&(r=!1),(t=t.slice(0)).length<2)return console.warn("PathPointList: points length less than 2."),void(this.count=0);r&&!t[0].equals(t[t.length-1])&&t.push((new F).copy(t[0]));for(var s=0,o=t.length;s<o;s++)if(0===s)this._start(t[s],t[s+1],e);else if(s===o-1)if(r){this._corner(t[s],t[1],n,i,e);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],n,i,e)},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 nt),this.array[t]},n._start=function(t,n,i){this.count=0;var e=this._getByIndex(this.count);if(e.pos.copy(t),e.dir.subVectors(n,t),i)e.up.copy(i);else{var r=Number.MAX_VALUE,s=Math.abs(e.dir.x),o=Math.abs(e.dir.y),h=Math.abs(e.dir.z);s<r&&(r=s,e.up.set(1,0,0)),o<r&&(r=o,e.up.set(0,1,0)),h<r&&e.up.set(0,0,1)}e.right.crossVectors(e.dir,e.up).normalize(),e.up.crossVectors(e.right,e.dir).normalize(),e.dist=0,e.widthScale=1,e.sharp=!1,e.dir.normalize(),this.count++},n._end=function(t){var n=this.array[this.count-1],i=this._getByIndex(this.count);i.pos.copy(t),i.dir.subVectors(t,n.pos);var e=i.dir.length();i.dir.normalize(),i.up.copy(n.up);var r=st.crossVectors(n.dir,i.dir);if(r.length()>Number.EPSILON){r.normalize();var s=Math.acos(Math.min(Math.max(n.dir.dot(i.dir),-1),1));i.up.applyMatrix4(at.makeRotationAxis(r,s))}i.right.crossVectors(i.dir,i.up).normalize(),i.dist=n.dist+e,i.widthScale=1,i.sharp=!1,this.count++},n._corner=function(t,n,i,e,r){if(i>0&&e>0){for(var s=function(t,n,i,e,r,s){var o=st.subVectors(n,t),h=ot.subVectors(i,n),a=o.length(),u=h.length();o.normalize(),h.normalize();var c=Math.min(.999999*(r?a/2:a),e);s.v0.copy(n).sub(o.multiplyScalar(c)),s.v1.copy(n);var l=Math.min(u/2*.999999,e);return s.v2.copy(n).add(h.multiplyScalar(l)),s}(this.array[this.count-1].pos,t,n,i,this.count-1==0,ut),o=s.getPoints(e),h=0;h<e;h++)this._sharpCorner(o[h],o[h+1],r,0===h?1:0);o[e].equals(n)||this._sharpCorner(o[e],n,r,2)}else this._sharpCorner(t,n,r,0,!0)},n._sharpCorner=function(t,n,i,e,r){void 0===e&&(e=0),void 0===r&&(r=!1);var s=this.array[this.count-1],o=this._getByIndex(this.count),h=st.subVectors(t,s.pos),a=ot.subVectors(n,t),u=h.length();if(h.normalize(),a.normalize(),o.pos.copy(t),1===e?o.dir.copy(h):2===e?o.dir.copy(a):(o.dir.addVectors(h,a),o.dir.normalize()),i)1===o.dir.dot(i)?o.right.crossVectors(a,i).normalize():o.right.crossVectors(o.dir,i).normalize(),o.up.crossVectors(o.right,o.dir).normalize();else{o.up.copy(s.up);var c=ht.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=h.dot(a);o.widthScale=Math.min(1/Math.sqrt((1+f)/2),1.415)||1,o.sharp=Math.abs(f-1)>.05&&r,this.count++},t}();const lt=new F(0,0,1),ft=new F,yt=new F,xt=new F,pt=new F,dt=new F,vt=new F;const _t=new F(0,0,1),gt=new F;t.cylinder=function(t,n){n=Object.assign({},{radius:1,height:2,radialSegments:6},n);const i=Math.round(Math.max(4,n.radialSegments));let{radius:e,height:r}=n;const s=360/i/360*Math.PI*2,o=i+1,h=new Float32Array(3*o*2),[a,u]=t;let c=0,l=0;const f=3*o,y=2*o,x=[],p=[];let d=x.length-1;for(let t=-1;t<i;t++){const n=s*t,i=Math.cos(n)*e+a,o=Math.sin(n)*e+u;h[c]=i,h[c+1]=o,h[c+2]=0,h[c+f]=i,h[c+1+f]=o,h[c+2+f]=r;let v=0,_=0;v=.5+i/e/2,_=.5+o/e/2,p[l]=v,p[l+1]=_,p[l+y]=v,p[l+1+y]=_,c+=3,l+=2,t>1&&(x[++d]=0,x[++d]=t-1,x[++d]=t)}c-=3,h[c]=h[0],h[c+1]=h[1],h[c+2]=h[2];const v=h.length;h[v-3]=h[0],h[v-2]=h[1],h[v-1]=r;const _=x.length;d=x.length-1;for(let t=0;t<_;t++){const n=x[t];x[++d]=n+o}const g=new Float32Array(2*(3*o*2-6));let z=-1;c=2*o,l=0,d=x.length-1;let m=p.length-1;for(let t=0,n=h.length/2;t<n-3;t+=3){const n=h[t],i=h[t+1],s=h[t+3],a=h[t+4];g[++z]=n,g[++z]=i,g[++z]=r,g[++z]=s,g[++z]=a,g[++z]=r,g[++z]=n,g[++z]=i,g[++z]=0,g[++z]=s,g[++z]=a,g[++z]=0;const u=c+2,f=c+3,y=c,v=c+1;x[++d]=y,x[++d]=u,x[++d]=v,x[++d]=u,x[++d]=f,x[++d]=v,c+=4;const _=l/o,w=(l+1)/o;p[++m]=_,p[++m]=r/e/2,p[++m]=w,p[++m]=r/e/2,p[++m]=_,p[++m]=0,p[++m]=w,p[++m]=0,l++}const w=new Float32Array(h.length+g.length);w.set(h,0),w.set(g,h.length);const M=U(x,w);return{points:h,indices:new Uint32Array(x),position:w,normal:M,uv:new Float32Array(p)}},t.expandLine=H,t.expandPaths=function(t,n){n=Object.assign({},{lineWidth:1,cornerRadius:0,cornerSplit:10},n);const i=t.map((t=>{const i=Q(t),e=new ct;e.set(i,n.cornerRadius,n.cornerSplit,lt);const r=function(t,n){const i=n.lineWidth||.1,e=1,r=i/2,s=i,o=t.distance(),h=e*o;let a=0;const u=[],c=[],l=[],f=[];let y=0;if(0===o)return{position:u,normal:c,uv:l,indices:f,count:a};const x=r/s;let p,d=u.length-1,v=c.length-1,_=l.length-1,g=f.length-1;function z(t){const n=0===u.length,i=t.sharp&&!n,e=t.dist/s,o=t.dir,h=t.up,p=t.right;if(ft.copy(p).multiplyScalar(r*t.widthScale),yt.copy(p).multiplyScalar(-r*t.widthScale),ft.add(t.pos),yt.add(t.pos),i){xt.fromArray(u,u.length-6).sub(yt),pt.fromArray(u,u.length-3).sub(ft);const t=xt.length()-pt.length();let n,i;t>0?(n=xt,i=yt):(n=pt,i=ft),dt.copy(n).setLength(Math.abs(t)).add(i);let r=vt.copy(i).sub(dt).normalize().dot(o)*vt.copy(i).sub(dt).length()*2;vt.copy(o).setLength(r).add(dt),t>0?(u[++d]=dt.x,u[++d]=dt.y,u[++d]=dt.z,u[++d]=ft.x,u[++d]=ft.y,u[++d]=ft.z,u[++d]=yt.x,u[++d]=yt.y,u[++d]=yt.z,u[++d]=ft.x,u[++d]=ft.y,u[++d]=ft.z,u[++d]=vt.x,u[++d]=vt.y,u[++d]=vt.z,u[++d]=ft.x,u[++d]=ft.y,u[++d]=ft.z,y+=6,f[++g]=y-6,f[++g]=y-8,f[++g]=y-7,f[++g]=y-6,f[++g]=y-7,f[++g]=y-5,f[++g]=y-4,f[++g]=y-6,f[++g]=y-5,f[++g]=y-2,f[++g]=y-4,f[++g]=y-1,a+=12):(u[++d]=yt.x,u[++d]=yt.y,u[++d]=yt.z,u[++d]=dt.x,u[++d]=dt.y,u[++d]=dt.z,u[++d]=yt.x,u[++d]=yt.y,u[++d]=yt.z,u[++d]=ft.x,u[++d]=ft.y,u[++d]=ft.z,u[++d]=yt.x,u[++d]=yt.y,u[++d]=yt.z,u[++d]=vt.x,u[++d]=vt.y,u[++d]=vt.z,y+=6,f[++g]=y-6,f[++g]=y-8,f[++g]=y-7,f[++g]=y-6,f[++g]=y-7,f[++g]=y-5,f[++g]=y-6,f[++g]=y-5,f[++g]=y-3,f[++g]=y-2,f[++g]=y-3,f[++g]=y-1,a+=12);for(let t=0;t<6;t++)c[++v]=h.x,c[++v]=h.y,c[++v]=h.z;l[++_]=e-x,l[++_]=0,l[++_]=e-x,l[++_]=1,l[++_]=e,l[++_]=0,l[++_]=e,l[++_]=1,l[++_]=e+x,l[++_]=0,l[++_]=e+x,l[++_]=1}else u[++d]=yt.x,u[++d]=yt.y,u[++d]=yt.z,u[++d]=ft.x,u[++d]=ft.y,u[++d]=ft.z,c[++v]=h.x,c[++v]=h.y,c[++v]=h.z,c[++v]=h.x,c[++v]=h.y,c[++v]=h.z,l[++_]=e,l[++_]=0,l[++_]=e,l[++_]=1,y+=2,n||(f[++g]=y-2,f[++g]=y-4,f[++g]=y-3,f[++g]=y-2,f[++g]=y-3,f[++g]=y-1,a+=6)}if(h>0)for(let n=0;n<t.count;n++){const i=t.array[n];if(i.dist>h){const e=t.array[n-1];p=new nt;const r=(h-e.dist)/(i.dist-e.dist);p.lerpPathPoints(e,i,r),z(p);break}z(i)}else p=t.array[0];return{position:u,normal:c,uv:l,indices:f,count:a}}(e,n);return{position:new Float32Array(r.position),indices:new Uint32Array(r.indices),uv:new Float32Array(r.uv),normal:new Float32Array(r.normal),line:t,count:r.count}})),e=j(i);return e.lines=t,e},t.expandTubes=function(t,n){n=Object.assign({},{radius:1,cornerSplit:0,radialSegments:8,startRad:-Math.PI/4},n);const i=t.map((t=>{const i=Q(t),e=new ct;e.set(i,0,n.cornerSplit,_t);const r=function(t,n){const i=Math.max(n.radius||1,1e-8),e=void 0!==n.progress?n.progress:1,r=Math.max(3,n.radialSegments||8),s=n.startRad||0,o=2*i*Math.PI,h=t.distance(),a=e*h;if(0===a)return null;let u=0;const c=[],l=[],f=[],y=[];let x=0,p=-1,d=-1,v=-1,_=-1;function g(t,n,i){const e=0===c.length,r=t.dist/o;for(let e=0;e<=i;e++){let o=e;o===i&&(o=0),gt.copy(t.up).applyAxisAngle(t.dir,s+2*Math.PI*o/i).normalize();const h=n*t.widthScale;c[++p]=t.pos.x+gt.x*h,c[++p]=t.pos.y+gt.y*h,c[++p]=t.pos.z+gt.z*h,l[++d]=gt.x,l[++d]=gt.y,l[++d]=gt.z,f[++v]=r,f[++v]=e/i,x++}if(!e){const t=x-2*(i+1),n=x-(i+1);for(let e=0;e<i;e++)y[++_]=n+e,y[++_]=t+e,y[++_]=t+e+1,y[++_]=n+e,y[++_]=t+e+1,y[++_]=n+e+1,u+=6}}if(a>0)for(let n=0;n<t.count;n++){const e=t.array[n];if(e.dist>a){const s=t.array[n-1],o=new nt,h=(a-s.dist)/(e.dist-s.dist);o.lerpPathPoints(s,e,h),g(o,i,r);break}g(e,i,r)}return{points:c,normal:l,uv:f,indices:y,count:u}}(e,n);return r.line=t,r.position=new Float32Array(r.points),r.indices=new Uint32Array(r.indices),r.uv=new Float32Array(r.uv),r.normal=new Float32Array(r.normal),r})),e=j(i);return e.lines=t,e},t.extrudePolygons=function(t,n){n=Object.assign({},{depth:2},n);const i=t.map((t=>{for(let n=0,i=t.length;n<i;n++){const i=t[n];R(i),0===n?q(i)||(t[n]=i.reverse()):q(i)&&(t[n]=i.reverse()),W(i)&&i.splice(i.length-1,1)}const i=function(t,n){const i=function(t){let n=0,i=0;const e=t.length;for(;i<e;)n+=t[i].length,i++;return n}(t),e=t.length,r=[],s=new Float32Array(2*i),o=[],h=[],a=3*i,u=2*i,c=n.depth;let l=0,f=0,y=0;for(let n=0;n<e;n++){const i=t[n];n>0&&r.push(l/2);let e=0;const x=i.length;for(;e<x;){const t=i[e],n=t[0],r=t[1],x=t[2]||0;s[l++]=n,s[l++]=r,o[f]=n,o[f+1]=r,o[f+2]=c+x,o[a+f]=n,o[a+f+1]=r,o[a+f+2]=x,h[y]=n,h[y+1]=r,h[u+y]=n,h[u+y+1]=r,f+=3,y+=2,e++}}return{flatVertices:s,holes:r,points:o,count:i,uv:h}}(t,n);i.polygon=t;return function(t,n){const i=[],{count:e}=t;for(let t=0,r=n.length;t<r;t+=3){const s=n[t],o=n[t+1],h=n[t+2];i[t]=s,i[t+1]=o,i[t+2]=h;const a=r+t,u=e+s,c=e+o,l=e+h;i[a]=u,i[a+1]=c,i[a+2]=l}t.indices=i}(i,C(i.flatVertices,i.holes,2)),function(t,n){const{points:i,indices:e,polygon:r,uv:s}=t,o=n.depth;let h=i.length-1,a=e.length-1;for(let t=0,n=r.length;t<n;t++){const n=r[t];let u=0;const c=n.length;for(;u<c;){const t=n[u];let r=n[u+1];u===c-1&&(r=n[0]);const l=i.length/3,f=t[0],y=t[1],x=t[2]||0,p=r[0],d=r[1],v=r[2]||0;i[++h]=f,i[++h]=y,i[++h]=x+o,i[++h]=p,i[++h]=d,i[++h]=v+o,i[++h]=f,i[++h]=y,i[++h]=x,i[++h]=p,i[++h]=d,i[++h]=v;const _=l+2,g=l+3,z=l,m=l+1;e[++a]=_,e[++a]=z,e[++a]=g,e[++a]=z,e[++a]=m,e[++a]=g,T(s,i,_,g,z,m),u++}}}(i,n),i.position=new Float32Array(i.points),i.indices=new Uint32Array(i.indices),i.uv=new Float32Array(i.uv),i.normal=U(i.indices,i.position),i})),e=j(i);return e.polygons=t,e},t.extrudePolylines=function(t,n){X(n=Object.assign({},{depth:2,lineWidth:1,bottomStickGround:!1,pathUV:!1},n));const i=t.map((t=>{const i=H(t,n);return i.line=t,B(i,n),Y(i,n),i.position=new Float32Array(i.points),i.indices=new Uint32Array(i.indices),i.uv=new Float32Array(i.uv),i.normal=U(i.indices,i.position),i})),e=j(i);return e.lines=t,e},t.extrudeSlopes=function(t,n){X(n=Object.assign({},{depth:2,lineWidth:1,side:"left",sideDepth:0,bottomStickGround:!1,pathUV:!1,isSlope:!0},n));const{depth:i,side:e,sideDepth:r}=n,s=t.map((t=>{const s=H(t,n);s.line=t;const{leftPoints:o,rightPoints:h}=s,a={line:t};let u;for(let n=0,i=t.length;n<i;n++)t[n][2]=t[n][2]||0;return"left"===e?(a.leftPoints=o,a.rightPoints=t,u=[r,i]):(a.leftPoints=t,a.rightPoints=h,u=[i,r]),a.depths=u,B(a,n),Y(a,n),a.position=new Float32Array(a.points),a.indices=new Uint32Array(a.indices),a.uv=new Float32Array(a.uv),a.normal=U(a.indices,a.position),a})),o=j(s);return o.lines=t,o},t.isClockwise=q,t.leftOnLine=K,t.merge=j,t.plane=function(t,n,i,e){const r=t/(i=Math.max(1,i)),s=n/(e=Math.max(1,e)),o=-t/2,h=n/2,a=-n/2,u=(i+1)*(e+1),c=new Float32Array(3*u),l=new Float32Array(2*u),f=new Float32Array(3*u),y=new Uint32Array(10*u);let x=0,p=0,d=0;for(let u=0;u<=e;u++)for(let v=0;v<=i;v++){const _=o+r*v,g=h-s*u;c[x]=_,c[x+1]=g,c[x+2]=0,f[x]=0,f[x+1]=0,f[x+2]=1;const z=(_-o)/t,m=(g-a)/n;if(l[p]=z,l[p+1]=m,x+=3,p+=2,v<i&&u<e){const t=u*(i+1)+v,n=t+1,e=(i+1)*(u+1)+v,r=e+1;y[d]=t,y[d+1]=e,y[d+2]=n,y[d+3]=e,y[d+4]=r,y[d+5]=n,d+=6}}const v=new Uint32Array(d);for(let t=0,n=v.length;t<n;t++)v[t]=y[t];return{position:c,uv:l,normal:f,indices:v}},Object.defineProperty(t,"__esModule",{value:!0})}));
|
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";function n(t,n){for(var i=0;i<n.length;i++){var e=n[i];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,e.key,e)}}function i(t,n){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},i(t,n)}function e(t,n,i){void 0===i&&(i=2);var e,s,h,a=n&&n.length,c=a?n[0]*i:t.length,u=r(t,0,c,i,!0),f=[];if(!u||u.next===u.prev)return f;if(a&&(u=function(t,n,i,e){for(var s=[],o=0,h=n.length;o<h;o++){var a=r(t,n[o]*e,o<h-1?n[o+1]*e:t.length,e,!1);a===a.next&&(a.steiner=!0),s.push(p(a))}s.sort(l);for(var c=0;c<s.length;c++)i=y(s[c],i);return i}(t,n,u,i)),t.length>80*i){e=1/0,s=1/0;for(var x=-1/0,d=-1/0,v=i;v<c;v+=i){var g=t[v],_=t[v+1];g<e&&(e=g),_<s&&(s=_),g>x&&(x=g),_>d&&(d=_)}h=0!==(h=Math.max(x-e,d-s))?32767/h:0}return o(u,f,i,e,s,h,0),f}function r(t,n,i,e,r){var s;if(r===function(t,n,i,e){for(var r=0,s=n,o=i-e;s<i;s+=e)r+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return r}(t,n,i,e)>0)for(var o=n;o<i;o+=e)s=P(o/e|0,t[o],t[o+1],s);else for(var h=i-e;h>=n;h-=e)s=P(h/e|0,t[h],t[h+1],s);return s&&z(s,s.next)&&(S(s),s=s.next),s}function s(t,n){if(!t)return t;n||(n=t);var i,e=t;do{if(i=!1,e.steiner||!z(e,e.next)&&0!==_(e.prev,e,e.next))e=e.next;else{if(S(e),(e=n=e.prev)===e.next)break;i=!0}}while(i||e!==n);return n}function o(t,n,i,e,r,l,y){if(t){!y&&l&&function(t,n,i,e){var r=t;do{0===r.z&&(r.z=x(r.x,r.y,n,i,e)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var n,i=1;do{var e=t,r=void 0;t=null;var s=null;for(n=0;e;){n++;for(var o=e,h=0,a=0;a<i&&(h++,o=o.nextZ);a++);for(var c=i;h>0||c>0&&o;)0!==h&&(0===c||!o||e.z<=o.z)?(r=e,e=e.nextZ,h--):(r=o,o=o.nextZ,c--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;e=o}s.nextZ=null,i*=2}while(n>1)}(r)}(t,e,r,l);for(var f=t;t.prev!==t.next;){var p=t.prev,d=t.next;if(l?a(t,e,r,l):h(t))n.push(p.i,t.i,d.i),S(t),t=d.next,f=d.next;else if((t=d)===f){y?1===y?o(t=c(s(t),n),n,i,e,r,l,2):2===y&&u(t,n,i,e,r,l):o(s(t),n,i,e,r,l,1);break}}}}function h(t){var n=t.prev,i=t,e=t.next;if(_(n,i,e)>=0)return!1;for(var r=n.x,s=i.x,o=e.x,h=n.y,a=i.y,c=e.y,u=Math.min(r,s,o),l=Math.min(h,a,c),y=Math.max(r,s,o),f=Math.max(h,a,c),x=e.next;x!==n;){if(x.x>=u&&x.x<=y&&x.y>=l&&x.y<=f&&v(r,h,s,a,o,c,x.x,x.y)&&_(x.prev,x,x.next)>=0)return!1;x=x.next}return!0}function a(t,n,i,e){var r=t.prev,s=t,o=t.next;if(_(r,s,o)>=0)return!1;for(var h=r.x,a=s.x,c=o.x,u=r.y,l=s.y,y=o.y,f=Math.min(h,a,c),p=Math.min(u,l,y),d=Math.max(h,a,c),g=Math.max(u,l,y),z=x(f,p,n,i,e),m=x(d,g,n,i,e),w=t.prevZ,M=t.nextZ;w&&w.z>=z&&M&&M.z<=m;){if(w.x>=f&&w.x<=d&&w.y>=p&&w.y<=g&&w!==r&&w!==o&&v(h,u,a,l,c,y,w.x,w.y)&&_(w.prev,w,w.next)>=0)return!1;if(w=w.prevZ,M.x>=f&&M.x<=d&&M.y>=p&&M.y<=g&&M!==r&&M!==o&&v(h,u,a,l,c,y,M.x,M.y)&&_(M.prev,M,M.next)>=0)return!1;M=M.nextZ}for(;w&&w.z>=z;){if(w.x>=f&&w.x<=d&&w.y>=p&&w.y<=g&&w!==r&&w!==o&&v(h,u,a,l,c,y,w.x,w.y)&&_(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;M&&M.z<=m;){if(M.x>=f&&M.x<=d&&M.y>=p&&M.y<=g&&M!==r&&M!==o&&v(h,u,a,l,c,y,M.x,M.y)&&_(M.prev,M,M.next)>=0)return!1;M=M.nextZ}return!0}function c(t,n){var i=t;do{var e=i.prev,r=i.next.next;!z(e,r)&&m(e,i,i.next,r)&&b(e,r)&&b(r,e)&&(n.push(e.i,i.i,r.i),S(i),S(i.next),i=t=r),i=i.next}while(i!==t);return s(i)}function u(t,n,i,e,r,h){var a=t;do{for(var c=a.next.next;c!==a.prev;){if(a.i!==c.i&&g(a,c)){var u=A(a,c);return a=s(a,a.next),u=s(u,u.next),o(a,n,i,e,r,h,0),void o(u,n,i,e,r,h,0)}c=c.next}a=a.next}while(a!==t)}function l(t,n){var i=t.x-n.x;0===i&&(0===(i=t.y-n.y)&&(i=(t.next.y-t.y)/(t.next.x-t.x)-(n.next.y-n.y)/(n.next.x-n.x)));return i}function y(t,n){var i=function(t,n){var i,e=n,r=t.x,s=t.y,o=-1/0;if(z(t,e))return e;do{if(z(t,e.next))return e.next;if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var h=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(h<=r&&h>o&&(o=h,i=e.x<e.next.x?e:e.next,h===r))return i}e=e.next}while(e!==n);if(!i)return null;var a=i,c=i.x,u=i.y,l=1/0;e=i;do{if(r>=e.x&&e.x>=c&&r!==e.x&&d(s<u?r:o,s,c,u,s<u?o:r,s,e.x,e.y)){var y=Math.abs(s-e.y)/(r-e.x);b(e,t)&&(y<l||y===l&&(e.x>i.x||e.x===i.x&&f(i,e)))&&(i=e,l=y)}e=e.next}while(e!==a);return i}(t,n);if(!i)return n;var e=A(i,t);return s(e,e.next),s(i,i.next)}function f(t,n){return _(t.prev,t,n.prev)<0&&_(n.next,t,t.next)<0}function x(t,n,i,e,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-e)*r|0)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function p(t){var n=t,i=t;do{(n.x<i.x||n.x===i.x&&n.y<i.y)&&(i=n),n=n.next}while(n!==t);return i}function d(t,n,i,e,r,s,o,h){return(r-o)*(n-h)>=(t-o)*(s-h)&&(t-o)*(e-h)>=(i-o)*(n-h)&&(i-o)*(s-h)>=(r-o)*(e-h)}function v(t,n,i,e,r,s,o,h){return!(t===o&&n===h)&&d(t,n,i,e,r,s,o,h)}function g(t,n){return t.next.i!==n.i&&t.prev.i!==n.i&&!function(t,n){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==n.i&&i.next.i!==n.i&&m(i,i.next,t,n))return!0;i=i.next}while(i!==t);return!1}(t,n)&&(b(t,n)&&b(n,t)&&function(t,n){var i=t,e=!1,r=(t.x+n.x)/2,s=(t.y+n.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(e=!e),i=i.next}while(i!==t);return e}(t,n)&&(_(t.prev,t,n.prev)||_(t,n.prev,n))||z(t,n)&&_(t.prev,t,t.next)>0&&_(n.prev,n,n.next)>0)}function _(t,n,i){return(n.y-t.y)*(i.x-n.x)-(n.x-t.x)*(i.y-n.y)}function z(t,n){return t.x===n.x&&t.y===n.y}function m(t,n,i,e){var r=M(_(t,n,i)),s=M(_(t,n,e)),o=M(_(i,e,t)),h=M(_(i,e,n));return r!==s&&o!==h||(!(0!==r||!w(t,i,n))||(!(0!==s||!w(t,e,n))||(!(0!==o||!w(i,t,e))||!(0!==h||!w(i,n,e)))))}function w(t,n,i){return n.x<=Math.max(t.x,i.x)&&n.x>=Math.min(t.x,i.x)&&n.y<=Math.max(t.y,i.y)&&n.y>=Math.min(t.y,i.y)}function M(t){return t>0?1:t<0?-1:0}function b(t,n){return _(t.prev,t,t.next)<0?_(t,n,t.next)>=0&&_(t,t.prev,n)>=0:_(t,n,t.prev)<0||_(t,t.next,n)<0}function A(t,n){var i=C(t.i,t.x,t.y),e=C(n.i,n.x,n.y),r=t.next,s=n.prev;return t.next=n,n.prev=t,i.next=r,r.prev=i,e.next=i,i.prev=e,s.next=e,e.prev=s,e}function P(t,n,i,e){var r=C(t,n,i);return e?(r.next=e.next,r.prev=e,e.next.prev=r,e.next=r):(r.prev=r,r.next=r),r}function S(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 C(t,n,i){return{i:t,x:n,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}var k=new(function(){function t(t,n,i,e){void 0===t&&(t=0),void 0===n&&(n=0),void 0===i&&(i=0),void 0===e&&(e=1),this.isQuaternion=!0,this._x=t,this._y=n,this._z=i,this._w=e}t.slerpFlat=function(t,n,i,e,r,s,o){var h=i[e+0],a=i[e+1],c=i[e+2],u=i[e+3],l=r[s+0],y=r[s+1],f=r[s+2],x=r[s+3];if(0===o)return t[n+0]=h,t[n+1]=a,t[n+2]=c,void(t[n+3]=u);if(1===o)return t[n+0]=l,t[n+1]=y,t[n+2]=f,void(t[n+3]=x);if(u!==x||h!==l||a!==y||c!==f){var p=1-o,d=h*l+a*y+c*f+u*x,v=d>=0?1:-1,g=1-d*d;if(g>Number.EPSILON){var _=Math.sqrt(g),z=Math.atan2(_,d*v);p=Math.sin(p*z)/_,o=Math.sin(o*z)/_}var m=o*v;if(h=h*p+l*m,a=a*p+y*m,c=c*p+f*m,u=u*p+x*m,p===1-o){var w=1/Math.sqrt(h*h+a*a+c*c+u*u);h*=w,a*=w,c*=w,u*=w}}t[n]=h,t[n+1]=a,t[n+2]=c,t[n+3]=u},t.multiplyQuaternionsFlat=function(t,n,i,e,r,s){var o=i[e],h=i[e+1],a=i[e+2],c=i[e+3],u=r[s],l=r[s+1],y=r[s+2],f=r[s+3];return t[n]=o*f+c*u+h*y-a*l,t[n+1]=h*f+c*l+a*u-o*y,t[n+2]=a*f+c*y+o*l-h*u,t[n+3]=c*f-o*u-h*l-a*y,t};var i,e,r,s=t.prototype;return s.set=function(t,n,i,e){return this._x=t,this._y=n,this._z=i,this._w=e,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 i=t._x,e=t._y,r=t._z,s=t._order,o=Math.cos,h=Math.sin,a=o(i/2),c=o(e/2),u=o(r/2),l=h(i/2),y=h(e/2),f=h(r/2);switch(s){case"XYZ":this._x=l*c*u+a*y*f,this._y=a*y*u-l*c*f,this._z=a*c*f+l*y*u,this._w=a*c*u-l*y*f;break;case"YXZ":this._x=l*c*u+a*y*f,this._y=a*y*u-l*c*f,this._z=a*c*f-l*y*u,this._w=a*c*u+l*y*f;break;case"ZXY":this._x=l*c*u-a*y*f,this._y=a*y*u+l*c*f,this._z=a*c*f+l*y*u,this._w=a*c*u-l*y*f;break;case"ZYX":this._x=l*c*u-a*y*f,this._y=a*y*u+l*c*f,this._z=a*c*f-l*y*u,this._w=a*c*u+l*y*f;break;case"YZX":this._x=l*c*u+a*y*f,this._y=a*y*u+l*c*f,this._z=a*c*f-l*y*u,this._w=a*c*u-l*y*f;break;case"XZY":this._x=l*c*u-a*y*f,this._y=a*y*u-l*c*f,this._z=a*c*f+l*y*u,this._w=a*c*u+l*y*f;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!0===n&&this._onChangeCallback(),this},s.setFromAxisAngle=function(t,n){var i=n/2,e=Math.sin(i);return this._x=t.x*e,this._y=t.y*e,this._z=t.z*e,this._w=Math.cos(i),this._onChangeCallback(),this},s.setFromRotationMatrix=function(t){var n=t.elements,i=n[0],e=n[4],r=n[8],s=n[1],o=n[5],h=n[9],a=n[2],c=n[6],u=n[10],l=i+o+u;if(l>0){var y=.5/Math.sqrt(l+1);this._w=.25/y,this._x=(c-h)*y,this._y=(r-a)*y,this._z=(s-e)*y}else if(i>o&&i>u){var f=2*Math.sqrt(1+i-o-u);this._w=(c-h)/f,this._x=.25*f,this._y=(e+s)/f,this._z=(r+a)/f}else if(o>u){var x=2*Math.sqrt(1+o-i-u);this._w=(r-a)/x,this._x=(e+s)/x,this._y=.25*x,this._z=(h+c)/x}else{var p=2*Math.sqrt(1+u-i-o);this._w=(s-e)/p,this._x=(r+a)/p,this._y=(h+c)/p,this._z=.25*p}return this._onChangeCallback(),this},s.setFromUnitVectors=function(t,n){var i=t.dot(n)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(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=i),this.normalize()},s.rotateTowards=function(t,n){var i=this.angleTo(t);if(0===i)return this;var e=Math.min(1,n/i);return this.slerp(t,e),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 i=t._x,e=t._y,r=t._z,s=t._w,o=n._x,h=n._y,a=n._z,c=n._w;return this._x=i*c+s*o+e*a-r*h,this._y=e*c+s*h+r*o-i*a,this._z=r*c+s*a+i*h-e*o,this._w=s*c-i*o-e*h-r*a,this._onChangeCallback(),this},s.slerp=function(t,n){if(0===n)return this;if(1===n)return this.copy(t);var i=this._x,e=this._y,r=this._z,s=this._w,o=s*t._w+i*t._x+e*t._y+r*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=i,this._y=e,this._z=r,this;var h=1-o*o;if(h<=Number.EPSILON){var a=1-n;return this._w=a*s+n*this._w,this._x=a*i+n*this._x,this._y=a*e+n*this._y,this._z=a*r+n*this._z,this.normalize(),this}var c=Math.sqrt(h),u=Math.atan2(c,o),l=Math.sin((1-n)*u)/c,y=Math.sin(n*u)/c;return this._w=s*l+this._w*y,this._x=i*l+this._x*y,this._y=e*l+this._y*y,this._z=r*l+this._z*y,this._onChangeCallback(),this},s.slerpQuaternions=function(t,n,i){return this.copy(t).slerp(n,i)},s.random=function(){var t=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),i=Math.random(),e=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(e*Math.sin(t),e*Math.cos(t),r*Math.sin(n),r*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(){},i=t,(e=[{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()}}])&&n(i.prototype,e),r&&n(i,r),Object.defineProperty(i,"prototype",{writable:!1}),t}()),F=function(){function t(t,n,i){void 0===t&&(t=0),void 0===n&&(n=0),void 0===i&&(i=0),this.x=t,this.y=n,this.z=i}var n=t.prototype;return n.set=function(t,n,i){return void 0===i&&(i=this.z),this.x=t,this.y=n,this.z=i,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,i=this.y,e=this.z,r=t.elements,s=1/(r[3]*n+r[7]*i+r[11]*e+r[15]);return this.x=(r[0]*n+r[4]*i+r[8]*e+r[12])*s,this.y=(r[1]*n+r[5]*i+r[9]*e+r[13])*s,this.z=(r[2]*n+r[6]*i+r[10]*e+r[14])*s,this},n.applyQuaternion=function(t){var n=this.x,i=this.y,e=this.z,r=t.x,s=t.y,o=t.z,h=t.w,a=h*n+s*e-o*i,c=h*i+o*n-r*e,u=h*e+r*i-s*n,l=-r*n-s*i-o*e;return this.x=a*h+l*-r+c*-o-u*-s,this.y=c*h+l*-s+u*-r-a*-o,this.z=u*h+l*-o+a*-s-c*-r,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 i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(n,i)))},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,i){return this.x=t.x+(n.x-t.x)*i,this.y=t.y+(n.y-t.y)*i,this.z=t.z+(n.z-t.z)*i,this},n.cross=function(t){return this.crossVectors(this,t)},n.crossVectors=function(t,n){var i=t.x,e=t.y,r=t.z,s=n.x,o=n.y,h=n.z;return this.x=e*h-r*o,this.y=r*s-i*h,this.z=i*o-e*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}();function V(t,n){let i=t.length-1;for(let e=0,r=n.length;e<r;e++)t[++i]=n[e]}function Z(t){let n,i,e=0,r=1;const s=t.length;for(;r<s;)n=i||t[0],i=t[r],e+=(i[0]-n[0])*(i[1]+n[1]),r++;return e>0}function L(t){q(t)||t.push(t[0])}function q(t){const n=t.length,[i,e]=t[0],[r,s]=t[n-1];return i===r&&e===s}function O(t){let n=0,i=0;const e=t.length;for(;i<e;)n+=t[i].length,i++;return n}function U(t,n){n=n||[1/0,1/0,-1/0,-1/0];for(let i=0,e=t.length;i<e;i++){const e=t[i];if(Array.isArray(e[0][0]))U(e,n);else for(let t=0,i=e.length;t<i;t++){const i=e[t],[r,s]=i;n[0]=Math.min(n[0],r),n[1]=Math.min(n[1],s),n[2]=Math.max(n[2],r),n[3]=Math.max(n[3],s)}}return n}function I(t){for(let n=0,i=t.length;n<i;n++){const i=t[n];L(i),0===n?Z(i)||(t[n]=i.reverse()):Z(i)&&(t[n]=i.reverse()),q(i)&&i.splice(i.length-1,1)}}function E(t,n,i){return t[0]=n[0]-i[0],t[1]=n[1]-i[1],t[2]=n[2]-i[2],t}function j(t,n){const i=n[0],e=n[1],r=n[2],s=Math.sqrt(i*i+e*e+r*r)||1;return t[0]=i/s,t[1]=e/s,t[2]=r/s,t}function N(t,n,i){const e=n[0],r=n[1],s=n[2],o=i[0],h=i[1],a=i[2];return t[0]=r*a-s*h,t[1]=s*o-e*a,t[2]=e*h-r*o,t}function T(t,n){function i(t,n,i,e){t[0]=n,t[1]=i,t[2]=e}const e=[],r=[],s=[],o=[],h=[],a=[],c=t.length,u=new Float32Array(n.length);let l=0;for(;l<c;){const c=3*t[l],y=3*t[l+1],f=3*t[l+2];i(e,n[c],n[c+1],n[c+2]),i(r,n[y],n[y+1],n[y+2]),i(s,n[f],n[f+1],n[f+2]),E(h,s,r),E(o,e,r),N(a,h,o);for(let t=0;t<3;t++)u[c+t]+=a[t],u[y+t]+=a[t],u[f+t]+=a[t];l+=3}let y=0;const f=u.length;for(;y<f;)i(a,u[y],u[y+1],u[y+2]),j(a,a),u[y]=a[0]||0,u[y+1]=a[1]||0,u[y+2]=a[2]||0,y+=3;return u}function Q(t){if(1===t.length){return{position:t[0].position,normal:t[0].normal,uv:t[0].uv,indices:t[0].indices,results:t}}let n=0,i=0;for(let e=0,r=t.length;e<r;e++){const{position:r,indices:s}=t[e];n+=r.length,i+=s.length}const e={position:new Float32Array(n),normal:new Float32Array(n),uv:new Float32Array(n/3*2),indices:new Uint32Array(i),results:t};let r=0,s=0,o=0,h=0;for(let n=0,i=t.length;n<i;n++){const{position:i,indices:a,normal:c,uv:u}=t[n];e.position.set(i,r),e.normal.set(c,r),e.uv.set(u,h);let l=0;const y=a.length;for(;l<y;){const t=a[l]+s;e.indices[o]=t,o++,l++}h+=u.length,r+=i.length,s+=i.length/3}return e}function R(t){return 180*t/Math.PI}function W(t){return t/180*Math.PI}function X(t,n,i,e,r,s){const o=3*i,h=3*e,a=3*r,c=3*s,u=n[o],l=n[o+1],y=n[o+2],f=n[h],x=n[h+1],p=n[h+2],d=n[a],v=n[a+1],g=n[a+2],_=n[c],z=n[c+1],m=n[c+2];let w=t.length-1;Math.abs(l-x)<Math.abs(u-f)?(t[++w]=u,t[++w]=1-y,t[++w]=f,t[++w]=1-p,t[++w]=d,t[++w]=1-g,t[++w]=_,t[++w]=1-m):(t[++w]=l,t[++w]=1-y,t[++w]=x,t[++w]=1-p,t[++w]=v,t[++w]=1-g,t[++w]=z,t[++w]=1-m)}function B(t){const n=[];for(let i=0,e=t.length;i<e;i++){const e=t[i],[r,s,o]=e,h=new F(r,s,o||0);n[i]=h}return n}function Y(t){t.lineWidth=Math.max(0,t.lineWidth),t.depth=Math.max(0,t.depth),t.sideDepth=Math.max(0,t.sideDepth)}function D(t,n){const i=n.bottomStickGround,e=n.depth,r=t.depths;let s=e,o=e;r&&(s=r[0],o=r[1]);const{leftPoints:h,rightPoints:a}=t,c=t.line,u=n.pathUV;if(u){!function(t){let n=0;for(let i=0,e=t.length;i<e;i++){const e=t[i],r=t[i+1];if(0===i&&(e.distance=0),e&&r){const[t,i,s]=e,[o,h,a]=r,c=t-o,u=i-h,l=(s||0)-(a||0);n+=Math.sqrt(c*c+u*u+l*l),r.distance=n}}}(c);for(let t=0,n=c.length;t<n;t++)h[t].distance=a[t].distance=c[t].distance}let l=0,y=h.length;const f=[],x=[],p=[];for(;l<y;){const t=3*l,[n,e,r]=h[l];f[t]=n,f[t+1]=e,f[t+2]=s+r;const[x,d,v]=a[l],g=3*y+t;f[g]=x,f[g+1]=d,f[g+2]=o+v;const _=2*y*3+t;f[_]=n,f[_+1]=e,f[_+2]=r,i&&(f[_+2]=0);const z=2*y*3+3*y+t;if(f[z]=x,f[z+1]=d,f[z+2]=v,i&&(f[z+2]=0),u){const t=c[l].distance,n=2*l;p[n]=t,p[n+1]=1;const i=2*y+n;p[i]=t,p[i+1]=0;const e=2*y*2+n;p[e]=t,p[e+1]=1;const r=2*y*2+2*y+n;p[r]=t,p[r+1]=0}l++}if(!u){l=0,y=f.length;let t=p.length-1;for(;l<y;){const n=f[l],i=f[l+1];p[++t]=n,p[++t]=i,l+=3}}l=0,y=h.length;let d=x.length-1;for(;l<y-1;){const t=l,n=l+1,i=t+y,e=n+y;x[++d]=t,x[++d]=i,x[++d]=n,x[++d]=i,x[++d]=e,x[++d]=n;const r=l+2*y,s=r+1,o=r+y,h=s+y;x[++d]=r,x[++d]=o,x[++d]=s,x[++d]=o,x[++d]=h,x[++d]=s,l++}if(t.indices=x,t.points=f,t.uv=p,r)for(y=h.length,l=0;l<y;)h[l].depth=s,a[l].depth=o,l++}function G(t,n){const{points:i,indices:e,leftPoints:r,rightPoints:s,uv:o}=t,h=n.depth,a=n.bottomStickGround,c=[r,s],u=t.depths,l=n.pathUV,y=n.lineWidth;let f=i.length-1,x=e.length-1,p=o.length-1;function d(t,n){const r=i.length/3,s=u?t.depth:h,c=u?n.depth:h;i[++f]=t[0],i[++f]=t[1],i[++f]=s+t[2],i[++f]=n[0],i[++f]=n[1],i[++f]=c+n[2],i[++f]=t[0],i[++f]=t[1],i[++f]=a?0:t[2],i[++f]=n[0],i[++f]=n[1],i[++f]=a?0:n[2];const d=r+2,v=r+3,g=r,_=r+1;e[++x]=d,e[++x]=g,e[++x]=v,e[++x]=g,e[++x]=_,e[++x]=v,l?(o[++p]=t.distance,o[++p]=s/y,o[++p]=n.distance,o[++p]=c/y,o[++p]=t.distance,o[++p]=0,o[++p]=n.distance,o[++p]=0):X(o,i,d,v,g,_)}for(let t=0,n=c.length;t<n;t++){let n=c[t];t>0&&(n=n.map((t=>t)),n=n.reverse());let i=0;const e=n.length-1;for(;i<e;){d(n[i],n[i+1]),i++}}const v=r.length,g=[s[0],r[0],r[v-1],s[v-1]];for(let t=0;t<g.length;t+=2){d(g[t],g[t+1])}}const H={x:0,y:0},J={x:0,y:0};function K(t,n){let i=n.lineWidth/2;n.isSlope&&(i*=2);const e=[],r=[],s=[],o=t.length;let h=0;for(;h<o;){let n=t[h],a=t[h+1];const c=t[h];h===o-1&&(n=t[o-2],a=t[o-1]);const u=a[1]-n[1],l=a[0]-n[0];let y=0;const f=R(Math.atan(u/l));if(0===h||h===o-1)y=f,y-=90;else{const i=t[h-1];H.x=i[0]-n[0],H.y=i[1]-n[1],J.x=a[0]-n[0],J.y=a[1]-n[1];y=f-$(H,J)/2}const x=W(y),p=c,d=[Math.cos(x)+p[0],Math.sin(x)+p[1]],[v,g]=nt(n,a,i);let _=it(v[0],v[1],p,d),z=it(g[0],g[1],p,d);if(!_||!z){const t=e.length,n=e[t-2],i=e[t-1];if(!n||!i)continue;_=[n[0],n[1]],z=[i[0],i[1]]}_[2]=c[2]||0,z[2]=c[2]||0,e.push(_,z),tt(_,n,a)?(r.push(_),s.push(z)):(r.push(z),s.push(_)),h++}return{offsetPoints:e,leftPoints:r,rightPoints:s,line:t}}const $=({x:t,y:n},{x:i,y:e})=>{const r=t*i+n*e,s=t*e-n*i;return(Math.atan2(s,r)/Math.PI*180+360)%360};function tt(t,n,i){const[e,r]=n,[s,o]=i,[h,a]=t;return(r-o)*h+(s-e)*a+e*o-s*r>0}function nt(t,n,i){const e=n[1]-t[1],r=n[0]-t[0],s=Math.atan2(e,r),o=s+Math.PI/2;let h=Math.cos(o)*i,a=Math.sin(o)*i;const c=[t[0]+h,t[1]+a],u=[n[0]+h,n[1]+a],l=s-Math.PI/2;h=Math.cos(l)*i,a=Math.sin(l)*i;return[[c,u],[[t[0]+h,t[1]+a],[n[0]+h,n[1]+a]]]}function it(t,n,i,e){const r=n[0]-t[0],s=n[1]-t[1],o=e[0]-i[0],h=e[1]-i[1];if(0===r&&0===o)return null;if(0===s&&0===h)return null;const a=s/r,c=h/o,u=t[1]-a*t[0],l=i[1]-c*i[0];let y,f;return 0===r?(y=t[0],f=c*y+l):0===o?(y=i[0],f=a*y+u):0===s?(f=t[1],y=(f-l)/c):0===h?(f=i[1],y=(f-u)/a):(y=(l-u)/(a-c),f=a*y+u),[y,f]}var et=function(){function t(){this.pos=new F,this.dir=new F,this.right=new F,this.up=new F,this.dist=0,this.widthScale=1,this.sharp=!1}var n=t.prototype;return n.lerpPathPoints=function(t,n,i){this.pos.lerpVectors(t.pos,n.pos,i),this.dir.lerpVectors(t.dir,n.dir,i),this.up.lerpVectors(t.up,n.up,i),this.right.lerpVectors(t.right,n.right,i),this.dist=(n.dist-t.dist)*i+t.dist,this.widthScale=(n.widthScale-t.widthScale)*i+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}(),rt=function(){function t(t,n,i,e,r,s,o,h,a,c,u,l,y,f,x,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,i,e,r,s,o,h,a,c,u,l,y,f,x,p)}var n=t.prototype;return n.set=function(t,n,i,e,r,s,o,h,a,c,u,l,y,f,x,p){var d=this.elements;return d[0]=t,d[4]=n,d[8]=i,d[12]=e,d[1]=r,d[5]=s,d[9]=o,d[13]=h,d[2]=a,d[6]=c,d[10]=u,d[14]=l,d[3]=y,d[7]=f,d[11]=x,d[15]=p,this},n.multiply=function(t){return this.multiplyMatrices(this,t)},n.makeRotationAxis=function(t,n){var i=Math.cos(n),e=Math.sin(n),r=1-i,s=t.x,o=t.y,h=t.z,a=r*s,c=r*o;return this.set(a*s+i,a*o-e*h,a*h+e*o,0,a*o+e*h,c*o+i,c*h-e*s,0,a*h-e*o,c*h+e*s,r*h*h+i,0,0,0,0,1),this},n.equals=function(t){for(var n=this.elements,i=t.elements,e=0;e<16;e++)if(n[e]!==i[e])return!1;return!0},t}();function st(t,n,i,e){return function(t,n){var i=1-t;return i*i*n}(t,n)+function(t,n){return 2*(1-t)*t*n}(t,i)+function(t,n){return t*t*n}(t,e)}var ot=function(t){var n,e;function r(n,i,e){var r;return void 0===n&&(n=new F),void 0===i&&(i=new F),void 0===e&&(e=new F),(r=t.call(this)||this).isQuadraticBezierCurve3=!0,r.type="QuadraticBezierCurve3",r.v0=n,r.v1=i,r.v2=e,r}return e=t,(n=r).prototype=Object.create(e.prototype),n.prototype.constructor=n,i(n,e),r.prototype.getPoint=function(t,n){void 0===n&&(n=new F);var i=n,e=this.v0,r=this.v1,s=this.v2;return i.set(st(t,e.x,r.x,s.x),st(t,e.y,r.y,s.y),st(t,e.z,r.z,s.z)),i},r}(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 i=this.getUtoTmapping(t);return this.getPoint(i,n)},n.getPoints=function(t){void 0===t&&(t=5);for(var n=[],i=0;i<=t;i++)n.push(this.getPoint(i/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,i=[],e=this.getPoint(0),r=0;i.push(0);for(var s=1;s<=t;s++)r+=(n=this.getPoint(s/t)).distanceTo(e),i.push(r),e=n;return this.cacheArcLengths=i,i},n.getUtoTmapping=function(t,n){var i,e=this.getLengths(),r=0,s=e.length;i=n||t*e[s-1];for(var o,h=0,a=s-1;h<=a;)if((o=e[r=Math.floor(h+(a-h)/2)]-i)<0)h=r+1;else{if(!(o>0)){a=r;break}a=r-1}if(e[r=a]===i)return r/(s-1);var c=e[r];return(r+(i-c)/(e[r+1]-c))/(s-1)},t}()),ht=new F,at=new F,ct=new F,ut=new rt,lt=new ot;var yt=function(){function t(){this.array=[],this.count=0}var n=t.prototype;return n.set=function(t,n,i,e,r){if(void 0===n&&(n=.1),void 0===i&&(i=10),void 0===e&&(e=null),void 0===r&&(r=!1),(t=t.slice(0)).length<2)return console.warn("PathPointList: points length less than 2."),void(this.count=0);r&&!t[0].equals(t[t.length-1])&&t.push((new F).copy(t[0]));for(var s=0,o=t.length;s<o;s++)if(0===s)this._start(t[s],t[s+1],e);else if(s===o-1)if(r){this._corner(t[s],t[1],n,i,e);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],n,i,e)},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 et),this.array[t]},n._start=function(t,n,i){this.count=0;var e=this._getByIndex(this.count);if(e.pos.copy(t),e.dir.subVectors(n,t),i)e.up.copy(i);else{var r=Number.MAX_VALUE,s=Math.abs(e.dir.x),o=Math.abs(e.dir.y),h=Math.abs(e.dir.z);s<r&&(r=s,e.up.set(1,0,0)),o<r&&(r=o,e.up.set(0,1,0)),h<r&&e.up.set(0,0,1)}e.right.crossVectors(e.dir,e.up).normalize(),e.up.crossVectors(e.right,e.dir).normalize(),e.dist=0,e.widthScale=1,e.sharp=!1,e.dir.normalize(),this.count++},n._end=function(t){var n=this.array[this.count-1],i=this._getByIndex(this.count);i.pos.copy(t),i.dir.subVectors(t,n.pos);var e=i.dir.length();i.dir.normalize(),i.up.copy(n.up);var r=ht.crossVectors(n.dir,i.dir);if(r.length()>Number.EPSILON){r.normalize();var s=Math.acos(Math.min(Math.max(n.dir.dot(i.dir),-1),1));i.up.applyMatrix4(ut.makeRotationAxis(r,s))}i.right.crossVectors(i.dir,i.up).normalize(),i.dist=n.dist+e,i.widthScale=1,i.sharp=!1,this.count++},n._corner=function(t,n,i,e,r){if(i>0&&e>0){for(var s=function(t,n,i,e,r,s){var o=ht.subVectors(n,t),h=at.subVectors(i,n),a=o.length(),c=h.length();o.normalize(),h.normalize();var u=Math.min(.999999*(r?a/2:a),e);s.v0.copy(n).sub(o.multiplyScalar(u)),s.v1.copy(n);var l=Math.min(c/2*.999999,e);return s.v2.copy(n).add(h.multiplyScalar(l)),s}(this.array[this.count-1].pos,t,n,i,this.count-1==0,lt),o=s.getPoints(e),h=0;h<e;h++)this._sharpCorner(o[h],o[h+1],r,0===h?1:0);o[e].equals(n)||this._sharpCorner(o[e],n,r,2)}else this._sharpCorner(t,n,r,0,!0)},n._sharpCorner=function(t,n,i,e,r){void 0===e&&(e=0),void 0===r&&(r=!1);var s=this.array[this.count-1],o=this._getByIndex(this.count),h=ht.subVectors(t,s.pos),a=at.subVectors(n,t),c=h.length();if(h.normalize(),a.normalize(),o.pos.copy(t),1===e?o.dir.copy(h):2===e?o.dir.copy(a):(o.dir.addVectors(h,a),o.dir.normalize()),i)1===o.dir.dot(i)?o.right.crossVectors(a,i).normalize():o.right.crossVectors(o.dir,i).normalize(),o.up.crossVectors(o.right,o.dir).normalize();else{o.up.copy(s.up);var u=ct.crossVectors(s.dir,o.dir);if(u.length()>Number.EPSILON){u.normalize();var l=Math.acos(Math.min(Math.max(s.dir.dot(o.dir),-1),1));o.up.applyMatrix4(ut.makeRotationAxis(u,l))}o.right.crossVectors(o.dir,o.up).normalize()}o.dist=s.dist+c;var y=h.dot(a);o.widthScale=Math.min(1/Math.sqrt((1+y)/2),1.415)||1,o.sharp=Math.abs(y-1)>.05&&r,this.count++},t}();const ft=new F(0,0,1),xt=new F,pt=new F,dt=new F,vt=new F,gt=new F,_t=new F;const zt=new F(0,0,1),mt=new F;const wt=new F(0,0,1),Mt=new F;function bt(t,n){const[i,e]=t,[r,s]=n,o=s-e,h=r-i;return Math.atan2(o,h)}const At=new F(0,0,0);t.cylinder=function(t,n){n=Object.assign({},{radius:1,height:2,radialSegments:6},n);const i=Math.round(Math.max(4,n.radialSegments));let{radius:e,height:r}=n;const s=360/i/360*Math.PI*2,o=i+1,h=new Float32Array(3*o*2),[a,c]=t;let u=0,l=0;const y=3*o,f=2*o,x=[],p=[];let d=x.length-1;for(let t=-1;t<i;t++){const n=s*t,i=Math.cos(n)*e+a,o=Math.sin(n)*e+c;h[u]=i,h[u+1]=o,h[u+2]=0,h[u+y]=i,h[u+1+y]=o,h[u+2+y]=r;let v=0,g=0;v=.5+i/e/2,g=.5+o/e/2,p[l]=v,p[l+1]=g,p[l+f]=v,p[l+1+f]=g,u+=3,l+=2,t>1&&(x[++d]=0,x[++d]=t-1,x[++d]=t)}u-=3,h[u]=h[0],h[u+1]=h[1],h[u+2]=h[2];const v=h.length;h[v-3]=h[0],h[v-2]=h[1],h[v-1]=r;const g=x.length;d=x.length-1;for(let t=0;t<g;t++){const n=x[t];x[++d]=n+o}const _=new Float32Array(2*(3*o*2-6));let z=-1;u=2*o,l=0,d=x.length-1;let m=p.length-1;for(let t=0,n=h.length/2;t<n-3;t+=3){const n=h[t],i=h[t+1],s=h[t+3],a=h[t+4];_[++z]=n,_[++z]=i,_[++z]=r,_[++z]=s,_[++z]=a,_[++z]=r,_[++z]=n,_[++z]=i,_[++z]=0,_[++z]=s,_[++z]=a,_[++z]=0;const c=u+2,y=u+3,f=u,v=u+1;x[++d]=f,x[++d]=c,x[++d]=v,x[++d]=c,x[++d]=y,x[++d]=v,u+=4;const g=l/o,w=(l+1)/o;p[++m]=g,p[++m]=r/e/2,p[++m]=w,p[++m]=r/e/2,p[++m]=g,p[++m]=0,p[++m]=w,p[++m]=0,l++}const w=new Float32Array(h.length+_.length);w.set(h,0),w.set(_,h.length);const M=T(x,w);return{points:h,indices:new Uint32Array(x),position:w,normal:M,uv:new Float32Array(p)}},t.expandLine=K,t.expandPaths=function(t,n){n=Object.assign({},{lineWidth:1,cornerRadius:0,cornerSplit:10},n);const i=t.map((t=>{const i=B(t),e=new yt;e.set(i,n.cornerRadius,n.cornerSplit,ft);const r=function(t,n){const i=n.lineWidth||.1,e=1,r=i/2,s=i,o=t.distance(),h=e*o;let a=0;const c=[],u=[],l=[],y=[];let f=0;if(0===o)return{position:c,normal:u,uv:l,indices:y,count:a};const x=r/s;let p,d=c.length-1,v=u.length-1,g=l.length-1,_=y.length-1;function z(t){const n=0===c.length,i=t.sharp&&!n,e=t.dist/s,o=t.dir,h=t.up,p=t.right;if(xt.copy(p).multiplyScalar(r*t.widthScale),pt.copy(p).multiplyScalar(-r*t.widthScale),xt.add(t.pos),pt.add(t.pos),i){dt.fromArray(c,c.length-6).sub(pt),vt.fromArray(c,c.length-3).sub(xt);const t=dt.length()-vt.length();let n,i;t>0?(n=dt,i=pt):(n=vt,i=xt),gt.copy(n).setLength(Math.abs(t)).add(i);let r=_t.copy(i).sub(gt).normalize().dot(o)*_t.copy(i).sub(gt).length()*2;_t.copy(o).setLength(r).add(gt),t>0?(c[++d]=gt.x,c[++d]=gt.y,c[++d]=gt.z,c[++d]=xt.x,c[++d]=xt.y,c[++d]=xt.z,c[++d]=pt.x,c[++d]=pt.y,c[++d]=pt.z,c[++d]=xt.x,c[++d]=xt.y,c[++d]=xt.z,c[++d]=_t.x,c[++d]=_t.y,c[++d]=_t.z,c[++d]=xt.x,c[++d]=xt.y,c[++d]=xt.z,f+=6,y[++_]=f-6,y[++_]=f-8,y[++_]=f-7,y[++_]=f-6,y[++_]=f-7,y[++_]=f-5,y[++_]=f-4,y[++_]=f-6,y[++_]=f-5,y[++_]=f-2,y[++_]=f-4,y[++_]=f-1,a+=12):(c[++d]=pt.x,c[++d]=pt.y,c[++d]=pt.z,c[++d]=gt.x,c[++d]=gt.y,c[++d]=gt.z,c[++d]=pt.x,c[++d]=pt.y,c[++d]=pt.z,c[++d]=xt.x,c[++d]=xt.y,c[++d]=xt.z,c[++d]=pt.x,c[++d]=pt.y,c[++d]=pt.z,c[++d]=_t.x,c[++d]=_t.y,c[++d]=_t.z,f+=6,y[++_]=f-6,y[++_]=f-8,y[++_]=f-7,y[++_]=f-6,y[++_]=f-7,y[++_]=f-5,y[++_]=f-6,y[++_]=f-5,y[++_]=f-3,y[++_]=f-2,y[++_]=f-3,y[++_]=f-1,a+=12);for(let t=0;t<6;t++)u[++v]=h.x,u[++v]=h.y,u[++v]=h.z;l[++g]=e-x,l[++g]=0,l[++g]=e-x,l[++g]=1,l[++g]=e,l[++g]=0,l[++g]=e,l[++g]=1,l[++g]=e+x,l[++g]=0,l[++g]=e+x,l[++g]=1}else c[++d]=pt.x,c[++d]=pt.y,c[++d]=pt.z,c[++d]=xt.x,c[++d]=xt.y,c[++d]=xt.z,u[++v]=h.x,u[++v]=h.y,u[++v]=h.z,u[++v]=h.x,u[++v]=h.y,u[++v]=h.z,l[++g]=e,l[++g]=0,l[++g]=e,l[++g]=1,f+=2,n||(y[++_]=f-2,y[++_]=f-4,y[++_]=f-3,y[++_]=f-2,y[++_]=f-3,y[++_]=f-1,a+=6)}if(h>0)for(let n=0;n<t.count;n++){const i=t.array[n];if(i.dist>h){const e=t.array[n-1];p=new et;const r=(h-e.dist)/(i.dist-e.dist);p.lerpPathPoints(e,i,r),z(p);break}z(i)}else p=t.array[0];return{position:c,normal:u,uv:l,indices:y,count:a}}(e,n);return{position:new Float32Array(r.position),indices:new Uint32Array(r.indices),uv:new Float32Array(r.uv),normal:new Float32Array(r.normal),line:t,count:r.count}})),e=Q(i);return e.lines=t,e},t.expandTubes=function(t,n){n=Object.assign({},{radius:1,cornerSplit:0,radialSegments:8,startRad:-Math.PI/4},n);const i=t.map((t=>{const i=B(t),e=new yt;e.set(i,0,n.cornerSplit,zt);const r=function(t,n){const i=Math.max(n.radius||1,1e-8),e=void 0!==n.progress?n.progress:1,r=Math.max(3,n.radialSegments||8),s=n.startRad||0,o=2*i*Math.PI,h=t.distance(),a=e*h;if(0===a)return null;let c=0;const u=[],l=[],y=[],f=[];let x=0,p=-1,d=-1,v=-1,g=-1;function _(t,n,i){const e=0===u.length,r=t.dist/o;for(let e=0;e<=i;e++){let o=e;o===i&&(o=0),mt.copy(t.up).applyAxisAngle(t.dir,s+2*Math.PI*o/i).normalize();const h=n*t.widthScale;u[++p]=t.pos.x+mt.x*h,u[++p]=t.pos.y+mt.y*h,u[++p]=t.pos.z+mt.z*h,l[++d]=mt.x,l[++d]=mt.y,l[++d]=mt.z,y[++v]=r,y[++v]=e/i,x++}if(!e){const t=x-2*(i+1),n=x-(i+1);for(let e=0;e<i;e++)f[++g]=n+e,f[++g]=t+e,f[++g]=t+e+1,f[++g]=n+e,f[++g]=t+e+1,f[++g]=n+e+1,c+=6}}if(a>0)for(let n=0;n<t.count;n++){const e=t.array[n];if(e.dist>a){const s=t.array[n-1],o=new et,h=(a-s.dist)/(e.dist-s.dist);o.lerpPathPoints(s,e,h),_(o,i,r);break}_(e,i,r)}return{points:u,normal:l,uv:y,indices:f,count:c}}(e,n);return r.line=t,r.position=new Float32Array(r.points),r.indices=new Uint32Array(r.indices),r.uv=new Float32Array(r.uv),r.normal=new Float32Array(r.normal),r})),e=Q(i);return e.lines=t,e},t.extrudePolygons=function(t,n){n=Object.assign({},{depth:2,top:!0},n);const i=t.map((t=>{I(t);const i=function(t,n){const i=O(t),e=t.length,r=[],s=new Float32Array(2*i),o=[],h=[],a=3*i,c=2*i,u=n.depth;let l=0,y=0,f=0;for(let n=0;n<e;n++){const i=t[n];n>0&&r.push(l/2);let e=0;const x=i.length;for(;e<x;){const t=i[e],n=t[0],r=t[1],x=t[2]||0;s[l++]=n,s[l++]=r,o[y]=n,o[y+1]=r,o[y+2]=u+x,o[a+y]=n,o[a+y+1]=r,o[a+y+2]=x,h[f]=n,h[f+1]=r,h[c+f]=n,h[c+f+1]=r,y+=3,f+=2,e++}}return{flatVertices:s,holes:r,points:o,count:i,uv:h}}(t,n);i.polygon=t;return function(t,n,i){const e=[],{count:r}=t,s=i.top;for(let t=0,i=n.length;t<i;t+=3){const o=n[t],h=n[t+1],a=n[t+2];s&&(e[t]=o,e[t+1]=h,e[t+2]=a);let c=i+t;const u=r+o,l=r+h,y=r+a;s||(c=t),e[c]=u,e[c+1]=l,e[c+2]=y}t.indices=e}(i,e(i.flatVertices,i.holes,2),n),function(t,n){const{points:i,indices:e,polygon:r,uv:s}=t,o=n.depth;let h=i.length-1,a=e.length-1;for(let t=0,n=r.length;t<n;t++){const n=r[t];let c=0;const u=n.length;for(;c<u;){const t=n[c];let r=n[c+1];c===u-1&&(r=n[0]);const l=i.length/3,y=t[0],f=t[1],x=t[2]||0,p=r[0],d=r[1],v=r[2]||0;i[++h]=y,i[++h]=f,i[++h]=x+o,i[++h]=p,i[++h]=d,i[++h]=v+o,i[++h]=y,i[++h]=f,i[++h]=x,i[++h]=p,i[++h]=d,i[++h]=v;const g=l+2,_=l+3,z=l,m=l+1;e[++a]=g,e[++a]=z,e[++a]=_,e[++a]=z,e[++a]=m,e[++a]=_,X(s,i,g,_,z,m),c++}}}(i,n),i.position=new Float32Array(i.points),i.indices=new Uint32Array(i.indices),i.uv=new Float32Array(i.uv),i.normal=T(i.indices,i.position),i})),r=Q(i);return r.polygons=t,r},t.extrudePolygonsOnPath=function(t,n){n=Object.assign({},{openEnd:!1,openEndUV:!0},n);const{extrudePath:i,openEnd:r}=n;if(!i||!Array.isArray(i)||i.length<2)return console.error("extrudePath is error:",i),null;const s=U(t),[o,h,a,c]=s,u=[(o+a)/2,(h+c)/2],l=B(i),y=new yt;y.set(l,0,n.cornerSplit,wt);const f=t.map((t=>{for(let n=0,i=t.length;n<i;n++){const i=t[n];L(i),0===n?Z(i)&&(t[n]=i.reverse()):Z(i)||(t[n]=i.reverse())}const i=function(t,n,i){const e=function(t,n){const[i,e]=n,r=[];return t.forEach(((t,s)=>{const o=[];let h,a=0;for(let r=0,s=t.length;r<s;r++){const s=t[r],c=s[0],u=s[1],l=c-i,y=u-e;let f=0;if(r>0){const t=h[0]-c,n=h[1]-u;f=Math.sqrt(t*t+n*n)+a,a=f}o[r]={distance:f,radius:Math.sqrt(l*l+y*y),angle:bt(n,s)},h=s}r[s]={ring:o,ringLen:a}})),r}(n,i),r=[],s=[],o=[],h=[];let a=0,c=-1,u=-1,l=-1,y=-1;const f=[],x=[];function p(t,n,i,e,p){const d=t.dist/i,v=n.length;for(let h=0;h<v;h++){const y=n[h];if(!y)continue;const g=h===v-1,_=y.angle,z=y.radius,m=y.distance;Mt.copy(t.up).applyAxisAngle(t.dir,_).normalize();const w=At.copy(t.up);if(w.applyAxisAngle(t.dir,_),w.x*=z,w.y*=z,w.z*=z,r[++c]=t.pos.x+w.x,r[++c]=t.pos.y+w.y,r[++c]=t.pos.z+w.z,s[++u]=Mt.x,s[++u]=Mt.y,s[++u]=Mt.z,o[++l]=d,o[++l]=m/i,a++,e&&!g){let n=f.length-1;f[++n]=t.pos.x+w.x,f[++n]=t.pos.y+w.y,f[++n]=t.pos.z+w.z}if(p&&!g){let n=x.length-1;x[++n]=t.pos.x+w.x,x[++n]=t.pos.y+w.y,x[++n]=t.pos.z+w.z}}if(!e){const t=a-2*v,n=a-v;for(let i=0;i<v;i++)h[++y]=n+i,h[++y]=t+i,h[++y]=t+i+1,h[++y]=n+i,h[++y]=t+i+1,h[++y]=n+i+1}}const d=e[0].ringLen;return e.forEach((n=>{for(let i=0;i<t.count;i++){const e=t.array[i],{ring:r,ringLen:s}=n;p(e,r,s,0===i,i===t.count-1)}})),{points:r,normal:s,uv:o,indices:h,startPoints:f,endPoints:x,polygonLen:d}}(y,t,u);return r||function(t,n,i){const{openEndUV:r}=i;for(let t=0,i=n.length;t<i;t++){const i=n[t];q(i)&&i.splice(i.length-1,1)}const s=O(n),o=[],h=[];let a=-1;for(let t=0,i=n.length;t<i;t++){const i=n[t];t>0&&h.push(o.length/2);for(let t=0,n=i.length;t<n;t++){const n=i[t];o[++a]=n[0],o[++a]=n[1]}}const c=e(o,h,2),{points:u,normal:l,uv:y,indices:f,startPoints:x,endPoints:p,polygonLen:d}=t;a=0;let v=0;const g=[],_=[],z=[],m=[];for(let t=0;t<s;t++){const n=3*t,i=x[n],e=x[n+1],s=x[n+2];g[a]=i,g[a+1]=e,g[a+2]=s,r?(_[v]=e/d,_[v+1]=s/d):(_[v]=0,_[v+1]=0);const o=p[n],h=p[n+1],c=p[n+2];z[a]=o,z[a+1]=h,z[a+2]=c,r?(m[v]=h/d,m[v+1]=c/d):(m[v]=0,m[v+1]=0),a+=3,v+=2}const w=u.length/3,M=[];for(let t=0,n=c.length;t<n;t++)M[t]=c[t]+w,M[t+n]=c[t]+w+s;const b=T(c,g),A=T(c,z);V(u,g),V(u,z),V(y,_),V(y,m),V(l,b),V(l,A),V(f,M)}(i,t,n),i.polygon=t,i.position=new Float32Array(i.points),i.indices=new Uint32Array(i.indices),i.uv=new Float32Array(i.uv),i.normal=new Float32Array(i.normal),i})),x=Q(f);return x.polygons=t,x},t.extrudePolylines=function(t,n){Y(n=Object.assign({},{depth:2,lineWidth:1,bottomStickGround:!1,pathUV:!1},n));const i=t.map((t=>{const i=K(t,n);return i.line=t,D(i,n),G(i,n),i.position=new Float32Array(i.points),i.indices=new Uint32Array(i.indices),i.uv=new Float32Array(i.uv),i.normal=T(i.indices,i.position),i})),e=Q(i);return e.lines=t,e},t.extrudeSlopes=function(t,n){Y(n=Object.assign({},{depth:2,lineWidth:1,side:"left",sideDepth:0,bottomStickGround:!1,pathUV:!1,isSlope:!0},n));const{depth:i,side:e,sideDepth:r}=n,s=t.map((t=>{const s=K(t,n);s.line=t;const{leftPoints:o,rightPoints:h}=s,a={line:t};let c;for(let n=0,i=t.length;n<i;n++)t[n][2]=t[n][2]||0;return"left"===e?(a.leftPoints=o,a.rightPoints=t,c=[r,i]):(a.leftPoints=t,a.rightPoints=h,c=[i,r]),a.depths=c,D(a,n),G(a,n),a.position=new Float32Array(a.points),a.indices=new Uint32Array(a.indices),a.uv=new Float32Array(a.uv),a.normal=T(a.indices,a.position),a})),o=Q(s);return o.lines=t,o},t.isClockwise=Z,t.leftOnLine=tt,t.merge=Q,t.plane=function(t,n,i,e){const r=t/(i=Math.max(1,i)),s=n/(e=Math.max(1,e)),o=-t/2,h=n/2,a=-n/2,c=(i+1)*(e+1),u=new Float32Array(3*c),l=new Float32Array(2*c),y=new Float32Array(3*c),f=new Uint32Array(10*c);let x=0,p=0,d=0;for(let c=0;c<=e;c++)for(let v=0;v<=i;v++){const g=o+r*v,_=h-s*c;u[x]=g,u[x+1]=_,u[x+2]=0,y[x]=0,y[x+1]=0,y[x+2]=1;const z=(g-o)/t,m=(_-a)/n;if(l[p]=z,l[p+1]=m,x+=3,p+=2,v<i&&c<e){const t=c*(i+1)+v,n=t+1,e=(i+1)*(c+1)+v,r=e+1;f[d]=t,f[d+1]=e,f[d+2]=n,f[d+3]=e,f[d+4]=r,f[d+5]=n,d+=6}}const v=new Uint32Array(d);for(let t=0,n=v.length;t<n;t++)v[t]=f[t];return{position:u,uv:l,normal:y,indices:v}},t.polygons=function(t,n={}){const i=t.map((t=>{I(t);const i=function(t,n={}){const i=[],r=[];let s=-1,o=-1,h=-1;const a=[],c=[];for(let n=0,e=t.length;n<e;n++){const e=t[n];n>0&&r.push(i.length/2);for(let t=0,n=e.length;t<n;t++){const n=e[t];i[++s]=n[0],i[++s]=n[1],a[++o]=n[0],a[++o]=n[1],a[++o]=n[2]||0,c[++h]=n[0],c[++h]=n[1]}}const u=e(i,r,2);return{normal:T(u,a),uv:c,points:a,indices:u}}(t,n);return i.polygon=t,i.position=new Float32Array(i.points),i.indices=new Uint32Array(i.indices),i.uv=new Float32Array(i.uv),i.normal=new Float32Array(i.normal),i})),r=Q(i);return r.polygons=t,r},Object.defineProperty(t,"__esModule",{value:!0})}));
|