<!-- SOLID-PLAYTIME · part 86 -->
adius:t,height:e,capSegments:n,radialSegments:i,heightSegments:s},e=Math.max(0,e),n=Math.max(1,Math.floor(n)),i=Math.max(3,Math.floor(i)),s=Math.max(1,Math.floor(s));let a=[],r=[],o=[],l=[],c=e/2,u=Math.PI/2*t,f=e,h=2*u+f,p=n*2+s,v=i+1,y=new C,U=new C;for(let d=0;d<=p;d++){let g=0,m=0,x=0,S=0;if(d<=n){let w=d/n,b=w*Math.PI/2;m=-c-t*Math.cos(b),x=t*Math.sin(b),S=-t*Math.cos(b),g=w*u}else if(d<=n+s){let w=(d-n)/s;m=-c+w*e,x=t,S=0,g=u+w*f}else{let w=(d-n-s)/n,b=w*Math.PI/2;m=c+t*Math.sin(b),x=t*Math.cos(b),S=t*Math.sin(b),g=u+f+w*u}let A=Math.max(0,Math.min(1,g/h)),T=0;if(d===0)T=0.5/i;else if(d===p)T=-0.5/i;for(let w=0;w<=i;w++){let b=w/i,M=b*Math.PI*2,R=Math.sin(M),O=Math.cos(M);U.x=-x*O,U.y=m,U.z=x*R,r.push(U.x,U.y,U.z),y.set(-x*O,S,x*R),y.normalize(),o.push(y.x,y.y,y.z),l.push(b+T,A)}if(d>0){let w=(d-1)*v;for(let b=0;b<i;b++){let M=w+b,R=w+b+1,O=d*v+b,V=d*v+b+1;a.push(M,R,O),a.push(R,V,O)}}}this.setIndex(a),this.setAttribute("position",new Zt(r,3)),this.setAttribute("normal",new Zt(o,3)),this.setAttribute("uv",new Zt(l,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new es(t.radius,t.height,t.capSegments,t.radialSegments,t.heightSegments)}}class Oc extends me{constructor(t=1,e=32,n=0,i=Math.PI*2){super();this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:i},e=Math.max(3,e);let s=[],a=[],r=[],o=[],l=new C,c=new Nt;a.push(0,0,0),r.push(0,0,1),o.push(0.5,0.5);for(let u=0,f=3;u<=e;u++,f+=3){let h=n+u/e*i;l.x=t*Math.cos(h),l.y=t*Math.sin(h),a.push(l.x,l.y,l.z),r.push(0,0,1),c.x=(a[f]/t+1)/2,c.y=(a[f+1]/t+1)/2,o.push(c.x,c.y)}for(let u=1;u<=e;u++)s.push(u,u+1,0);this.setIndex(s),this.setAttribute("position",new Zt(a,3)),this.setAttribute("normal",new Zt(r,3)),this.setAttribute("uv",new Zt(o,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Oc(t.radius,t.segments,t.thetaStart,t.thetaLength)}}class fn extends me{constructor(t=1,e=1,n=1,i=32,s=1,a=!1,r=0,o=Math.PI*2){super();this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:i,heightSegments:s,openEnded:a,thetaStart:r,thetaLength:o};let l=this;i=Math.floor(i),s=Math.floor(s);let c=[],u=[],f=[],h=[],p=0,v=[],y=n/2,U=0;if(d(),a===!1){if(t>0)g(!0);if(e>0)g(!1)}this.setIndex(c),this.setAttribute("position",new Zt(u,3)),this.setAttribute("normal",new Zt(f,3)),this.setAttribute("uv",new Zt(h,2));function d(){let m=new C,x=new C,S=0,A=(e-t)/n;for(let T=0;T<=s;T++){let w=[],b=T/s,M=b*(e-t)+t;for(let R=0;R<=i;R++){let O=R/i,V=O*o+r,k=Math.sin(V),et=Math.cos(V);x.x=M*k,x.y=-b*n+y,x.z=M*et,u.push(x.x,x.y,x.z),m.set(k,A,et).normalize(),f.push(m.x,m.y,m.z),h.push(O,1-b),w.push(p++)}v.push(w)}for(let T=0;T<i;T++)for(let w=0;w<s;w++){let b=v[w][T],M=v[w+1][T],R=v[w+1][T+1],O=v[w][T+1];if(t>0||w!==0)c.push(b,M,O),S+=3;if(e>0||w!==s-1)c.push(M,R,O),S+=3}l.addGroup(U,S,0),U+=S}function g(m){let x=p,S=new Nt,A=new C,T=0,w=m===!0?t:e,b=m===!0?1:-1;for(let R=1;R<=i;R++)u.push(0,y*b,0),f.push(0,b,0),h.push(0.5,0.5),p++;let M=p;for(let R=0;R<=i;R++){let V=R/i*o+r,k=Math.cos(V),et=Math.sin(V);A.x=w*et,A.y=y*b,A.z=w*k,u.push(A.x,A.y,A.z),f.push(0,b,0),S.x=k*0.5+0.5,S.y=et*0.5*b+0.5,h.push(S.x,S.y),p++}for(let R=0;R<i;R++){let O=x+R,V=M+R;if(m===!0)c.push(V,V+1,O);else c.push(V+1,V,O);T+=3}l.addGroup(U,T,m===!0?1:2),U+=T}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new fn(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class Ln extends fn{constructor(t=1,e=1,n=32,i=1,s=!1,a=0,r=Math.PI*2){super(0,t,e,n,i,s,a,r);this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:s,thetaStart:a,thetaLength:r}}static fromJSON(t){return new Ln(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class zc extends me{constructor(t=[],e=[],n=1,i=0){super();this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i};let s=[],a=[];if(r(i),l(n),c(),this.setAttribute("position",new Zt(s,3)),this.setAttribute("normal",new Zt(s.slice(),3)),this.setAttribute("uv",new Zt(a,2)),i===0)this.computeVertexNormals();else this.normalizeNormals();function r(d){let g=new C,m=new C,x=new C;for(let S=0;S<e.length;S+=3)h(e[S+0],g),h(e[S+1],m),h(e[S+2],x),o(g,m,x,d)}function o(d,g,m,x){let S=x+1,A=[];for(let T=0;T<=S;T++){A[T]=[];let w=d.clone().lerp(m,T/S),b=g.clone().lerp(m,T/S),M=S-T;for(let R=0;R<=M;R++)if(R===0&&T===S)A[T][R]=w;else A[T][R]=w.clone().lerp(b,R/M)}for(let T=0;T<S;T++)for(let w=0;w<2*(S-T)-1;w++){let b=Math.floor(w/2);if(w%2===0)f(A[T][b+1]),f(A[T+1][b]),f(A[T][b]);else f(A[T][b+1]),f(A[T+1][b+1]),f(A[T+1][b])}}function l(d){let g=new C;for(let m=0;m<s.length;m+=3)g.x=s[m+0],g.y=s[m+1],g.z=s[m+2],g.normalize().multiplyScalar(d),s