{"size": 58159, "ext": "js", "max_stars_repo_path": "build/math-ds.min.js", "max_stars_repo_name": "vanruesc/math-ds", "max_stars_repo_stars_event_min_datetime": "2020-05-20T15:03:01.000Z", "max_stars_repo_stars_event_max_datetime": "2021-02-17T06:30:23.000Z", "max_issues_repo_path": "build/math-ds.min.js", "max_issues_repo_name": "vanruesc/math-ds", "max_issues_repo_issues_event_min_datetime": "2018-05-27T10:39:18.000Z", "max_issues_repo_issues_event_max_datetime": "2018-05-27T10:39:18.000Z", "max_forks_repo_path": "build/math-ds.min.js", "max_forks_repo_name": "vanruesc/math-ds", "max_forks_repo_forks_event_min_datetime": "2018-05-27T06:57:56.000Z", "max_forks_repo_forks_event_max_datetime": "2018-05-27T06:57:56.000Z"}
{"max_stars_count": 7, "max_issues_count": 1, "max_forks_count": 1, "avg_line_length": 7269.875, "max_line_length": 58018, "alphanum_fraction": 0.6635258515}
/**
 * math-ds v1.2.1 build Fri May 01 2020
 * https://github.com/vanruesc/math-ds
 * Copyright 2020 Raoul van Rüschen
 * @license Zlib
 */
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t=t||self).MATHDS={})}(this,(function(t){"use strict";function i(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}function e(t,i){for(var e=0;e<i.length;e++){var n=i[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function n(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}var s=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;i(this,t),this.x=e,this.y=n,this.z=s}return n(t,[{key:"set",value:function(t,i,e){return this.x=t,this.y=i,this.z=e,this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}},{key:"copy",value:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}},{key:"clone",value:function(){return new this.constructor(this.x,this.y,this.z)}},{key:"fromArray",value:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=t[i],this.y=t[i+1],this.z=t[i+2],this}},{key:"toArray",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t[i]=this.x,t[i+1]=this.y,t[i+2]=this.z,t}},{key:"setFromSpherical",value:function(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}},{key:"setFromSphericalCoords",value:function(t,i,e){var n=Math.sin(i)*t;return this.x=n*Math.sin(e),this.y=Math.cos(i)*t,this.z=n*Math.cos(e),this}},{key:"setFromCylindrical",value:function(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}},{key:"setFromCylindricalCoords",value:function(t,i,e){return this.x=t*Math.sin(i),this.y=e,this.z=t*Math.cos(i),this}},{key:"setFromMatrix3Column",value:function(t,i){return this.fromArray(t.elements,3*i)}},{key:"setFromMatrixColumn",value:function(t,i){return this.fromArray(t.elements,4*i)}},{key:"setFromMatrixPosition",value:function(t){var i=t.elements;return this.x=i[12],this.y=i[13],this.z=i[14],this}},{key:"setFromMatrixScale",value:function(t){var i=this.setFromMatrixColumn(t,0).length(),e=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=i,this.y=e,this.z=n,this}},{key:"add",value:function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}},{key:"addScalar",value:function(t){return this.x+=t,this.y+=t,this.z+=t,this}},{key:"addVectors",value:function(t,i){return this.x=t.x+i.x,this.y=t.y+i.y,this.z=t.z+i.z,this}},{key:"addScaledVector",value:function(t,i){return this.x+=t.x*i,this.y+=t.y*i,this.z+=t.z*i,this}},{key:"sub",value:function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}},{key:"subScalar",value:function(t){return this.x-=t,this.y-=t,this.z-=t,this}},{key:"subVectors",value:function(t,i){return this.x=t.x-i.x,this.y=t.y-i.y,this.z=t.z-i.z,this}},{key:"multiply",value:function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}},{key:"multiplyScalar",value:function(t){return this.x*=t,this.y*=t,this.z*=t,this}},{key:"multiplyVectors",value:function(t,i){return this.x=t.x*i.x,this.y=t.y*i.y,this.z=t.z*i.z,this}},{key:"divide",value:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}},{key:"divideScalar",value:function(t){return this.x/=t,this.y/=t,this.z/=t,this}},{key:"crossVectors",value:function(t,i){var e=t.x,n=t.y,s=t.z,h=i.x,r=i.y,a=i.z;return this.x=n*a-s*r,this.y=s*h-e*a,this.z=e*r-n*h,this}},{key:"cross",value:function(t){return this.crossVectors(this,t)}},{key:"transformDirection",value:function(t){var i=this.x,e=this.y,n=this.z,s=t.elements;return this.x=s[0]*i+s[4]*e+s[8]*n,this.y=s[1]*i+s[5]*e+s[9]*n,this.z=s[2]*i+s[6]*e+s[10]*n,this.normalize()}},{key:"applyMatrix3",value:function(t){var i=this.x,e=this.y,n=this.z,s=t.elements;return this.x=s[0]*i+s[3]*e+s[6]*n,this.y=s[1]*i+s[4]*e+s[7]*n,this.z=s[2]*i+s[5]*e+s[8]*n,this}},{key:"applyNormalMatrix",value:function(t){return this.applyMatrix3(t).normalize()}},{key:"applyMatrix4",value:function(t){var i=this.x,e=this.y,n=this.z,s=t.elements;return this.x=s[0]*i+s[4]*e+s[8]*n+s[12],this.y=s[1]*i+s[5]*e+s[9]*n+s[13],this.z=s[2]*i+s[6]*e+s[10]*n+s[14],this}},{key:"applyQuaternion",value:function(t){var i=this.x,e=this.y,n=this.z,s=t.x,h=t.y,r=t.z,a=t.w,u=a*i+h*n-r*e,o=a*e+r*i-s*n,l=a*n+s*e-h*i,y=-s*i-h*e-r*n;return this.x=u*a+y*-s+o*-r-l*-h,this.y=o*a+y*-h+l*-s-u*-r,this.z=l*a+y*-r+u*-h-o*-s,this}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}},{key:"dot",value:function(t){return this.x*t.x+this.y*t.y+this.z*t.z}},{key:"reflect",value:function(t){var i=t.x,e=t.y,n=t.z;return this.sub(t.multiplyScalar(2*this.dot(t))),t.set(i,e,n),this}},{key:"angleTo",value:function(t){var i=Math.sqrt(this.lengthSquared()*t.lengthSquared());return 0===i?.5*Math.PI:Math.acos(Math.min(Math.max(this.dot(t)/i,-1),1))}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}},{key:"lengthSquared",value:function(){return this.x*this.x+this.y*this.y+this.z*this.z}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}},{key:"manhattanDistanceTo",value:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}},{key:"distanceToSquared",value:function(t){var i=this.x-t.x,e=this.y-t.y,n=this.z-t.z;return i*i+e*e+n*n}},{key:"distanceTo",value:function(t){return Math.sqrt(this.distanceToSquared(t))}},{key:"normalize",value:function(){return this.divideScalar(this.length())}},{key:"setLength",value:function(t){return this.normalize().multiplyScalar(t)}},{key:"min",value: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}},{key:"max",value: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}},{key:"clamp",value:function(t,i){return this.x=Math.max(t.x,Math.min(i.x,this.x)),this.y=Math.max(t.y,Math.min(i.y,this.y)),this.z=Math.max(t.z,Math.min(i.z,this.z)),this}},{key:"floor",value:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}},{key:"ceil",value:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}},{key:"round",value:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}},{key:"lerp",value:function(t,i){return this.x+=(t.x-this.x)*i,this.y+=(t.y-this.y)*i,this.z+=(t.z-this.z)*i,this}},{key:"lerpVectors",value:function(t,i,e){return this.subVectors(i,t).multiplyScalar(e).add(t)}},{key:"equals",value:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}}]),t}(),h=new s,r=[new s,new s,new s,new s,new s,new s,new s,new s],a=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new s(1/0,1/0,1/0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new s(-1/0,-1/0,-1/0);i(this,t),this.min=e,this.max=n}return n(t,[{key:"set",value:function(t,i){return this.min.copy(t),this.max.copy(i),this}},{key:"copy",value:function(t){return this.min.copy(t.min),this.max.copy(t.max),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"makeEmpty",value:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}},{key:"isEmpty",value:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}},{key:"getCenter",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new s;return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}},{key:"getSize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new s;return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}},{key:"setFromSphere",value:function(t){return this.set(t.center,t.center),this.expandByScalar(t.radius),this}},{key:"expandByPoint",value:function(t){return this.min.min(t),this.max.max(t),this}},{key:"expandByVector",value:function(t){return this.min.sub(t),this.max.add(t),this}},{key:"expandByScalar",value:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this}},{key:"setFromPoints",value:function(t){var i,e;for(this.min.set(0,0,0),this.max.set(0,0,0),i=0,e=t.length;i<e;++i)this.expandByPoint(t[i]);return this}},{key:"setFromCenterAndSize",value:function(t,i){var e=h.copy(i).multiplyScalar(.5);return this.min.copy(t).sub(e),this.max.copy(t).add(e),this}},{key:"clampPoint",value:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new s;return i.copy(t).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(t){return h.copy(t).clamp(this.min,this.max).sub(t).length()}},{key:"applyMatrix4",value:function(t){var i=this.min,e=this.max;return this.isEmpty()||(r[0].set(i.x,i.y,i.z).applyMatrix4(t),r[1].set(i.x,i.y,e.z).applyMatrix4(t),r[2].set(i.x,e.y,i.z).applyMatrix4(t),r[3].set(i.x,e.y,e.z).applyMatrix4(t),r[4].set(e.x,i.y,i.z).applyMatrix4(t),r[5].set(e.x,i.y,e.z).applyMatrix4(t),r[6].set(e.x,e.y,i.z).applyMatrix4(t),r[7].set(e.x,e.y,e.z).applyMatrix4(t),this.setFromPoints(r)),this}},{key:"translate",value:function(t){return this.min.add(t),this.max.add(t),this}},{key:"intersect",value:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}},{key:"union",value:function(t){return this.min.min(t.min),this.max.max(t.max),this}},{key:"containsPoint",value:function(t){var i=this.min,e=this.max;return t.x>=i.x&&t.y>=i.y&&t.z>=i.z&&t.x<=e.x&&t.y<=e.y&&t.z<=e.z}},{key:"containsBox",value:function(t){var i=this.min,e=this.max,n=t.min,s=t.max;return i.x<=n.x&&s.x<=e.x&&i.y<=n.y&&s.y<=e.y&&i.z<=n.z&&s.z<=e.z}},{key:"intersectsBox",value:function(t){var i=this.min,e=this.max,n=t.min,s=t.max;return s.x>=i.x&&s.y>=i.y&&s.z>=i.z&&n.x<=e.x&&n.y<=e.y&&n.z<=e.z}},{key:"intersectsSphere",value:function(t){return this.clampPoint(t.center,h).distanceToSquared(t.center)<=t.radius*t.radius}},{key:"intersectsPlane",value:function(t){var i,e;return t.normal.x>0?(i=t.normal.x*this.min.x,e=t.normal.x*this.max.x):(i=t.normal.x*this.max.x,e=t.normal.x*this.min.x),t.normal.y>0?(i+=t.normal.y*this.min.y,e+=t.normal.y*this.max.y):(i+=t.normal.y*this.max.y,e+=t.normal.y*this.min.y),t.normal.z>0?(i+=t.normal.z*this.min.z,e+=t.normal.z*this.max.z):(i+=t.normal.z*this.max.z,e+=t.normal.z*this.min.z),i<=-t.constant&&e>=-t.constant}},{key:"equals",value:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}]),t}(),u=new a,o=new s,l=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new s,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;i(this,t),this.center=e,this.radius=n}return n(t,[{key:"set",value:function(t,i){return this.center.copy(t),this.radius=i,this}},{key:"copy",value:function(t){return this.center.copy(t.center),this.radius=t.radius,this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"setFromPoints",value:function(t){var i,e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:u.setFromPoints(t).getCenter(this.center),s=0;for(i=0,e=t.length;i<e;++i)s=Math.max(s,n.distanceToSquared(t[i]));return this.radius=Math.sqrt(s),this}},{key:"setFromBox",value:function(t){return t.getCenter(this.center),this.radius=.5*t.getSize(o).length(),this}},{key:"isEmpty",value:function(){return this.radius<=0}},{key:"translate",value:function(t){return this.center.add(t),this}},{key:"clampPoint",value:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new s,e=this.center.distanceToSquared(t);return i.copy(t),e>this.radius*this.radius&&(i.sub(this.center).normalize(),i.multiplyScalar(this.radius).add(this.center)),i}},{key:"distanceToPoint",value:function(t){return t.distanceTo(this.center)-this.radius}},{key:"containsPoint",value:function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}},{key:"intersectsSphere",value:function(t){var i=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=i*i}},{key:"intersectsBox",value:function(t){return t.intersectsSphere(this)}},{key:"intersectsPlane",value:function(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}},{key:"equals",value:function(t){return t.center.equals(this.center)&&t.radius===this.radius}}]),t}(),y=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;i(this,t),this.x=e,this.y=n}return n(t,[{key:"set",value:function(t,i){return this.x=t,this.y=i,this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this}},{key:"copy",value:function(t){return this.x=t.x,this.y=t.y,this}},{key:"clone",value:function(){return new this.constructor(this.x,this.y)}},{key:"fromArray",value:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=t[i],this.y=t[i+1],this}},{key:"toArray",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t[i]=this.x,t[i+1]=this.y,t}},{key:"add",value:function(t){return this.x+=t.x,this.y+=t.y,this}},{key:"addScalar",value:function(t){return this.x+=t,this.y+=t,this}},{key:"addVectors",value:function(t,i){return this.x=t.x+i.x,this.y=t.y+i.y,this}},{key:"addScaledVector",value:function(t,i){return this.x+=t.x*i,this.y+=t.y*i,this}},{key:"sub",value:function(t){return this.x-=t.x,this.y-=t.y,this}},{key:"subScalar",value:function(t){return this.x-=t,this.y-=t,this}},{key:"subVectors",value:function(t,i){return this.x=t.x-i.x,this.y=t.y-i.y,this}},{key:"multiply",value:function(t){return this.x*=t.x,this.y*=t.y,this}},{key:"multiplyScalar",value:function(t){return this.x*=t,this.y*=t,this}},{key:"divide",value:function(t){return this.x/=t.x,this.y/=t.y,this}},{key:"divideScalar",value:function(t){return this.x/=t,this.y/=t,this}},{key:"applyMatrix3",value:function(t){var i=this.x,e=this.y,n=t.elements;return this.x=n[0]*i+n[3]*e+n[6],this.y=n[1]*i+n[4]*e+n[7],this}},{key:"dot",value:function(t){return this.x*t.x+this.y*t.y}},{key:"cross",value:function(t){return this.x*t.y-this.y*t.x}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)}},{key:"lengthSquared",value:function(){return this.x*this.x+this.y*this.y}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y)}},{key:"manhattanDistanceTo",value:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}},{key:"distanceToSquared",value:function(t){var i=this.x-t.x,e=this.y-t.y;return i*i+e*e}},{key:"distanceTo",value:function(t){return Math.sqrt(this.distanceToSquared(t))}},{key:"normalize",value:function(){return this.divideScalar(this.length())}},{key:"setLength",value:function(t){return this.normalize().multiplyScalar(t)}},{key:"min",value:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}},{key:"max",value:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}},{key:"clamp",value:function(t,i){return this.x=Math.max(t.x,Math.min(i.x,this.x)),this.y=Math.max(t.y,Math.min(i.y,this.y)),this}},{key:"floor",value:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}},{key:"ceil",value:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}},{key:"round",value:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this}},{key:"angle",value:function(){return Math.atan2(-this.y,-this.x)+Math.PI}},{key:"lerp",value:function(t,i){return this.x+=(t.x-this.x)*i,this.y+=(t.y-this.y)*i,this}},{key:"lerpVectors",value:function(t,i,e){return this.subVectors(i,t).multiplyScalar(e).add(t)}},{key:"rotateAround",value:function(t,i){var e=Math.cos(i),n=Math.sin(i),s=this.x-t.x,h=this.y-t.y;return this.x=s*e-h*n+t.x,this.y=s*n+h*e+t.y,this}},{key:"equals",value:function(t){return t.x===this.x&&t.y===this.y}},{key:"width",get:function(){return this.x},set:function(t){return this.x=t}},{key:"height",get:function(){return this.y},set:function(t){return this.y=t}}]),t}(),c=new y,v=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new y(1/0,1/0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new y(-1/0,-1/0);i(this,t),this.min=e,this.max=n}return n(t,[{key:"set",value:function(t,i){return this.min.copy(t),this.max.copy(i),this}},{key:"copy",value:function(t){return this.min.copy(t.min),this.max.copy(t.max),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"makeEmpty",value:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}},{key:"isEmpty",value:function(){return this.max.x<this.min.x||this.max.y<this.min.y}},{key:"getCenter",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new y;return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}},{key:"getSize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new y;return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}},{key:"getBoundingSphere",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new l;return this.getCenter(t.center),t.radius=.5*this.getSize(c).length(),t}},{key:"expandByPoint",value:function(t){return this.min.min(t),this.max.max(t),this}},{key:"expandByVector",value:function(t){return this.min.sub(t),this.max.add(t),this}},{key:"expandByScalar",value:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this}},{key:"setFromPoints",value:function(t){var i,e;for(this.min.set(0,0),this.max.set(0,0),i=0,e=t.length;i<e;++i)this.expandByPoint(t[i]);return this}},{key:"setFromCenterAndSize",value:function(t,i){var e=c.copy(i).multiplyScalar(.5);return this.min.copy(t).sub(e),this.max.copy(t).add(e),this}},{key:"clampPoint",value:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new y;return i.copy(t).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(t){return c.copy(t).clamp(this.min,this.max).sub(t).length()}},{key:"translate",value:function(t){return this.min.add(t),this.max.add(t),this}},{key:"intersect",value:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}},{key:"union",value:function(t){return this.min.min(t.min),this.max.max(t.max),this}},{key:"containsPoint",value:function(t){var i=this.min,e=this.max;return t.x>=i.x&&t.y>=i.y&&t.x<=e.x&&t.y<=e.y}},{key:"containsBox",value:function(t){var i=this.min,e=this.max,n=t.min,s=t.max;return i.x<=n.x&&s.x<=e.x&&i.y<=n.y&&s.y<=e.y}},{key:"intersectsBox",value:function(t){var i=this.min,e=this.max,n=t.min,s=t.max;return s.x>=i.x&&s.y>=i.y&&n.x<=e.x&&n.y<=e.y}},{key:"equals",value:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}]),t}(),m=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;i(this,t),this.radius=e,this.theta=n,this.y=s}return n(t,[{key:"set",value:function(t,i,e){return this.radius=t,this.theta=i,this.y=e,this}},{key:"copy",value:function(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"setFromVector3",value:function(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}},{key:"setFromCartesianCoords",value:function(t,i,e){return this.radius=Math.sqrt(t*t+e*e),this.theta=Math.atan2(t,e),this.y=i,this}}]),t}(),x=function(){function t(){i(this,t),this.elements=new Float32Array([1,0,0,0,1,0,0,0,1])}return n(t,[{key:"set",value:function(t,i,e,n,s,h,r,a,u){var o=this.elements;return o[0]=t,o[3]=i,o[6]=e,o[1]=n,o[4]=s,o[7]=h,o[2]=r,o[5]=a,o[8]=u,this}},{key:"identity",value:function(){return this.set(1,0,0,0,1,0,0,0,1),this}},{key:"copy",value:function(t){var i=t.elements,e=this.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}},{key:"clone",value:function(){return(new this.constructor).fromArray(this.elements)}},{key:"fromArray",value:function(t){var i,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;for(i=0;i<9;++i)n[i]=t[i+e];return this}},{key:"toArray",value:function(){var t,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;for(t=0;t<9;++t)i[t+e]=n[t];return i}},{key:"multiplyMatrices",value:function(t,i){var e=t.elements,n=i.elements,s=this.elements,h=e[0],r=e[3],a=e[6],u=e[1],o=e[4],l=e[7],y=e[2],c=e[5],v=e[8],m=n[0],x=n[3],f=n[6],d=n[1],k=n[4],z=n[7],M=n[2],p=n[5],w=n[8];return s[0]=h*m+r*d+a*M,s[3]=h*x+r*k+a*p,s[6]=h*f+r*z+a*w,s[1]=u*m+o*d+l*M,s[4]=u*x+o*k+l*p,s[7]=u*f+o*z+l*w,s[2]=y*m+c*d+v*M,s[5]=y*x+c*k+v*p,s[8]=y*f+c*z+v*w,this}},{key:"multiply",value:function(t){return this.multiplyMatrices(this,t)}},{key:"premultiply",value:function(t){return this.multiplyMatrices(t,this)}},{key:"multiplyScalar",value:function(t){var i=this.elements;return i[0]*=t,i[3]*=t,i[6]*=t,i[1]*=t,i[4]*=t,i[7]*=t,i[2]*=t,i[5]*=t,i[8]*=t,this}},{key:"determinant",value:function(){var t=this.elements,i=t[0],e=t[1],n=t[2],s=t[3],h=t[4],r=t[5],a=t[6],u=t[7],o=t[8];return i*h*o-i*r*u-e*s*o+e*r*a+n*s*u-n*h*a}},{key:"getInverse",value:function(t){var i,e=t.elements,n=this.elements,s=e[0],h=e[1],r=e[2],a=e[3],u=e[4],o=e[5],l=e[6],y=e[7],c=e[8],v=c*u-o*y,m=o*l-c*a,x=y*a-u*l,f=s*v+h*m+r*x;return 0!==f?(i=1/f,n[0]=v*i,n[1]=(r*y-c*h)*i,n[2]=(o*h-r*u)*i,n[3]=m*i,n[4]=(c*s-r*l)*i,n[5]=(r*a-o*s)*i,n[6]=x*i,n[7]=(h*l-y*s)*i,n[8]=(u*s-h*a)*i):this.set(0,0,0,0,0,0,0,0,0),this}},{key:"transpose",value:function(){var t,i=this.elements;return t=i[1],i[1]=i[3],i[3]=t,t=i[2],i[2]=i[6],i[6]=t,t=i[5],i[5]=i[7],i[7]=t,this}},{key:"scale",value:function(t,i){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=i,e[4]*=i,e[7]*=i,this}},{key:"rotate",value:function(t){var i=Math.cos(t),e=Math.sin(t),n=this.elements,s=n[0],h=n[3],r=n[6],a=n[1],u=n[4],o=n[7];return n[0]=i*s+e*a,n[3]=i*h+e*u,n[6]=i*r+e*o,n[1]=-e*s+i*a,n[4]=-e*h+i*u,n[7]=-e*r+i*o,this}},{key:"translate",value:function(t,i){var e=this.elements;return e[0]+=t*e[2],e[3]+=t*e[5],e[6]+=t*e[8],e[1]+=i*e[2],e[4]+=i*e[5],e[7]+=i*e[8],this}},{key:"equals",value:function(t){var i,e=this.elements,n=t.elements,s=!0;for(i=0;s&&i<9;++i)e[i]!==n[i]&&(s=!1);return s}}]),t}(),f={XYZ:"XYZ",YZX:"YZX",ZXY:"ZXY",XZY:"XZY",YXZ:"YXZ",ZYX:"ZYX"},d=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,h=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;i(this,t),this.x=e,this.y=n,this.z=s,this.w=h}return n(t,[{key:"set",value:function(t,i,e,n){return this.x=t,this.y=i,this.z=e,this.w=n,this}},{key:"copy",value:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this}},{key:"clone",value:function(){return new this.constructor(this.x,this.y,this.z,this.w)}},{key:"fromArray",value:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=t[i],this.y=t[i+1],this.z=t[i+2],this.w=t[i+3],this}},{key:"toArray",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t[i]=this.x,t[i+1]=this.y,t[i+2]=this.z,t[i+3]=this.w,t}},{key:"setFromEuler",value:function(t){var i=t.x,e=t.y,n=t.z,s=Math.cos,h=Math.sin,r=s(i/2),a=s(e/2),u=s(n/2),o=h(i/2),l=h(e/2),y=h(n/2);switch(t.order){case f.XYZ:this.x=o*a*u+r*l*y,this.y=r*l*u-o*a*y,this.z=r*a*y+o*l*u,this.w=r*a*u-o*l*y;break;case f.YXZ:this.x=o*a*u+r*l*y,this.y=r*l*u-o*a*y,this.z=r*a*y-o*l*u,this.w=r*a*u+o*l*y;break;case f.ZXY:this.x=o*a*u-r*l*y,this.y=r*l*u+o*a*y,this.z=r*a*y+o*l*u,this.w=r*a*u-o*l*y;break;case f.ZYX:this.x=o*a*u-r*l*y,this.y=r*l*u+o*a*y,this.z=r*a*y-o*l*u,this.w=r*a*u+o*l*y;break;case f.YZX:this.x=o*a*u+r*l*y,this.y=r*l*u+o*a*y,this.z=r*a*y-o*l*u,this.w=r*a*u-o*l*y;break;case f.XZY:this.x=o*a*u-r*l*y,this.y=r*l*u-o*a*y,this.z=r*a*y+o*l*u,this.w=r*a*u+o*l*y}return this}},{key:"setFromAxisAngle",value:function(t,i){var e=i/2,n=Math.sin(e);return this.x=t.x*n,this.y=t.y*n,this.z=t.z*n,this.w=Math.cos(e),this}},{key:"setFromRotationMatrix",value:function(t){var i,e=t.elements,n=e[0],s=e[4],h=e[8],r=e[1],a=e[5],u=e[9],o=e[2],l=e[6],y=e[10],c=n+a+y;return c>0?(i=.5/Math.sqrt(c+1),this.w=.25/i,this.x=(l-u)*i,this.y=(h-o)*i,this.z=(r-s)*i):n>a&&n>y?(i=2*Math.sqrt(1+n-a-y),this.w=(l-u)/i,this.x=.25*i,this.y=(s+r)/i,this.z=(h+o)/i):a>y?(i=2*Math.sqrt(1+a-n-y),this.w=(h-o)/i,this.x=(s+r)/i,this.y=.25*i,this.z=(u+l)/i):(i=2*Math.sqrt(1+y-n-a),this.w=(r-s)/i,this.x=(h+o)/i,this.y=(u+l)/i,this.z=.25*i),this}},{key:"setFromUnitVectors",value:function(t,i){var e=t.dot(i)+1;return e<1e-6?(e=0,Math.abs(t.x)>Math.abs(t.z)?(this.x=-t.y,this.y=t.x,this.z=0,this.w=e):(this.x=0,this.y=-t.z,this.z=t.y,this.w=e)):(this.x=t.y*i.z-t.z*i.y,this.y=t.z*i.x-t.x*i.z,this.z=t.x*i.y-t.y*i.x,this.w=e),this.normalize()}},{key:"angleTo",value:function(t){return 2*Math.acos(Math.abs(Math.min(Math.max(this.dot(t),-1),1)))}},{key:"rotateTowards",value:function(t,i){var e=this.angleTo(t);return 0!==e&&this.slerp(t,Math.min(1,i/e)),this}},{key:"invert",value:function(){return this.conjugate()}},{key:"conjugate",value:function(){return this.x*=-1,this.y*=-1,this.z*=-1,this}},{key:"lengthSquared",value:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}},{key:"normalize",value:function(){var t,i=this.length();return 0===i?(this.x=0,this.y=0,this.z=0,this.w=1):(t=1/i,this.x=this.x*t,this.y=this.y*t,this.z=this.z*t,this.w=this.w*t),this}},{key:"dot",value:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}},{key:"multiplyQuaternions",value:function(t,i){var e=t.x,n=t.y,s=t.z,h=t.w,r=i.x,a=i.y,u=i.z,o=i.w;return this.x=e*o+h*r+n*u-s*a,this.y=n*o+h*a+s*r-e*u,this.z=s*o+h*u+e*a-n*r,this.w=h*o-e*r-n*a-s*u,this}},{key:"multiply",value:function(t){return this.multiplyQuaternions(this,t)}},{key:"premultiply",value:function(t){return this.multiplyQuaternions(t,this)}},{key:"slerp",value:function(t,i){var e,n,s,h,r,a,u,o=this.x,l=this.y,y=this.z,c=this.w;return 1===i?this.copy(t):i>0&&((e=c*t.w+o*t.x+l*t.y+y*t.z)<0?(this.w=-t.w,this.x=-t.x,this.y=-t.y,this.z=-t.z,e=-e):this.copy(t),e>=1?(this.w=c,this.x=o,this.y=l,this.z=y):(r=1-i,(n=1-e*e)<=Number.EPSILON?(this.w=r*c+i*this.w,this.x=r*o+i*this.x,this.y=r*l+i*this.y,this.z=r*y+i*this.z,this.normalize()):(s=Math.sqrt(n),h=Math.atan2(s,e),a=Math.sin(r*h)/s,u=Math.sin(i*h)/s,this.w=c*a+this.w*u,this.x=o*a+this.x*u,this.y=l*a+this.y*u,this.z=y*a+this.z*u))),this}},{key:"equals",value:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}}],[{key:"slerp",value:function(t,i,e,n){return e.copy(t).slerp(i,n)}},{key:"slerpFlat",value:function(t,i,e,n,s,h,r){var a,u,o,l,y,c,v,m,x=s[h],f=s[h+1],d=s[h+2],k=s[h+3],z=e[n],M=e[n+1],p=e[n+2],w=e[n+3];w===k&&z===x&&M===f&&p===d||(a=1-r,c=(l=z*x+M*f+p*d+w*k)>=0?1:-1,(y=1-l*l)>Number.EPSILON&&(o=Math.sqrt(y),v=Math.atan2(o,l*c),a=Math.sin(a*v)/o,r=Math.sin(r*v)/o),z=z*a+x*(m=r*c),M=M*a+f*m,p=p*a+d*m,w=w*a+k*m,a===1-r&&(z*=u=1/Math.sqrt(z*z+M*M+p*p+w*w),M*=u,p*=u,w*=u)),t[i]=z,t[i+1]=M,t[i+2]=p,t[i+3]=w}}]),t}();function k(t,i,e){return Math.max(Math.min(t,e),i)}var z=new x,M=new d,p=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;i(this,t),this.x=e,this.y=n,this.z=s,this.order=t.defaultOrder}return n(t,[{key:"set",value:function(t,i,e,n){return this.x=t,this.y=i,this.z=e,this.order=n,this}},{key:"copy",value:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.order=t.order,this}},{key:"clone",value:function(){return new this.constructor(this.x,this.y,this.z,this.order)}},{key:"fromArray",value:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=t[i],this.y=t[i+1],this.z=t[i+2],this.order=t[i+3],this}},{key:"toArray",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t[i]=this.x,t[i+1]=this.y,t[i+2]=this.z,t[i+3]=this.order,t}},{key:"toVector3",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new s;return t.set(this.x,this.y,this.z)}},{key:"setFromRotationMatrix",value:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.order,e=t.elements,n=e[0],s=e[4],h=e[8],r=e[1],a=e[5],u=e[9],o=e[2],l=e[6],y=e[10],c=1-1e-7;switch(i){case f.XYZ:this.y=Math.asin(k(h,-1,1)),Math.abs(h)<c?(this.x=Math.atan2(-u,y),this.z=Math.atan2(-s,n)):(this.x=Math.atan2(l,a),this.z=0);break;case f.YXZ:this.x=Math.asin(-k(u,-1,1)),Math.abs(u)<c?(this.y=Math.atan2(h,y),this.z=Math.atan2(r,a)):(this.y=Math.atan2(-o,n),this.z=0);break;case f.ZXY:this.x=Math.asin(k(l,-1,1)),Math.abs(l)<c?(this.y=Math.atan2(-o,y),this.z=Math.atan2(-s,a)):(this.y=0,this.z=Math.atan2(r,n));break;case f.ZYX:this.y=Math.asin(-k(o,-1,1)),Math.abs(o)<c?(this.x=Math.atan2(l,y),this.z=Math.atan2(r,n)):(this.x=0,this.z=Math.atan2(-s,a));break;case f.YZX:this.z=Math.asin(k(r,-1,1)),Math.abs(r)<c?(this.x=Math.atan2(-u,a),this.y=Math.atan2(-o,n)):(this.x=0,this.y=Math.atan2(h,y));break;case f.XZY:this.z=Math.asin(-k(s,-1,1)),Math.abs(s)<c?(this.x=Math.atan2(l,a),this.y=Math.atan2(h,n)):(this.x=Math.atan2(-u,y),this.y=0)}return this.order=i,this}},{key:"setFromQuaternion",value:function(t,i){return z.makeRotationFromQuaternion(t),this.setFromRotationMatrix(z,i)}},{key:"setFromVector3",value:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.order;return this.set(t.x,t.y,t.z,i)}},{key:"reorder",value:function(t){return M.setFromEuler(this),this.setFromQuaternion(M,t)}},{key:"equals",value:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.order===this.order}}],[{key:"defaultOrder",get:function(){return f.XYZ}}]),t}(),w=new s,g=new s,S=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new s(1,0,0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;i(this,t),this.normal=e,this.constant=n}return n(t,[{key:"set",value:function(t,i){return this.normal.copy(t),this.constant=i,this}},{key:"setComponents",value:function(t,i,e,n){return this.normal.set(t,i,e),this.constant=n,this}},{key:"copy",value:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"setFromNormalAndCoplanarPoint",value:function(t,i){return this.normal.copy(t),this.constant=-i.dot(this.normal),this}},{key:"setFromCoplanarPoints",value:function(t,i,e){var n=w.subVectors(e,i).cross(g.subVectors(t,i)).normalize();return this.setFromNormalAndCoplanarPoint(n,w),this}},{key:"normalize",value:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}},{key:"negate",value:function(){return this.normal.negate(),this.constant=-this.constant,this}},{key:"distanceToPoint",value:function(t){return this.normal.dot(t)+this.constant}},{key:"distanceToSphere",value:function(t){return this.distanceToPoint(t.center)-t.radius}},{key:"projectPoint",value:function(t,i){return i.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)}},{key:"coplanarPoint",value:function(t){return t.copy(this.normal).multiplyScalar(-this.constant)}},{key:"translate",value:function(t){return this.constant-=t.dot(this.normal),this}},{key:"intersectLine",value:function(t,i){var e=t.delta(w),n=this.normal.dot(e);if(0===n)0===this.distanceToPoint(t.start)&&i.copy(t.start);else{var s=-(t.start.dot(this.normal)+this.constant)/n;s>=0&&s<=1&&i.copy(e).multiplyScalar(s).add(t.start)}return i}},{key:"intersectsLine",value:function(t){var i=this.distanceToPoint(t.start),e=this.distanceToPoint(t.end);return i<0&&e>0||e<0&&i>0}},{key:"intersectsBox",value:function(t){return t.intersectsPlane(this)}},{key:"intersectsSphere",value:function(t){return t.intersectsPlane(this)}},{key:"equals",value:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}}]),t}(),b=new s,q=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new S,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new S,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new S,h=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new S,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:new S,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:new S;i(this,t),this.planes=[e,n,s,h,r,a]}return n(t,[{key:"set",value:function(t,i,e,n,s,h){var r=this.planes;return r[0].copy(t),r[1].copy(i),r[2].copy(e),r[3].copy(n),r[4].copy(s),r[5].copy(h),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(t){var i,e=this.planes;for(i=0;i<6;++i)e[i].copy(t.planes[i]);return this}},{key:"setFromMatrix",value:function(t){return this.setFromProjectionMatrix(t)}},{key:"setFromProjectionMatrix",value:function(t){var i=this.planes,e=t.elements,n=e[0],s=e[1],h=e[2],r=e[3],a=e[4],u=e[5],o=e[6],l=e[7],y=e[8],c=e[9],v=e[10],m=e[11],x=e[12],f=e[13],d=e[14],k=e[15];return i[0].setComponents(r-n,l-a,m-y,k-x).normalize(),i[1].setComponents(r+n,l+a,m+y,k+x).normalize(),i[2].setComponents(r+s,l+u,m+c,k+f).normalize(),i[3].setComponents(r-s,l-u,m-c,k-f).normalize(),i[4].setComponents(r-h,l-o,m-v,k-d).normalize(),i[5].setComponents(r+h,l+o,m+v,k+d).normalize(),this}},{key:"intersectsSphere",value:function(t){var i,e=this.planes,n=t.center,s=-t.radius,h=!0;for(i=0;i<6;++i)if(e[i].distanceToPoint(n)<s){h=!1;break}return h}},{key:"intersectsBox",value:function(t){var i,e,n=this.planes,s=t.min,h=t.max;for(i=0;i<6;++i)if(e=n[i],b.x=e.normal.x>0?h.x:s.x,b.y=e.normal.y>0?h.y:s.y,b.z=e.normal.z>0?h.z:s.z,e.distanceToPoint(b)<0)return!1;return!0}},{key:"containsPoint",value:function(t){var i,e=this.planes,n=!0;for(i=0;i<6;++i)if(e[i].distanceToPoint(t)<0){n=!1;break}return n}}]),t}(),P=new s,F=new s,T=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new s,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new s;i(this,t),this.start=e,this.end=n}return n(t,[{key:"set",value:function(t,i){return this.start.copy(t),this.end.copy(i),this}},{key:"copy",value:function(t){return this.start.copy(t.start),this.end.copy(t.end),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"getCenter",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new s;return t.addVectors(this.start,this.end).multiplyScalar(.5)}},{key:"delta",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new s;return t.subVectors(this.end,this.start)}},{key:"lengthSquared",value:function(){return this.start.distanceToSquared(this.end)}},{key:"length",value:function(){return this.start.distanceTo(this.end)}},{key:"at",value:function(t,i){return this.delta(i).multiplyScalar(t).add(this.start)}},{key:"closestPointToPointParameter",value:function(t,i){P.subVectors(t,this.start),F.subVectors(this.end,this.start);var e=F.dot(F),n=F.dot(P);return i?Math.min(Math.max(n/e,0),1):n/e}},{key:"closestPointToPoint",value:function(t){var i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new s,n=this.closestPointToPointParameter(t,i);return this.delta(e).multiplyScalar(n).add(this.start)}},{key:"equals",value:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}}]),t}(),V=new s,C=new s,A=new s,X=function(){function t(){i(this,t),this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return n(t,[{key:"set",value:function(t,i,e,n,s,h,r,a,u,o,l,y,c,v,m,x){var f=this.elements;return f[0]=t,f[4]=i,f[8]=e,f[12]=n,f[1]=s,f[5]=h,f[9]=r,f[13]=a,f[2]=u,f[6]=o,f[10]=l,f[14]=y,f[3]=c,f[7]=v,f[11]=m,f[15]=x,this}},{key:"identity",value:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}},{key:"copy",value:function(t){var i=t.elements,e=this.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}},{key:"clone",value:function(){return(new this.constructor).fromArray(this.elements)}},{key:"fromArray",value:function(t){var i,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;for(i=0;i<16;++i)n[i]=t[i+e];return this}},{key:"toArray",value:function(){var t,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;for(t=0;t<16;++t)i[t+e]=n[t];return i}},{key:"getMaxScaleOnAxis",value:function(){var t=this.elements,i=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],e=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(i,e,n))}},{key:"copyPosition",value:function(t){var i=this.elements,e=t.elements;return i[12]=e[12],i[13]=e[13],i[14]=e[14],this}},{key:"setPosition",value:function(t){var i=this.elements;return i[12]=t.x,i[13]=t.y,i[14]=t.z,this}},{key:"extractBasis",value:function(t,i,e){return t.setFromMatrixColumn(this,0),i.setFromMatrixColumn(this,1),e.setFromMatrixColumn(this,2),this}},{key:"makeBasis",value:function(t,i,e){return this.set(t.x,i.x,e.x,0,t.y,i.y,e.y,0,t.z,i.z,e.z,0,0,0,0,1),this}},{key:"extractRotation",value:function(t){var i=this.elements,e=t.elements,n=1/V.setFromMatrixColumn(t,0).length(),s=1/V.setFromMatrixColumn(t,1).length(),h=1/V.setFromMatrixColumn(t,2).length();return i[0]=e[0]*n,i[1]=e[1]*n,i[2]=e[2]*n,i[3]=0,i[4]=e[4]*s,i[5]=e[5]*s,i[6]=e[6]*s,i[7]=0,i[8]=e[8]*h,i[9]=e[9]*h,i[10]=e[10]*h,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,this}},{key:"makeRotationFromEuler",value:function(t){var i,e,n,s,h,r,a,u,o,l,y,c,v=this.elements,m=t.x,x=t.y,d=t.z,k=Math.cos(m),z=Math.sin(m),M=Math.cos(x),p=Math.sin(x),w=Math.cos(d),g=Math.sin(d);switch(t.order){case f.XYZ:i=k*w,e=k*g,n=z*w,s=z*g,v[0]=M*w,v[4]=-M*g,v[8]=p,v[1]=e+n*p,v[5]=i-s*p,v[9]=-z*M,v[2]=s-i*p,v[6]=n+e*p,v[10]=k*M;break;case f.YXZ:h=M*w,r=M*g,a=p*w,u=p*g,v[0]=h+u*z,v[4]=a*z-r,v[8]=k*p,v[1]=k*g,v[5]=k*w,v[9]=-z,v[2]=r*z-a,v[6]=u+h*z,v[10]=k*M;break;case f.ZXY:h=M*w,r=M*g,a=p*w,u=p*g,v[0]=h-u*z,v[4]=-k*g,v[8]=a+r*z,v[1]=r+a*z,v[5]=k*w,v[9]=u-h*z,v[2]=-k*p,v[6]=z,v[10]=k*M;break;case f.ZYX:i=k*w,e=k*g,n=z*w,s=z*g,v[0]=M*w,v[4]=n*p-e,v[8]=i*p+s,v[1]=M*g,v[5]=s*p+i,v[9]=e*p-n,v[2]=-p,v[6]=z*M,v[10]=k*M;break;case f.YZX:o=k*M,l=k*p,y=z*M,c=z*p,v[0]=M*w,v[4]=c-o*g,v[8]=y*g+l,v[1]=g,v[5]=k*w,v[9]=-z*w,v[2]=-p*w,v[6]=l*g+y,v[10]=o-c*g;break;case f.XZY:o=k*M,l=k*p,y=z*M,c=z*p,v[0]=M*w,v[4]=-g,v[8]=p*w,v[1]=o*g+c,v[5]=k*w,v[9]=l*g-y,v[2]=y*g-l,v[6]=z*w,v[10]=c*g+o}return v[3]=0,v[7]=0,v[11]=0,v[12]=0,v[13]=0,v[14]=0,v[15]=1,this}},{key:"makeRotationFromQuaternion",value:function(t){return this.compose(V.set(0,0,0),t,C.set(1,1,1))}},{key:"lookAt",value:function(t,i,e){var n=this.elements,s=V,h=C,r=A;return r.subVectors(t,i),0===r.lengthSquared()&&(r.z=1),r.normalize(),s.crossVectors(e,r),0===s.lengthSquared()&&(1===Math.abs(e.z)?r.x+=1e-4:r.z+=1e-4,r.normalize(),s.crossVectors(e,r)),s.normalize(),h.crossVectors(r,s),n[0]=s.x,n[4]=h.x,n[8]=r.x,n[1]=s.y,n[5]=h.y,n[9]=r.y,n[2]=s.z,n[6]=h.z,n[10]=r.z,this}},{key:"multiplyMatrices",value:function(t,i){var e=this.elements,n=t.elements,s=i.elements,h=n[0],r=n[4],a=n[8],u=n[12],o=n[1],l=n[5],y=n[9],c=n[13],v=n[2],m=n[6],x=n[10],f=n[14],d=n[3],k=n[7],z=n[11],M=n[15],p=s[0],w=s[4],g=s[8],S=s[12],b=s[1],q=s[5],P=s[9],F=s[13],T=s[2],V=s[6],C=s[10],A=s[14],X=s[3],Y=s[7],Z=s[11],B=s[15];return e[0]=h*p+r*b+a*T+u*X,e[4]=h*w+r*q+a*V+u*Y,e[8]=h*g+r*P+a*C+u*Z,e[12]=h*S+r*F+a*A+u*B,e[1]=o*p+l*b+y*T+c*X,e[5]=o*w+l*q+y*V+c*Y,e[9]=o*g+l*P+y*C+c*Z,e[13]=o*S+l*F+y*A+c*B,e[2]=v*p+m*b+x*T+f*X,e[6]=v*w+m*q+x*V+f*Y,e[10]=v*g+m*P+x*C+f*Z,e[14]=v*S+m*F+x*A+f*B,e[3]=d*p+k*b+z*T+M*X,e[7]=d*w+k*q+z*V+M*Y,e[11]=d*g+k*P+z*C+M*Z,e[15]=d*S+k*F+z*A+M*B,this}},{key:"multiply",value:function(t){return this.multiplyMatrices(this,t)}},{key:"premultiply",value:function(t){return this.multiplyMatrices(t,this)}},{key:"multiplyScalar",value:function(t){var i=this.elements;return i[0]*=t,i[4]*=t,i[8]*=t,i[12]*=t,i[1]*=t,i[5]*=t,i[9]*=t,i[13]*=t,i[2]*=t,i[6]*=t,i[10]*=t,i[14]*=t,i[3]*=t,i[7]*=t,i[11]*=t,i[15]*=t,this}},{key:"determinant",value:function(){var t=this.elements,i=t[0],e=t[4],n=t[8],s=t[12],h=t[1],r=t[5],a=t[9],u=t[13],o=t[2],l=t[6],y=t[10],c=t[14],v=i*r,m=i*a,x=i*u,f=e*h,d=e*a,k=e*u,z=n*h,M=n*r,p=n*u,w=s*h,g=s*r,S=s*a;return t[3]*(S*l-p*l-g*y+k*y+M*c-d*c)+t[7]*(m*c-x*y+w*y-z*c+p*o-S*o)+t[11]*(x*l-v*c-w*l+f*c+g*o-k*o)+t[15]*(-M*o-m*l+v*y+z*l-f*y+d*o)}},{key:"getInverse",value:function(t){var i,e=this.elements,n=t.elements,s=n[0],h=n[1],r=n[2],a=n[3],u=n[4],o=n[5],l=n[6],y=n[7],c=n[8],v=n[9],m=n[10],x=n[11],f=n[12],d=n[13],k=n[14],z=n[15],M=v*k*y-d*m*y+d*l*x-o*k*x-v*l*z+o*m*z,p=f*m*y-c*k*y-f*l*x+u*k*x+c*l*z-u*m*z,w=c*d*y-f*v*y+f*o*x-u*d*x-c*o*z+u*v*z,g=f*v*l-c*d*l-f*o*m+u*d*m+c*o*k-u*v*k,S=s*M+h*p+r*w+a*g;return 0!==S?(i=1/S,e[0]=M*i,e[1]=(d*m*a-v*k*a-d*r*x+h*k*x+v*r*z-h*m*z)*i,e[2]=(o*k*a-d*l*a+d*r*y-h*k*y-o*r*z+h*l*z)*i,e[3]=(v*l*a-o*m*a-v*r*y+h*m*y+o*r*x-h*l*x)*i,e[4]=p*i,e[5]=(c*k*a-f*m*a+f*r*x-s*k*x-c*r*z+s*m*z)*i,e[6]=(f*l*a-u*k*a-f*r*y+s*k*y+u*r*z-s*l*z)*i,e[7]=(u*m*a-c*l*a+c*r*y-s*m*y-u*r*x+s*l*x)*i,e[8]=w*i,e[9]=(f*v*a-c*d*a-f*h*x+s*d*x+c*h*z-s*v*z)*i,e[10]=(u*d*a-f*o*a+f*h*y-s*d*y-u*h*z+s*o*z)*i,e[11]=(c*o*a-u*v*a-c*h*y+s*v*y+u*h*x-s*o*x)*i,e[12]=g*i,e[13]=(c*d*r-f*v*r+f*h*m-s*d*m-c*h*k+s*v*k)*i,e[14]=(f*o*r-u*d*r-f*h*l+s*d*l+u*h*k-s*o*k)*i,e[15]=(u*v*r-c*o*r+c*h*l-s*v*l-u*h*m+s*o*m)*i):this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),this}},{key:"transpose",value:function(){var t,i=this.elements;return t=i[1],i[1]=i[4],i[4]=t,t=i[2],i[2]=i[8],i[8]=t,t=i[6],i[6]=i[9],i[9]=t,t=i[3],i[3]=i[12],i[12]=t,t=i[7],i[7]=i[13],i[13]=t,t=i[11],i[11]=i[14],i[14]=t,this}},{key:"scale",value:function(t,i,e){var n=this.elements;return n[0]*=t,n[4]*=i,n[8]*=e,n[1]*=t,n[5]*=i,n[9]*=e,n[2]*=t,n[6]*=i,n[10]*=e,n[3]*=t,n[7]*=i,n[11]*=e,this}},{key:"makeScale",value:function(t,i,e){return this.set(t,0,0,0,0,i,0,0,0,0,e,0,0,0,0,1),this}},{key:"makeTranslation",value:function(t,i,e){return this.set(1,0,0,t,0,1,0,i,0,0,1,e,0,0,0,1),this}},{key:"makeRotationX",value:function(t){var i=Math.cos(t),e=Math.sin(t);return this.set(1,0,0,0,0,i,-e,0,0,e,i,0,0,0,0,1),this}},{key:"makeRotationY",value:function(t){var i=Math.cos(t),e=Math.sin(t);return this.set(i,0,e,0,0,1,0,0,-e,0,i,0,0,0,0,1),this}},{key:"makeRotationZ",value:function(t){var i=Math.cos(t),e=Math.sin(t);return this.set(i,-e,0,0,e,i,0,0,0,0,1,0,0,0,0,1),this}},{key:"makeRotationAxis",value:function(t,i){var e=Math.cos(i),n=Math.sin(i),s=1-e,h=t.x,r=t.y,a=t.z,u=s*h,o=s*r;return this.set(u*h+e,u*r-n*a,u*a+n*r,0,u*r+n*a,o*r+e,o*a-n*h,0,u*a-n*r,o*a+n*h,s*a*a+e,0,0,0,0,1),this}},{key:"makeShear",value:function(t,i,e){return this.set(1,i,e,0,t,1,e,0,t,i,1,0,0,0,0,1),this}},{key:"compose",value:function(t,i,e){var n=this.elements,s=i.x,h=i.y,r=i.z,a=i.w,u=s+s,o=h+h,l=r+r,y=s*u,c=s*o,v=s*l,m=h*o,x=h*l,f=r*l,d=a*u,k=a*o,z=a*l,M=e.x,p=e.y,w=e.z;return n[0]=(1-(m+f))*M,n[1]=(c+z)*M,n[2]=(v-k)*M,n[3]=0,n[4]=(c-z)*p,n[5]=(1-(y+f))*p,n[6]=(x+d)*p,n[7]=0,n[8]=(v+k)*w,n[9]=(x-d)*w,n[10]=(1-(y+m))*w,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}},{key:"decompose",value:function(t,i,e){var n=this.elements,s=n[0],h=n[1],r=n[2],a=n[4],u=n[5],o=n[6],l=n[8],y=n[9],c=n[10],v=this.determinant(),m=V.set(s,h,r).length()*(v<0?-1:1),x=V.set(a,u,o).length(),f=V.set(l,y,c).length(),d=1/m,k=1/x,z=1/f;return t.x=n[12],t.y=n[13],t.z=n[14],n[0]*=d,n[1]*=d,n[2]*=d,n[4]*=k,n[5]*=k,n[6]*=k,n[8]*=z,n[9]*=z,n[10]*=z,i.setFromRotationMatrix(this),n[0]=s,n[1]=h,n[2]=r,n[4]=a,n[5]=u,n[6]=o,n[8]=l,n[9]=y,n[10]=c,e.x=m,e.y=x,e.z=f,this}},{key:"makePerspective",value:function(t,i,e,n,s,h){var r=this.elements,a=2*s/(i-t),u=2*s/(e-n),o=(i+t)/(i-t),l=(e+n)/(e-n),y=-(h+s)/(h-s),c=-2*h*s/(h-s);return r[0]=a,r[4]=0,r[8]=o,r[12]=0,r[1]=0,r[5]=u,r[9]=l,r[13]=0,r[2]=0,r[6]=0,r[10]=y,r[14]=c,r[3]=0,r[7]=0,r[11]=-1,r[15]=0,this}},{key:"makeOrthographic",value:function(t,i,e,n,s,h){var r=this.elements,a=1/(i-t),u=1/(e-n),o=1/(h-s),l=(i+t)*a,y=(e+n)*u,c=(h+s)*o;return r[0]=2*a,r[4]=0,r[8]=0,r[12]=-l,r[1]=0,r[5]=2*u,r[9]=0,r[13]=-y,r[2]=0,r[6]=0,r[10]=-2*o,r[14]=-c,r[3]=0,r[7]=0,r[11]=0,r[15]=1,this}},{key:"equals",value:function(t){var i,e=this.elements,n=t.elements,s=!0;for(i=0;s&&i<16;++i)e[i]!==n[i]&&(s=!1);return s}}]),t}(),Y=[new s,new s,new s,new s],Z=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new s,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new s(0,0,-1);i(this,t),this.origin=e,this.direction=n}return n(t,[{key:"set",value:function(t,i){return this.origin.copy(t),this.direction.copy(i),this}},{key:"copy",value:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"at",value:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new s;return i.copy(this.direction).multiplyScalar(t).add(this.origin)}},{key:"lookAt",value:function(t){return this.direction.copy(t).sub(this.origin).normalize(),this}},{key:"recast",value:function(t){return this.origin.copy(this.at(t,Y[0])),this}},{key:"closestPointToPoint",value:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new s,e=i.subVectors(t,this.origin).dot(this.direction);return e>=0?i.copy(this.direction).multiplyScalar(e).add(this.origin):i.copy(this.origin)}},{key:"distanceSquaredToPoint",value:function(t){var i=Y[0].subVectors(t,this.origin).dot(this.direction);return i<0?this.origin.distanceToSquared(t):Y[0].copy(this.direction).multiplyScalar(i).add(this.origin).distanceToSquared(t)}},{key:"distanceToPoint",value:function(t){return Math.sqrt(this.distanceSquaredToPoint(t))}},{key:"distanceToPlane",value:function(t){var i=t.normal.dot(this.direction),e=0!==i?-(this.origin.dot(t.normal)+t.constant)/i:0===t.distanceToPoint(this.origin)?0:-1;return e>=0?e:null}},{key:"distanceSquaredToSegment",value:function(t,i,e,n){var s,h,r,a,u,o=Y[0].copy(t).add(i).multiplyScalar(.5),l=Y[1].copy(i).sub(t).normalize(),y=Y[2].copy(this.origin).sub(o),c=.5*t.distanceTo(i),v=-this.direction.dot(l),m=y.dot(this.direction),x=-y.dot(l),f=y.lengthSq(),d=Math.abs(1-v*v);return d>0?(h=v*m-x,r=c*d,(s=v*x-m)>=0?h>=-r?h<=r?u=(s*=a=1/d)*(s+v*(h*=a)+2*m)+h*(v*s+h+2*x)+f:(h=c,u=-(s=Math.max(0,-(v*h+m)))*s+h*(h+2*x)+f):(h=-c,u=-(s=Math.max(0,-(v*h+m)))*s+h*(h+2*x)+f):h<=-r?u=-(s=Math.max(0,-(-v*c+m)))*s+(h=s>0?-c:Math.min(Math.max(-c,-x),c))*(h+2*x)+f:h<=r?(s=0,u=(h=Math.min(Math.max(-c,-x),c))*(h+2*x)+f):u=-(s=Math.max(0,-(v*c+m)))*s+(h=s>0?c:Math.min(Math.max(-c,-x),c))*(h+2*x)+f):(h=v>0?-c:c,u=-(s=Math.max(0,-(v*h+m)))*s+h*(h+2*x)+f),void 0!==e&&e.copy(this.direction).multiplyScalar(s).add(this.origin),void 0!==n&&n.copy(l).multiplyScalar(h).add(o),u}},{key:"intersectSphere",value:function(t){var i,e,n,h=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new s,r=Y[0].subVectors(t.center,this.origin),a=r.dot(this.direction),u=r.dot(r)-a*a,o=t.radius*t.radius,l=null;return u<=o&&(n=a+(i=Math.sqrt(o-u)),((e=a-i)>=0||n>=0)&&(l=e<0?this.at(n,h):this.at(e,h))),l}},{key:"intersectsSphere",value:function(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}},{key:"intersectPlane",value:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new s,e=this.distanceToPlane(t);return null===e?null:this.at(e,i)}},{key:"intersectsPlane",value:function(t){var i=t.distanceToPoint(this.origin);return 0===i||t.normal.dot(this.direction)*i<0}},{key:"intersectBox",value:function(t){var i,e,n,h,r,a,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new s,o=this.origin,l=this.direction,y=t.min,c=t.max,v=1/l.x,m=1/l.y,x=1/l.z,f=null;return v>=0?(i=(y.x-o.x)*v,e=(c.x-o.x)*v):(i=(c.x-o.x)*v,e=(y.x-o.x)*v),m>=0?(n=(y.y-o.y)*m,h=(c.y-o.y)*m):(n=(c.y-o.y)*m,h=(y.y-o.y)*m),i<=h&&n<=e&&((n>i||i!=i)&&(i=n),(h<e||e!=e)&&(e=h),x>=0?(r=(y.z-o.z)*x,a=(c.z-o.z)*x):(r=(c.z-o.z)*x,a=(y.z-o.z)*x),i<=a&&r<=e&&((r>i||i!=i)&&(i=r),(a<e||e!=e)&&(e=a),e>=0&&(f=this.at(i>=0?i:e,u)))),f}},{key:"intersectsBox",value:function(t){return null!==this.intersectBox(t,Y[0])}},{key:"intersectTriangle",value:function(t,i,e,n,s){var h,r,a,u,o,l=this.direction,y=Y[0],c=Y[1],v=Y[2],m=Y[3],x=null;return c.subVectors(i,t),v.subVectors(e,t),m.crossVectors(c,v),0===(h=l.dot(m))||n&&h>0||(h>0?r=1:(r=-1,h=-h),y.subVectors(this.origin,t),(a=r*l.dot(v.crossVectors(y,v)))>=0&&(u=r*l.dot(c.cross(y)))>=0&&a+u<=h&&(o=-r*y.dot(m))>=0&&(x=this.at(o/h,s))),x}},{key:"applyMatrix4",value:function(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}},{key:"equals",value:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}}]),t}(),B=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;i(this,t),this.radius=e,this.phi=n,this.theta=s}return n(t,[{key:"set",value:function(t,i,e){return this.radius=t,this.phi=i,this.theta=e,this}},{key:"copy",value:function(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"makeSafe",value:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}},{key:"setFromVector3",value:function(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}},{key:"setFromCartesianCoords",value:function(t,i,e){return this.radius=Math.sqrt(t*t+i*i+e*e),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,e),this.phi=Math.acos(Math.min(Math.max(i/this.radius,-1),1))),this}}]),t}(),E=function(){function t(){i(this,t),this.elements=new Float32Array([1,0,0,1,0,1])}return n(t,[{key:"set",value:function(t,i,e,n,s,h){var r=this.elements;return r[0]=t,r[1]=i,r[3]=n,r[2]=e,r[4]=s,r[5]=h,this}},{key:"identity",value:function(){return this.set(1,0,0,1,0,1),this}},{key:"copy",value:function(t){var i=t.elements;return this.set(i[0],i[1],i[2],i[3],i[4],i[5]),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"toMatrix3",value:function(t){var i=t.elements;t.set(i[0],i[1],i[2],i[1],i[3],i[4],i[2],i[4],i[5])}},{key:"add",value:function(t){var i=this.elements,e=t.elements;return i[0]+=e[0],i[1]+=e[1],i[3]+=e[3],i[2]+=e[2],i[4]+=e[4],i[5]+=e[5],this}},{key:"norm",value:function(){var t=this.elements,i=t[1]*t[1],e=t[2]*t[2],n=t[4]*t[4];return Math.sqrt(t[0]*t[0]+i+e+i+t[3]*t[3]+n+e+n+t[5]*t[5])}},{key:"off",value:function(){var t=this.elements;return Math.sqrt(2*(t[1]*t[1]+t[2]*t[2]+t[4]*t[4]))}},{key:"applyToVector3",value:function(t){var i=t.x,e=t.y,n=t.z,s=this.elements;return t.x=s[0]*i+s[1]*e+s[2]*n,t.y=s[1]*i+s[3]*e+s[4]*n,t.z=s[2]*i+s[4]*e+s[5]*n,t}},{key:"equals",value:function(t){var i,e=this.elements,n=t.elements,s=!0;for(i=0;s&&i<6;++i)e[i]!==n[i]&&(s=!1);return s}}],[{key:"calculateIndex",value:function(t,i){return 3-(3-t)*(2-t)/2+i}}]),t}(),R=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,h=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;i(this,t),this.x=e,this.y=n,this.z=s,this.w=h}return n(t,[{key:"set",value:function(t,i,e,n){return this.x=t,this.y=i,this.z=e,this.w=n,this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}},{key:"copy",value:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this}},{key:"clone",value:function(){return new this.constructor(this.x,this.y,this.z,this.w)}},{key:"fromArray",value:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=t[i],this.y=t[i+1],this.z=t[i+2],this.w=t[i+3],this}},{key:"toArray",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t[i]=this.x,t[i+1]=this.y,t[i+2]=this.z,t[i+3]=this.w,t}},{key:"setAxisAngleFromQuaternion",value:function(t){this.w=2*Math.acos(t.w);var i=Math.sqrt(1-t.w*t.w);return i<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/i,this.y=t.y/i,this.z=t.z/i),this}},{key:"setAxisAngleFromRotationMatrix",value:function(t){var i,e,n,s,h,r,a,u,o,l,y,c=.01,v=.1,m=t.elements,x=m[0],f=m[4],d=m[8],k=m[1],z=m[5],M=m[9],p=m[2],w=m[6],g=m[10];return Math.abs(f-k)<c&&Math.abs(d-p)<c&&Math.abs(M-w)<c?Math.abs(f+k)<v&&Math.abs(d+p)<v&&Math.abs(M+w)<v&&Math.abs(x+z+g-3)<v?this.set(1,0,0,0):(i=Math.PI,a=(g+1)/2,u=(f+k)/4,o=(d+p)/4,l=(M+w)/4,(h=(x+1)/2)>(r=(z+1)/2)&&h>a?h<c?(e=0,n=.707106781,s=.707106781):(n=u/(e=Math.sqrt(h)),s=o/e):r>a?r<c?(e=.707106781,n=0,s=.707106781):(e=u/(n=Math.sqrt(r)),s=l/n):a<c?(e=.707106781,n=.707106781,s=0):(e=o/(s=Math.sqrt(a)),n=l/s),this.set(e,n,s,i)):(y=Math.sqrt((w-M)*(w-M)+(d-p)*(d-p)+(k-f)*(k-f)),Math.abs(y)<.001&&(y=1),this.x=(w-M)/y,this.y=(d-p)/y,this.z=(k-f)/y,this.w=Math.acos((x+z+g-1)/2)),this}},{key:"add",value:function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}},{key:"addScalar",value:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}},{key:"addVectors",value:function(t,i){return this.x=t.x+i.x,this.y=t.y+i.y,this.z=t.z+i.z,this.w=t.w+i.w,this}},{key:"addScaledVector",value:function(t,i){return this.x+=t.x*i,this.y+=t.y*i,this.z+=t.z*i,this.w+=t.w*i,this}},{key:"sub",value:function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}},{key:"subScalar",value:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}},{key:"subVectors",value:function(t,i){return this.x=t.x-i.x,this.y=t.y-i.y,this.z=t.z-i.z,this.w=t.w-i.w,this}},{key:"multiply",value:function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}},{key:"multiplyScalar",value:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}},{key:"multiplyVectors",value:function(t,i){return this.x=t.x*i.x,this.y=t.y*i.y,this.z=t.z*i.z,this.w=t.w*i.w,this}},{key:"divide",value:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}},{key:"divideScalar",value:function(t){return this.x/=t,this.y/=t,this.z/=t,this.w/=t,this}},{key:"applyMatrix4",value:function(t){var i=this.x,e=this.y,n=this.z,s=this.w,h=t.elements;return this.x=h[0]*i+h[4]*e+h[8]*n+h[12]*s,this.y=h[1]*i+h[5]*e+h[9]*n+h[13]*s,this.z=h[2]*i+h[6]*e+h[10]*n+h[14]*s,this.w=h[3]*i+h[7]*e+h[11]*n+h[15]*s,this}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}},{key:"dot",value:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}},{key:"lengthSquared",value:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}},{key:"manhattanDistanceTo",value:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)+Math.abs(this.w-t.w)}},{key:"distanceToSquared",value:function(t){var i=this.x-t.x,e=this.y-t.y,n=this.z-t.z,s=this.w-t.w;return i*i+e*e+n*n+s*s}},{key:"distanceTo",value:function(t){return Math.sqrt(this.distanceToSquared(t))}},{key:"normalize",value:function(){return this.divideScalar(this.length())}},{key:"setLength",value:function(t){return this.normalize().multiplyScalar(t)}},{key:"min",value: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.w=Math.min(this.w,t.w),this}},{key:"max",value: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.w=Math.max(this.w,t.w),this}},{key:"clamp",value:function(t,i){return this.x=Math.max(t.x,Math.min(i.x,this.x)),this.y=Math.max(t.y,Math.min(i.y,this.y)),this.z=Math.max(t.z,Math.min(i.z,this.z)),this.w=Math.max(t.w,Math.min(i.w,this.w)),this}},{key:"floor",value:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}},{key:"ceil",value:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}},{key:"round",value:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}},{key:"lerp",value:function(t,i){return this.x+=(t.x-this.x)*i,this.y+=(t.y-this.y)*i,this.z+=(t.z-this.z)*i,this.w+=(t.w-this.w)*i,this}},{key:"lerpVectors",value:function(t,i,e){return this.subVectors(i,t).multiplyScalar(e).add(t)}},{key:"equals",value:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}}]),t}();t.Box2=v,t.Box3=a,t.Cylindrical=m,t.Euler=p,t.Frustum=q,t.Line3=T,t.Matrix3=x,t.Matrix4=X,t.Plane=S,t.Quaternion=d,t.Ray=Z,t.RotationOrder=f,t.Sphere=l,t.Spherical=B,t.SymmetricMatrix3=E,t.Vector2=y,t.Vector3=s,t.Vector4=R,Object.defineProperty(t,"__esModule",{value:!0})}));
