<!-- SOLID-PLAYTIME · part 65 -->
-u*u+f*(f+2*o)+l;else if(f<=p)u=0,f=Math.min(Math.max(-s,-o),s),h=f*(f+2*o)+l;else u=Math.max(0,-(a*s+r)),f=u>0?s:Math.min(Math.max(-s,-o),s),h=-u*u+f*(f+2*o)+l;else f=a>0?-s:s,u=Math.max(0,-(a*f+r)),h=-u*u+f*(f+2*o)+l;if(n)n.copy(this.origin).addScaledVector(this.direction,u);if(i)i.copy(cm).addScaledVector(kh,f);return h}intersectSphere(t,e){Ss.subVectors(t.center,this.origin);let n=Ss.dot(this.direction),i=Ss.dot(Ss)-n*n,s=t.radius*t.radius;if(i>s)return null;let a=Math.sqrt(s-i),r=n-a,o=n+a;if(o<0)return null;if(r<0)return this.at(o,e);return this.at(r,e)}intersectsSphere(t){if(t.radius<0)return!1;return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){let e=t.normal.dot(this.direction);if(e===0){if(t.distanceToPoint(this.origin)===0)return 0;return null}let n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){let n=this.distanceToPlane(t);if(n===null)return null;return this.at(n,e)}intersectsPlane(t){let e=t.distanceToPoint(this.origin);if(e===0)return!0;if(t.normal.dot(this.direction)*e<0)return!0;return!1}intersectBox(t,e){let n,i,s,a,r,o,l=1/this.direction.x,c=1/this.direction.y,u=1/this.direction.z,f=this.origin;if(l>=0)n=(t.min.x-f.x)*l,i=(t.max.x-f.x)*l;else n=(t.max.x-f.x)*l,i=(t.min.x-f.x)*l;if(c>=0)s=(t.min.y-f.y)*c,a=(t.max.y-f.y)*c;else s=(t.max.y-f.y)*c,a=(t.min.y-f.y)*c;if(n>a||s>i)return null;if(s>n||isNaN(n))n=s;if(a<i||isNaN(i))i=a;if(u>=0)r=(t.min.z-f.z)*u,o=(t.max.z-f.z)*u;else r=(t.max.z-f.z)*u,o=(t.min.z-f.z)*u;if(n>o||r>i)return null;if(r>n||n!==n)n=r;if(o<i||i!==i)i=o;if(i<0)return null;return this.at(n>=0?n:i,e)}intersectsBox(t){return this.intersectBox(t,Ss)!==null}intersectTriangle(t,e,n,i,s){um.subVectors(e,t),Vh.subVectors(n,t),hm.crossVectors(um,Vh);let a=this.direction.dot(hm),r;if(a>0){if(i)return null;r=1}else if(a<0)r=-1,a=-a;else return null;Ua.subVectors(this.origin,t);let o=r*this.direction.dot(Vh.crossVectors(Ua,Vh));if(o<0)return null;let l=r*this.direction.dot(um.cross(Ua));if(l<0)return null;if(o+l>a)return null;let c=-r*Ua.dot(hm);if(c<0)return null;return this.at(c/a,s)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class ie{constructor(t,e,n,i,s,a,r,o,l,c,u,f,h,p,v,y){if(ie.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0)this.set(t,e,n,i,s,a,r,o,l,c,u,f,h,p,v,y)}set(t,e,n,i,s,a,r,o,l,c,u,f,h,p,v,y){let U=this.elements;return U[0]=t,U[4]=e,U[8]=n,U[12]=i,U[1]=s,U[5]=a,U[9]=r,U[13]=o,U[2]=l,U[6]=c,U[10]=u,U[14]=f,U[3]=h,U[7]=p,U[11]=v,U[15]=y,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new ie().fromArray(this.elements)}copy(t){let e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){let e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){let e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){let e=this.elements,n=t.elements,i=1/Mo.setFromMatrixColumn(t,0).length(),s=1/Mo.setFromMatrixColumn(t,1).length(),a=1/Mo.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*s,e[5]=n[5]*s,e[6]=n[6]*s,e[7]=0,e[8]=n[8]*a,e[9]=n[9]*a,e[10]=n[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=this.elements,{x:n,y:i,z:s}=t,a=Math.cos(n),r=Math.sin(n),o=Math.cos(i),l=Math.sin(i),c=Math.cos(s),u=Math.sin(s);if(t.order==="XYZ"){let f=a*c,h=a*u,p=r*c,v=r*u;e[0]=o*c,e[4]=-o*u,e[8]=l,e[1]=h+p*l,e[5]=f-v*l,e[9]=-r*o,e[2]=v-f*l,e[6]=p+h*l,e[10]=a*o}else if(t.order==="YXZ"){let f=o*c,h=o*u,p=l*c,v=l*u;e[0]=f+v*r,e[4]=p*r-h,e[8]=a*l,e[1]=a*u,e[5]=a*c,e[9]=-r,e[2]=h*r-p,e[6]=v+f*r,e[10]=a*o}else if(t.order==="ZXY"){let f=o*c,h=o*u,p=l*c,v=l*u;e[0]=f-v*r,e[4]=-a*u,e[8]=p+h*r,e[1]=h+p*r,e[5]=a*c,e[9]=v-f*r,e[2]=-a*l,e[6]=r,e[10]=a*o}else if(t.order==="ZYX"){let f=a*c,h=a*u,p=r*c,v=r*u;e[0]=o*c,e[4]=p*l-h,e[8]=f*l+v,e[1]=o*u,e[5]=v*l+f,e[9]=h*l-p,e[2]=-l,e[6]=r*o,e[10]=a*o}else if(t.order==="YZX"){let f=a*o,h=a*l,p=r*o,v=r*l;e[0]=o*c,e[4]=v-f*u,e[8]=p*u+h,e[1]=u,e[5]=a*c,e[9]=-r*c,e[2]=-l*c,e[6]=h*u+p,e[10]=f-v*u}else if(t.order==="XZY"){let f=a*o,h=a*l,p=r*o,v=r*l;e[0]=o*c,e[4]=-u,e[8]=l*c,e[1]=f*u+v,e[5]=a*c,e[9]=h*u-p,e[2]=p*u-h,e[6]=r*c,e[10]=v*u+f}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(ES,t,MS)}lookAt(t,e,n){let i=this.eleme