From 2b694497900f3c9e0584ce43db030430e303c2d7 Mon Sep 17 00:00:00 2001 From: Evgeny Blokhin Date: Fri, 13 Nov 2015 18:00:28 +0100 Subject: [PATCH] Update player.html engine to version 0.13.5 --- engines/player.html/player.html | 1098 ++++++++++++++++--------------- 1 file changed, 569 insertions(+), 529 deletions(-) diff --git a/engines/player.html/player.html b/engines/player.html/player.html index 57dfac5..d9fec08 100755 --- a/engines/player.html/player.html +++ b/engines/player.html/player.html @@ -1,13 +1,7 @@ @@ -16,16 +10,28 @@ - +Materials Informatics HTML5 Player @@ -35,527 +41,561 @@ Available via the MIT or new BSD license. see: http://github.com/requirejs/domReady for details */ -'use strict';var player=function(J){function G(w){if(P[w])return P[w].exports;var l=P[w]={exports:{},id:w,loaded:!1};J[w].call(l.exports,l,l.exports,G);l.loaded=!0;return l.exports}var P={};G.m=J;G.c=P;G.p="";return G(0)}([function(J,G,P){!function(){var w=[P(1),P(2),P(3),P(4),P(5)];(function(l,h,r,c,a){function b(a){for(var b=[0,0,1],d=[1,0,0],b=c.divide(b,c.norm(b)),d=c.subtract(d,c.multiply(c.dot(d,b),b)),d=c.divide(d,c.norm(d)),e=c.cross(b,d),f=a.cell.alpha*Math.PI/180,k=a.cell.beta*Math.PI/180, -g=a.cell.gamma*Math.PI/180,m=a.cell.b,n=a.cell.c,q=c.multiply(a.cell.a,[1,0,0]),m=c.multiply(m,[c.cos(g),c.sin(g),0]),u=c.cos(k),f=c.divide(c.subtract(c.cos(f),c.multiply(c.cos(k),c.cos(g))),c.sin(g)),k=c.sqrt(c.subtract(c.subtract(1,c.multiply(u,u)),c.multiply(f,f))),n=c.multiply(n,[u,f,k]),q=c.dotMultiply([q,m,n],[d,e,b]),e=[],d=a.atoms.length,b=0;ba = "+a.a+" Å
b = "+a.b+" Å
c = "+a.c+" Å
α = "+a.alpha+"°
β = "+a.beta+"°
γ = "+a.gamma+"°
";document.body.appendChild(b);(b=document.getElementById("optionpanel"))&&b.parentNode.removeChild(b);a=document.createElement("div");a.setAttribute("id","optionpanel"); -a.innerHTML="";a.innerHTML+=" ";a.innerHTML+=" ";if(v.obj3d.overlayed)for(var d in v.obj3d.overlayed)a.innerHTML+=" ";document.body.appendChild(a);a.onclick=function(a){a=a||window.event;v.current_overlay=(a.target||a.srcElement).id.replace("optionpanel_","");var b=v.scene.getObjectByName("atoms3d"),b=b.children,d=b.filter(function(a){return"label"==a.name}),c=d.length;for(a=0;ad;d++)a=Math.round(1E3*parseFloat(v.obj3d.cell[d][0]))/10,b=Math.round(1E3*parseFloat(v.obj3d.cell[d][1]))/10,g=Math.round(1E3*parseFloat(v.obj3d.cell[d][2]))/10,c.push([a,b,g]),k=new D.Geometry,k.vertices.push(new D.Vector3(0,0,0)),k.vertices.push(new D.Vector3(a,b,g)),0==d&&(q=10027008),1== -d&&(q=39168),2==d&&(q=153),v.atombox.add(new D.Line(k,new D.LineBasicMaterial({color:q})));new D.LineBasicMaterial({color:13421772});d=[c[0][0]+c[1][0],c[0][1]+c[1][1],c[0][2]+c[1][2]];a=[c[0][0]+c[2][0],c[0][1]+c[2][1],c[0][2]+c[2][2]];b=[d[0]+c[2][0],d[1]+c[2][1],d[2]+c[2][2]];g=[c[1][0]+c[2][0],c[1][1]+c[2][1],c[1][2]+c[2][2]];q=[];q.push([c[0],d]);q.push([c[0],a]);q.push([c[1],g]);q.push([c[1],d]);q.push([c[2],g]);q.push([c[2],a]);q.push([d,b]);q.push([a,b]);q.push([b,g]);a=q.length;for(d=0;d< -a;d++)e(q[d][0],q[d][1])}v.atombox.name="atoms3d";v.scene.add(v.atombox);m()}function k(){v.loaded=!0;v.container=document.createElement("div");v.container.style.backgroundColor="#ffffff";document.body.appendChild(v.container);v.scene=new D.Scene;v.camera=new D.OrthographicCamera(1.5*-window.innerWidth,1.5*window.innerWidth,1.5*-window.innerHeight,1.5*window.innerHeight,-2E3,2E3);v.camera.position.set(0,0,1);var a=new D.AmbientLight(10066329);v.scene.add(a);a=new D.PointLight(6710886,1);a.position.set(500, -500,500);v.scene.add(a);v.renderer=new D.CanvasRenderer;v.renderer.setClearColor(16777215,1);v.renderer.setSize(window.innerWidth,window.innerHeight);v.container.appendChild(v.renderer.domElement);a=document.createElement("div");a.setAttribute("id","zoompanel");document.body.appendChild(a);a.onclick=function(a){a=a||window.event;a.cancelBubble?a.cancelBubble=!0:(a.stopPropagation(),a.preventDefault());a=333*(79<(a.pageY?a.pageY:a.clientY)?-1:1);var b=window.innerHeight/window.innerWidth;v.camera.left+= -a;v.camera.right-=a;v.camera.top+=a*b;v.camera.bottom-=a*b;v.camera.updateProjectionMatrix()};v.controls=new D.OrthographicTrackballControls(v.camera);v.controls.staticMoving=!0;g()}function m(){requestAnimationFrame(m);v.renderer.render(v.scene,v.camera);v.controls.update()}function u(){var a=document.location.hash.substr(1);if(-1==a.indexOf("://"))return alert("Error: not a valid url!");n(a)}function p(){if(window.parent&&window.parent.cifdata)W(window.parent.cifdata,!1);else if(window.FileReader){var a= -document.getElementById("landing");a&&a.parentNode.removeChild(a);a=document.createElement("div");a.setAttribute("id","landing");a.innerHTML="Please drag & drop a CIF file here
or display example.";document.body.appendChild(a);document.getElementById("play_demo").onclick=s}else s()}function s(a){a=a||window.event;a.cancelBubble?a.cancelBubble=!0:(a.stopPropagation(),a.preventDefault());W(v.sample,!1)}function q(){var a=document.location.hash.substr(1);-1!=a.indexOf("://")&& -window.open(a,"d_"+Math.random())}function n(a){var b=document.createElement("a");b.href=a;b.hostname!==window.location.hostname&&(a=v.webproxy+"?url="+a);var d=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");d.onreadystatechange=function(){4==d.readyState&&(200==d.status?W(d.responseText,!0):(alert("Error: HTTP "+d.status+" status received during retrieving data from the server"),v.loaded||p()))};d.open("GET",a);d.setRequestHeader("If-Modified-Since","Sat, 1 Jan 2000 00:00:00 GMT"); -d.send(1)}function W(a,b){var c=document.getElementById("dpanel");c&&(c.style.display="none");if(-1r.length)h=r.length;h-=l.length;r=r.indexOf(l,h);return-1!==r&&r===h};String.prototype.trim= -function(){return this.replace(/^\s+|\s+$/g,"")};Object.keys||(Object.keys=function(){var l=Object.prototype.hasOwnProperty,h=!{toString:null}.propertyIsEnumerable("toString"),r="toString toLocaleString valueOf hasOwnProperty isPrototypeOf propertyIsEnumerable constructor".split(" "),c=r.length;return function(a){if("object"!==typeof a&&("function"!==typeof a||null===a))throw new TypeError("Object.keys called on non-object");var b=[],d;for(d in a)l.call(a,d)&&b.push(d);if(h)for(d=0;da?-1:0>16&255)/255;this.g= -(a>>8&255)/255;this.b=(a&255)/255;return this},setRGB:function(a,b,d){this.r=a;this.g=b;this.b=d;return this},setHSL:function(){function a(a,d,c){0>c&&(c+=1);1c?d:c<2/3?a+6*(d-a)*(2/3-c):a}return function(b,d,e){b=c.Math.euclideanModulo(b,1);d=c.Math.clamp(d,0,1);e=c.Math.clamp(e,0,1);0===d?this.r=this.g=this.b=e:(d=.5>=e?e*(1+d):e+d-e*d,e=2*e-d,this.r=a(e,d,b+1/3),this.g=a(e,d,b),this.b=a(e,d,b-1/3));return this}}(),setStyle:function(a){var b=function(b){b= -parseFloat(b);1>b&&console.warn("THREE.Color: Alpha component of color "+a+" will be ignored.");return b},d;if(d=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(a)){var e=d[2];switch(d[1]){case "rgb":if(d=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*$/.exec(e))return this.r=Math.min(255,parseInt(d[1],10))/255,this.g=Math.min(255,parseInt(d[2],10))/255,this.b=Math.min(255,parseInt(d[3],10))/255,this;if(d=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*$/.exec(e))return this.r=Math.min(100,parseInt(d[1],10))/100,this.g=Math.min(100, -parseInt(d[2],10))/100,this.b=Math.min(100,parseInt(d[3],10))/100,this;break;case "rgba":if(d=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([0-9]*\.?[0-9]+)\s*$/.exec(e))return this.r=Math.min(255,parseInt(d[1],10))/255,this.g=Math.min(255,parseInt(d[2],10))/255,this.b=Math.min(255,parseInt(d[3],10))/255,b(d[4]),this;if(d=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*([0-9]*\.?[0-9]+)\s*$/.exec(e))return this.r=Math.min(100,parseInt(d[1],10))/100,this.g=Math.min(100,parseInt(d[2],10))/100,this.b=Math.min(100, -parseInt(d[3],10))/100,b(d[4]),this;break;case "hsl":if(d=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*$/.exec(e)){var e=parseFloat(d[1]),f=parseInt(d[2],10)/100,g=parseInt(d[3],10)/100;return this.setHSL(e,f,g)}break;case "hsla":if(d=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*([0-9]*\.?[0-9]+)\s*$/.exec(e))return e=parseFloat(d[1]),f=parseInt(d[2],10)/100,g=parseInt(d[3],10)/100,b(d[4]),this.setHSL(e,f,g)}}else if(d=/^\#([A-Fa-f0-9]+)$/.exec(a)){b=d[1];d=b.length;if(3===d)return this.r= -parseInt(b.charAt(0)+b.charAt(0),16)/255,this.g=parseInt(b.charAt(1)+b.charAt(1),16)/255,this.b=parseInt(b.charAt(2)+b.charAt(2),16)/255,this;if(6===d)return this.r=parseInt(b.charAt(0)+b.charAt(1),16)/255,this.g=parseInt(b.charAt(2)+b.charAt(3),16)/255,this.b=parseInt(b.charAt(4)+b.charAt(5),16)/255,this}a&&0=m?u/(f+g):u/(2-f-g);switch(f){case b:k=(d-c)/u+(dg&&d>b?(d=2*Math.sqrt(1+d-g-b),this._w=(u-k)/d,this._x=.25*d,this._y=(a+f)/d,this._z=(c+m)/d):g>b?(d=2*Math.sqrt(1+g-d-b),this._w=(c-m)/d,this._x=(a+f)/d,this._y= -.25*d,this._z=(k+u)/d):(d=2*Math.sqrt(1+b-d-g),this._w=(f-a)/d,this._x=(c+m)/d,this._y=(k+u)/d,this._z=.25*d);this.onChangeCallback();return this},setFromUnitVectors:function(){var a,b;return function(d,e){void 0===a&&(a=new c.Vector3);b=d.dot(e)+1;1E-6>b?(b=0,Math.abs(d.x)>Math.abs(d.z)?a.set(-d.y,d.x,0):a.set(0,-d.z,d.y)):a.crossVectors(d,e);this._x=a.x;this._y=a.y;this._z=a.z;this._w=b;this.normalize();return this}}(),inverse:function(){this.conjugate().normalize();return this},conjugate:function(){this._x*= --1;this._y*=-1;this._z*=-1;this.onChangeCallback();return this},dot:function(a){return this._x*a._x+this._y*a._y+this._z*a._z+this._w*a._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var a=this.length();0===a?(this._z=this._y=this._x=0,this._w=1):(a=1/a,this._x*=a,this._y*=a,this._z*=a,this._w*=a);this.onChangeCallback();return this}, -multiply:function(a,b){return void 0!==b?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(a,b)):this.multiplyQuaternions(this,a)},multiplyQuaternions:function(a,b){var d=a._x,c=a._y,f=a._z,g=a._w,k=b._x,m=b._y,u=b._z,p=b._w;this._x=d*p+g*k+c*u-f*m;this._y=c*p+g*m+f*k-d*u;this._z=f*p+g*u+d*m-c*k;this._w=g*p-d*k-c*m-f*u;this.onChangeCallback();return this},multiplyVector3:function(a){console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."); -return a.applyQuaternion(this)},slerp:function(a,b){if(0===b)return this;if(1===b)return this.copy(a);var d=this._x,c=this._y,f=this._z,g=this._w,k=g*a._w+d*a._x+c*a._y+f*a._z;0>k?(this._w=-a._w,this._x=-a._x,this._y=-a._y,this._z=-a._z,k=-k):this.copy(a);if(1<=k)return this._w=g,this._x=d,this._y=c,this._z=f,this;var m=Math.acos(k),u=Math.sqrt(1-k*k);if(.001>Math.abs(u))return this._w=.5*(g+this._w),this._x=.5*(d+this._x),this._y=.5*(c+this._y),this._z=.5*(f+this._z),this;k=Math.sin((1-b)*m)/u;m= -Math.sin(b*m)/u;this._w=g*k+this._w*m;this._x=d*k+this._x*m;this._y=c*k+this._y*m;this._z=f*k+this._z*m;this.onChangeCallback();return this},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._w===this._w},fromArray:function(a,b){void 0===b&&(b=0);this._x=a[b];this._y=a[b+1];this._z=a[b+2];this._w=a[b+3];this.onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._w;return a},onChange:function(a){this.onChangeCallback= -a;return this},onChangeCallback:function(){},clone:function(){return new c.Quaternion(this._x,this._y,this._z,this._w)}};c.Quaternion.slerp=function(a,b,d,c){return d.copy(a).slerp(b,c)};c.Vector2=function(a,b){this.x=a||0;this.y=b||0};c.Vector2.prototype={constructor:c.Vector2,set:function(a,b){this.x=a;this.y=b;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;default:throw Error("index is out of range: "+ -a);}},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+a);}},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;return this},addScalar:function(a){this.x+=a;this.y+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this}, -addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;return this},subScalar:function(a){this.x-=a;this.y-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiply:function(a){this.x*=a.x;this.y*=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this}, -divide:function(a){this.x/=a.x;this.y/=a.y;return this},divideScalar:function(a){0!==a?(a=1/a,this.x*=a,this.y*=a):this.y=this.x=0;return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);return this},max:function(a){this.xb.x&&(this.x=b.x);this.yb.y&&(this.y=b.y);return this},clampScalar:function(){var a,b;return function(d,e){void 0===a&&(a=new c.Vector2, -b=new c.Vector2);a.set(d,d);b.set(e,e);return this.clamp(a,b)}}(),floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);return this},negate:function(){this.x=-this.x;this.y=-this.y;return this}, -dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x;a=this.y-a.y;return b*b+a*a},setLength:function(a){var b=this.length();0!==b&&a!==b&&this.multiplyScalar(a/ -b);return this},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;return this},lerpVectors:function(a,b,d){this.subVectors(b,a).multiplyScalar(d).add(a);return this},equals:function(a){return a.x===this.x&&a.y===this.y},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;return a},fromAttribute:function(a,b,d){void 0===d&&(d=0);b=b*a.itemSize+d;this.x=a.array[b];this.y= -a.array[b+1];return this},clone:function(){return new c.Vector2(this.x,this.y)}};c.Vector3=function(a,b,d){this.x=a||0;this.y=b||0;this.z=d||0};c.Vector3.prototype={constructor:c.Vector3,set:function(a,b,d){this.x=a;this.y=b;this.z=d;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;default:throw Error("index is out of range: "+ -a);}},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+a);}},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},addVectors:function(a, -b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;this.z+=a.z*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},subScalar:function(a){this.x-=a;this.y-=a;this.z-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this}, -multiply:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(a,b);this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},multiplyVectors:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},applyEuler:function(){var a;return function(b){!1===b instanceof c.Euler&&console.error("THREE.Vector3: .applyEuler() now expects a Euler rotation rather than a Vector3 and order."); -void 0===a&&(a=new c.Quaternion);this.applyQuaternion(a.setFromEuler(b));return this}}(),applyAxisAngle:function(){var a;return function(b,d){void 0===a&&(a=new c.Quaternion);this.applyQuaternion(a.setFromAxisAngle(b,d));return this}}(),applyMatrix3:function(a){var b=this.x,d=this.y,c=this.z;a=a.elements;this.x=a[0]*b+a[3]*d+a[6]*c;this.y=a[1]*b+a[4]*d+a[7]*c;this.z=a[2]*b+a[5]*d+a[8]*c;return this},applyMatrix4:function(a){var b=this.x,d=this.y,c=this.z;a=a.elements;this.x=a[0]*b+a[4]*d+a[8]*c+a[12]; -this.y=a[1]*b+a[5]*d+a[9]*c+a[13];this.z=a[2]*b+a[6]*d+a[10]*c+a[14];return this},applyProjection:function(a){var b=this.x,d=this.y,c=this.z;a=a.elements;var f=1/(a[3]*b+a[7]*d+a[11]*c+a[15]);this.x=(a[0]*b+a[4]*d+a[8]*c+a[12])*f;this.y=(a[1]*b+a[5]*d+a[9]*c+a[13])*f;this.z=(a[2]*b+a[6]*d+a[10]*c+a[14])*f;return this},applyQuaternion:function(a){var b=this.x,d=this.y,c=this.z,f=a.x,g=a.y,k=a.z;a=a.w;var m=a*b+g*c-k*d,u=a*d+k*b-f*c,p=a*c+f*d-g*b,b=-f*b-g*d-k*c;this.x=m*a+b*-f+u*-k-p*-g;this.y=u*a+ -b*-g+p*-f-m*-k;this.z=p*a+b*-k+m*-g-u*-f;return this},project:function(){var a;return function(b){void 0===a&&(a=new c.Matrix4);a.multiplyMatrices(b.projectionMatrix,a.getInverse(b.matrixWorld));return this.applyProjection(a)}}(),unproject:function(){var a;return function(b){void 0===a&&(a=new c.Matrix4);a.multiplyMatrices(b.matrixWorld,a.getInverse(b.projectionMatrix));return this.applyProjection(a)}}(),transformDirection:function(a){var b=this.x,d=this.y,c=this.z;a=a.elements;this.x=a[0]*b+a[4]* -d+a[8]*c;this.y=a[1]*b+a[5]*d+a[9]*c;this.z=a[2]*b+a[6]*d+a[10]*c;this.normalize();return this},divide:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){0!==a?(a=1/a,this.x*=a,this.y*=a,this.z*=a):this.z=this.y=this.x=0;return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);this.z>a.z&&(this.z=a.z);return this},max:function(a){this.xb.x&&(this.x=b.x);this.yb.y&&(this.y=b.y);this.zb.z&&(this.z=b.z);return this},clampScalar:function(){var a,b;return function(d,e){void 0===a&&(a=new c.Vector3,b=new c.Vector3);a.set(d,d,d);b.set(e,e,e);return this.clamp(a,b)}}(),floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);return this}, -round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z}, -length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){var b=this.length();0!==b&&a!==b&&this.multiplyScalar(a/b);return this},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;return this},lerpVectors:function(a,b,d){this.subVectors(b,a).multiplyScalar(d).add(a);return this}, -cross:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(a,b);var d=this.x,c=this.y,f=this.z;this.x=c*a.z-f*a.y;this.y=f*a.x-d*a.z;this.z=d*a.y-c*a.x;return this},crossVectors:function(a,b){var d=a.x,c=a.y,f=a.z,g=b.x,k=b.y,m=b.z;this.x=c*m-f*k;this.y=f*g-d*m;this.z=d*k-c*g;return this},projectOnVector:function(){var a,b;return function(d){void 0===a&&(a=new c.Vector3);a.copy(d).normalize(); -b=this.dot(a);return this.copy(a).multiplyScalar(b)}}(),projectOnPlane:function(){var a;return function(b){void 0===a&&(a=new c.Vector3);a.copy(this).projectOnVector(b);return this.sub(a)}}(),reflect:function(){var a;return function(b){void 0===a&&(a=new c.Vector3);return this.sub(a.copy(b).multiplyScalar(2*this.dot(b)))}}(),angleTo:function(a){a=this.dot(a)/(this.length()*a.length());return Math.acos(c.Math.clamp(a,-1,1))},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b= -this.x-a.x,d=this.y-a.y;a=this.z-a.z;return b*b+d*d+a*a},setEulerFromRotationMatrix:function(a,b){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(a,b){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(a){console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."); -return this.setFromMatrixPosition(a)},getScaleFromMatrix:function(a){console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().");return this.setFromMatrixScale(a)},getColumnFromMatrix:function(a,b){console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().");return this.setFromMatrixColumn(a,b)},setFromMatrixPosition:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},setFromMatrixScale:function(a){var b= -this.set(a.elements[0],a.elements[1],a.elements[2]).length(),d=this.set(a.elements[4],a.elements[5],a.elements[6]).length();a=this.set(a.elements[8],a.elements[9],a.elements[10]).length();this.x=b;this.y=d;this.z=a;return this},setFromMatrixColumn:function(a,b){var d=4*a,c=b.elements;this.x=c[d];this.y=c[d+1];this.z=c[d+2];return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];return this}, -toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;return a},fromAttribute:function(a,b,d){void 0===d&&(d=0);b=b*a.itemSize+d;this.x=a.array[b];this.y=a.array[b+1];this.z=a.array[b+2];return this},clone:function(){return new c.Vector3(this.x,this.y,this.z)}};c.Vector4=function(a,b,d,c){this.x=a||0;this.y=b||0;this.z=d||0;this.w=void 0!==c?c:1};c.Vector4.prototype={constructor:c.Vector4,set:function(a,b,d,c){this.x=a;this.y=b;this.z=d;this.w=c;return this}, -setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setW:function(a){this.w=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;case 3:this.w=b;break;default:throw Error("index is out of range: "+a);}},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+a); -}},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=void 0!==a.w?a.w:1;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;this.w+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addScaledVector:function(a, -b){this.x+=a.x*b;this.y+=a.y*b;this.z+=a.z*b;this.w+=a.w*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},subScalar:function(a){this.x-=a;this.y-=a;this.z-=a;this.w-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},multiplyScalar:function(a){this.x*= -a;this.y*=a;this.z*=a;this.w*=a;return this},applyMatrix4:function(a){var b=this.x,d=this.y,c=this.z,f=this.w;a=a.elements;this.x=a[0]*b+a[4]*d+a[8]*c+a[12]*f;this.y=a[1]*b+a[5]*d+a[9]*c+a[13]*f;this.z=a[2]*b+a[6]*d+a[10]*c+a[14]*f;this.w=a[3]*b+a[7]*d+a[11]*c+a[15]*f;return this},divideScalar:function(a){0!==a?(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a):(this.z=this.y=this.x=0,this.w=1);return this},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);1E-4> -b?(this.x=1,this.z=this.y=0):(this.x=a.x/b,this.y=a.y/b,this.z=a.z/b);return this},setAxisAngleFromRotationMatrix:function(a){var b,d,c;a=a.elements;var f=a[0];c=a[4];var g=a[8],k=a[1],m=a[5],u=a[9];d=a[2];b=a[6];var p=a[10];if(.01>Math.abs(c-k)&&.01>Math.abs(g-d)&&.01>Math.abs(u-b)){if(.1>Math.abs(c+k)&&.1>Math.abs(g+d)&&.1>Math.abs(u+b)&&.1>Math.abs(f+m+p-3))return this.set(1,0,0,0),this;a=Math.PI;f=(f+1)/2;m=(m+1)/2;p=(p+1)/2;c=(c+k)/4;g=(g+d)/4;u=(u+b)/4;f>m&&f>p?.01>f?(b=0,c=d=.707106781):(b= -Math.sqrt(f),d=c/b,c=g/b):m>p?.01>m?(b=.707106781,d=0,c=.707106781):(d=Math.sqrt(m),b=c/d,c=u/d):.01>p?(d=b=.707106781,c=0):(c=Math.sqrt(p),b=g/c,d=u/c);this.set(b,d,c,a);return this}a=Math.sqrt((b-u)*(b-u)+(g-d)*(g-d)+(k-c)*(k-c));.001>Math.abs(a)&&(a=1);this.x=(b-u)/a;this.y=(g-d)/a;this.z=(k-c)/a;this.w=Math.acos((f+m+p-1)/2);return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);this.z>a.z&&(this.z=a.z);this.w>a.w&&(this.w=a.w);return this},max:function(a){this.xb.x&&(this.x=b.x);this.yb.y&&(this.y=b.y);this.zb.z&&(this.z=b.z);this.wb.w&&(this.w=b.w);return this},clampScalar:function(){var a,b;return function(d,e){void 0===a&&(a=new c.Vector4,b=new c.Vector4);a.set(d,d,d,d);b.set(e,e,e,e);return this.clamp(a,b)}}(),floor:function(){this.x= -Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);this.w=Math.floor(this.w);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);this.w=Math.ceil(this.w);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);this.w=Math.round(this.w);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y); -this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);this.w=0>this.w?Math.ceil(this.w):Math.floor(this.w);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+ -Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){var b=this.length();0!==b&&a!==b&&this.multiplyScalar(a/b);return this},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this},lerpVectors:function(a,b,d){this.subVectors(b,a).multiplyScalar(d).add(a);return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&a.w===this.w}, -fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];this.w=a[b+3];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;a[b+3]=this.w;return a},fromAttribute:function(a,b,d){void 0===d&&(d=0);b=b*a.itemSize+d;this.x=a.array[b];this.y=a.array[b+1];this.z=a.array[b+2];this.w=a.array[b+3];return this},clone:function(){return new c.Vector4(this.x,this.y,this.z,this.w)}};c.Euler=function(a,b,d,e){this._x=a||0;this._y= -b||0;this._z=d||0;this._order=e||c.Euler.DefaultOrder};c.Euler.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" ");c.Euler.DefaultOrder="XYZ";c.Euler.prototype={constructor:c.Euler,get x(){return this._x},set x(a){this._x=a;this.onChangeCallback()},get y(){return this._y},set y(a){this._y=a;this.onChangeCallback()},get z(){return this._z},set z(a){this._z=a;this.onChangeCallback()},get order(){return this._order},set order(a){this._order=a;this.onChangeCallback()},set:function(a,b,d,c){this._x=a; -this._y=b;this._z=d;this._order=c||this._order;this.onChangeCallback();return this},copy:function(a){this._x=a._x;this._y=a._y;this._z=a._z;this._order=a._order;this.onChangeCallback();return this},setFromRotationMatrix:function(a,b,d){var e=c.Math.clamp,f=a.elements;a=f[0];var g=f[4],k=f[8],m=f[1],u=f[5],p=f[9],s=f[2],q=f[6],f=f[10];b=b||this._order;"XYZ"===b?(this._y=Math.asin(e(k,-1,1)),.99999>Math.abs(k)?(this._x=Math.atan2(-p,f),this._z=Math.atan2(-g,a)):(this._x=Math.atan2(q,u),this._z=0)): -"YXZ"===b?(this._x=Math.asin(-e(p,-1,1)),.99999>Math.abs(p)?(this._y=Math.atan2(k,f),this._z=Math.atan2(m,u)):(this._y=Math.atan2(-s,a),this._z=0)):"ZXY"===b?(this._x=Math.asin(e(q,-1,1)),.99999>Math.abs(q)?(this._y=Math.atan2(-s,f),this._z=Math.atan2(-g,u)):(this._y=0,this._z=Math.atan2(m,a))):"ZYX"===b?(this._y=Math.asin(-e(s,-1,1)),.99999>Math.abs(s)?(this._x=Math.atan2(q,f),this._z=Math.atan2(m,a)):(this._x=0,this._z=Math.atan2(-g,u))):"YZX"===b?(this._z=Math.asin(e(m,-1,1)),.99999>Math.abs(m)? -(this._x=Math.atan2(-p,u),this._y=Math.atan2(-s,a)):(this._x=0,this._y=Math.atan2(k,f))):"XZY"===b?(this._z=Math.asin(-e(g,-1,1)),.99999>Math.abs(g)?(this._x=Math.atan2(q,u),this._y=Math.atan2(k,a)):(this._x=Math.atan2(-p,f),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+b);this._order=b;if(!1!==d)this.onChangeCallback();return this},setFromQuaternion:function(){var a;return function(b,d,e){void 0===a&&(a=new c.Matrix4);a.makeRotationFromQuaternion(b);this.setFromRotationMatrix(a, -d,e);return this}}(),setFromVector3:function(a,b){return this.set(a.x,a.y,a.z,b||this._order)},reorder:function(){var a=new c.Quaternion;return function(b){a.setFromEuler(this);this.setFromQuaternion(a,b)}}(),equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order},fromArray:function(a){this._x=a[0];this._y=a[1];this._z=a[2];void 0!==a[3]&&(this._order=a[3]);this.onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]= -this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._order;return a},toVector3:function(a){return a?a.set(this._x,this._y,this._z):new c.Vector3(this._x,this._y,this._z)},onChange:function(a){this.onChangeCallback=a;return this},onChangeCallback:function(){},clone:function(){return new c.Euler(this._x,this._y,this._z,this._order)}};c.Matrix3=function(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]);0this.determinant()&&(k=-k);d.x=g[12];d.y=g[13];d.z=g[14];b.elements.set(this.elements);d=1/k;var g=1/m,p=1/u;b.elements[0]*=d;b.elements[1]*=d;b.elements[2]*=d;b.elements[4]*=g;b.elements[5]*=g;b.elements[6]*=g;b.elements[8]*=p;b.elements[9]*=p;b.elements[10]*=p;e.setFromRotationMatrix(b);f.x=k; -f.y=m;f.z=u;return this}}(),makeFrustum:function(a,b,c,e,f,g){var k=this.elements;k[0]=2*f/(b-a);k[4]=0;k[8]=(b+a)/(b-a);k[12]=0;k[1]=0;k[5]=2*f/(e-c);k[9]=(e+c)/(e-c);k[13]=0;k[2]=0;k[6]=0;k[10]=-(g+f)/(g-f);k[14]=-2*g*f/(g-f);k[3]=0;k[7]=0;k[11]=-1;k[15]=0;return this},makePerspective:function(a,b,d,e){a=d*Math.tan(c.Math.degToRad(.5*a));var f=-a;return this.makeFrustum(f*b,a*b,f,a,d,e)},makeOrthographic:function(a,b,c,e,f,g){var k=this.elements,m=b-a,u=c-e,p=g-f;k[0]=2/m;k[4]=0;k[8]=0;k[12]=-((b+ -a)/m);k[1]=0;k[5]=2/u;k[9]=0;k[13]=-((c+e)/u);k[2]=0;k[6]=0;k[10]=-2/p;k[14]=-((g+f)/p);k[3]=0;k[7]=0;k[11]=0;k[15]=1;return this},equals:function(a){var b=this.elements;a=a.elements;for(var c=0;16>c;c++)if(b[c]!==a[c])return!1;return!0},fromArray:function(a){this.elements.set(a);return this},toArray:function(){var a=this.elements;return[a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15]]},clone:function(){return(new c.Matrix4).fromArray(this.elements)}};c.Ray=function(a, -b){this.origin=void 0!==a?a:new c.Vector3;this.direction=void 0!==b?b:new c.Vector3};c.Ray.prototype={constructor:c.Ray,set:function(a,b){this.origin.copy(a);this.direction.copy(b);return this},copy:function(a){this.origin.copy(a.origin);this.direction.copy(a.direction);return this},at:function(a,b){return(b||new c.Vector3).copy(this.direction).multiplyScalar(a).add(this.origin)},recast:function(){var a=new c.Vector3;return function(b){this.origin.copy(this.at(b,a));return this}}(),closestPointToPoint:function(a, -b){var d=b||new c.Vector3;d.subVectors(a,this.origin);var e=d.dot(this.direction);return 0>e?d.copy(this.origin):d.copy(this.direction).multiplyScalar(e).add(this.origin)},distanceToPoint:function(a){return Math.sqrt(this.distanceSqToPoint(a))},distanceSqToPoint:function(){var a=new c.Vector3;return function(b){var c=a.subVectors(b,this.origin).dot(this.direction);if(0>c)return this.origin.distanceToSquared(b);a.copy(this.direction).multiplyScalar(c).add(this.origin);return a.distanceToSquared(b)}}(), -distanceSqToSegment:function(){var a=new c.Vector3,b=new c.Vector3,d=new c.Vector3;return function(c,f,g,k){a.copy(c).add(f).multiplyScalar(.5);b.copy(f).sub(c).normalize();d.copy(this.origin).sub(a);var m=.5*c.distanceTo(f),u=-this.direction.dot(b),p=d.dot(this.direction),s=-d.dot(b),q=d.lengthSq(),n=Math.abs(1-u*u),h;0=-h?f<=h?(m=1/n,c*=m,f*=m,u=c*(c+u*f+2*p)+f*(u*c+f+2*s)+q):(f=m,c=Math.max(0,-(u*f+p)),u=-c*c+f*(f+2*s)+q):(f=-m,c=Math.max(0,-(u*f+p)),u=-c*c+f*(f+ -2*s)+q):f<=-h?(c=Math.max(0,-(-u*m+p)),f=0g)return null;g=Math.sqrt(g-f);f=e-g;e+=g;return 0>f&&0>e?null:0>f?this.at(e,c):this.at(f,c)}}(),isIntersectionPlane:function(a){var b=a.distanceToPoint(this.origin);return 0===b||0>a.normal.dot(this.direction)*b?!0:!1},distanceToPlane:function(a){var b=a.normal.dot(this.direction);if(0===b)return 0===a.distanceToPoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+ -a.constant)/b;return 0<=a?a:null},intersectPlane:function(a,b){var c=this.distanceToPlane(a);return null===c?null:this.at(c,b)},isIntersectionBox:function(){var a=new c.Vector3;return function(b){return null!==this.intersectBox(b,a)}}(),intersectBox:function(a,b){var c,e,f,g,k;e=1/this.direction.x;g=1/this.direction.y;k=1/this.direction.z;var m=this.origin;0<=e?(c=(a.min.x-m.x)*e,e*=a.max.x-m.x):(c=(a.max.x-m.x)*e,e*=a.min.x-m.x);0<=g?(f=(a.min.y-m.y)*g,g*=a.max.y-m.y):(f=(a.max.y-m.y)*g,g*=a.min.y- -m.y);if(c>g||f>e)return null;if(f>c||c!==c)c=f;if(gk||f>e)return null;if(f>c||c!==c)c=f;if(ke?null:this.at(0<=c?c:e,b)},intersectTriangle:function(){var a=new c.Vector3,b=new c.Vector3,d=new c.Vector3,e=new c.Vector3;return function(c,g,k,m,u){b.subVectors(g,c);d.subVectors(k,c);e.crossVectors(b,d);g=this.direction.dot(e);if(0g)m=-1,g=-g;else return null; -a.subVectors(this.origin,c);c=m*this.direction.dot(d.crossVectors(a,d));if(0>c)return null;k=m*this.direction.dot(b.cross(a));if(0>k||c+k>g)return null;c=-m*a.dot(e);return 0>c?null:this.at(c/g,u)}}(),applyMatrix4:function(a){this.direction.add(this.origin).applyMatrix4(a);this.origin.applyMatrix4(a);this.direction.sub(this.origin);this.direction.normalize();return this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)},clone:function(){return(new c.Ray).copy(this)}}; -c.Box2=function(a,b){this.min=void 0!==a?a:new c.Vector2(Infinity,Infinity);this.max=void 0!==b?b:new c.Vector2(-Infinity,-Infinity)};c.Box2.prototype={constructor:c.Box2,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setFromPoints:function(a){this.makeEmpty();for(var b=0,c=a.length;bthis.max.x||a.ythis.max.y?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y?!0:!1},getParameter:function(a,b){return(b||new c.Vector2).set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y))},isIntersectionBox:function(a){return a.max.x< -this.min.x||a.min.x>this.max.x||a.max.ythis.max.y?!1:!0},clampPoint:function(a,b){return(b||new c.Vector2).copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new c.Vector2;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},translate:function(a){this.min.add(a);this.max.add(a);return this}, -equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)},clone:function(){return(new c.Box2).copy(this)}};c.Box3=function(a,b){this.min=void 0!==a?a:new c.Vector3(Infinity,Infinity,Infinity);this.max=void 0!==b?b:new c.Vector3(-Infinity,-Infinity,-Infinity)};c.Box3.prototype={constructor:c.Box3,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setFromPoints:function(a){this.makeEmpty();for(var b=0,c=a.length;bthis.max.x||a.ythis.max.y||a.zthis.max.z?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&& -this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&&a.max.z<=this.max.z?!0:!1},getParameter:function(a,b){return(b||new c.Vector3).set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y),(a.z-this.min.z)/(this.max.z-this.min.z))},isIntersectionBox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y||a.max.zthis.max.z?!1:!0},clampPoint:function(a,b){return(b||new c.Vector3).copy(a).clamp(this.min, -this.max)},distanceToPoint:function(){var a=new c.Vector3;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),getBoundingSphere:function(){var a=new c.Vector3;return function(b){b=b||new c.Sphere;b.center=this.center();b.radius=.5*this.size(a).length();return b}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},applyMatrix4:function(){var a=[new c.Vector3,new c.Vector3,new c.Vector3, -new c.Vector3,new c.Vector3,new c.Vector3,new c.Vector3,new c.Vector3];return function(b){a[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(b);a[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(b);a[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(b);a[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(b);a[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(b);a[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(b);a[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(b); -a[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(b);this.makeEmpty();this.setFromPoints(a);return this}}(),translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)},clone:function(){return(new c.Box3).copy(this)}};c.Sphere=function(a,b){this.center=void 0!==a?a:new c.Vector3;this.radius=void 0!==b?b:0};c.Sphere.prototype={constructor:c.Sphere,set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromPoints:function(){var a= -new c.Box3;return function(b,c){var e=this.center;void 0!==c?e.copy(c):a.setFromPoints(b).center(e);for(var f=0,g=0,k=b.length;g=this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-this.radius},intersectsSphere:function(a){var b= -this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},clampPoint:function(a,b){var d=this.center.distanceToSquared(a),e=b||new c.Vector3;e.copy(a);d>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center));return e},getBoundingBox:function(a){a=a||new c.Box3;a.set(this.center,this.center);a.expandByScalar(this.radius);return a},applyMatrix4:function(a){this.center.applyMatrix4(a);this.radius*=a.getMaxScaleOnAxis();return this},translate:function(a){this.center.add(a); -return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius},clone:function(){return(new c.Sphere).copy(this)}};c.Plane=function(a,b){this.normal=void 0!==a?a:new c.Vector3(1,0,0);this.constant=void 0!==b?b:0};c.Plane.prototype={constructor:c.Plane,set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a,b,c,e){this.normal.set(a,b,c);this.constant=e;return this},setFromNormalAndCoplanarPoint:function(a,b){this.normal.copy(a);this.constant= --b.dot(this.normal);return this},setFromCoplanarPoints:function(){var a=new c.Vector3,b=new c.Vector3;return function(c,e,f){e=a.subVectors(f,e).cross(b.subVectors(c,e)).normalize();this.setFromNormalAndCoplanarPoint(e,c);return this}}(),copy:function(a){this.normal.copy(a.normal);this.constant=a.constant;return this},normalize:function(){var a=1/this.normal.length();this.normal.multiplyScalar(a);this.constant*=a;return this},negate:function(){this.constant*=-1;this.normal.negate();return this},distanceToPoint:function(a){return this.normal.dot(a)+ -this.constant},distanceToSphere:function(a){return this.distanceToPoint(a.center)-a.radius},projectPoint:function(a,b){return this.orthoPoint(a,b).sub(a).negate()},orthoPoint:function(a,b){var d=this.distanceToPoint(a);return(b||new c.Vector3).copy(this.normal).multiplyScalar(d)},isIntersectionLine:function(a){var b=this.distanceToPoint(a.start);a=this.distanceToPoint(a.end);return 0>b&&0a&&0g||1c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements;a=c[0];var e=c[1],f=c[2],g=c[3],k=c[4],m=c[5],u=c[6],p=c[7],s=c[8],q=c[9],n=c[10],h=c[11],t=c[12],x=c[13],v=c[14],c=c[15];b[0].setComponents(g-a,p-k,h-s,c-t).normalize();b[1].setComponents(g+a,p+k,h+s,c+t).normalize();b[2].setComponents(g+ -e,p+m,h+q,c+x).normalize();b[3].setComponents(g-e,p-m,h-q,c-x).normalize();b[4].setComponents(g-f,p-u,h-n,c-v).normalize();b[5].setComponents(g+f,p+u,h+n,c+v).normalize();return this},intersectsObject:function(){var a=new c.Sphere;return function(b){var c=b.geometry;null===c.boundingSphere&&c.computeBoundingSphere();a.copy(c.boundingSphere);a.applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(),intersectsSphere:function(a){var b=this.planes,c=a.center;a=-a.radius;for(var e=0;6>e;e++)if(b[e].distanceToPoint(c)< -a)return!1;return!0},intersectsBox:function(){var a=new c.Vector3,b=new c.Vector3;return function(c){for(var e=this.planes,f=0;6>f;f++){var g=e[f];a.x=0k&&0>g)return!1}return!0}}(),containsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1; -return!0},clone:function(){return(new c.Frustum).copy(this)}};c.Math={generateUUID:function(){var a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),b=Array(36),c=0,e;return function(){for(var f=0;36>f;f++)8===f||13===f||18===f||23===f?b[f]="-":14===f?b[f]="4":(2>=c&&(c=33554432+16777216*Math.random()|0),e=c&15,c>>=4,b[f]=a[19===f?e&3|8:e]);return b.join("")}}(),clamp:function(a,b,c){return ac?c:a},clampBottom:function(a,b){return a=c)return 1;a=(a-b)/(c-b);return a*a*(3-2*a)},smootherstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*a*(a*(6*a-15)+10)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a* -(.5-Math.random())},degToRad:function(){var a=Math.PI/180;return function(b){return b*a}}(),radToDeg:function(){var a=180/Math.PI;return function(b){return b*a}}(),isPowerOfTwo:function(a){return 0===(a&a-1)&&0!==a},nextPowerOfTwo:function(a){a--;a|=a>>1;a|=a>>2;a|=a>>4;a|=a>>8;a|=a>>16;a++;return a}};c.Triangle=function(a,b,d){this.a=void 0!==a?a:new c.Vector3;this.b=void 0!==b?b:new c.Vector3;this.c=void 0!==d?d:new c.Vector3};c.Triangle.normal=function(){var a=new c.Vector3;return function(b,d, -e,f){f=f||new c.Vector3;f.subVectors(e,d);a.subVectors(b,d);f.cross(a);b=f.lengthSq();return 0=b.x+b.y}}();c.Triangle.prototype={constructor:c.Triangle,set:function(a,b,c){this.a.copy(a);this.b.copy(b);this.c.copy(c);return this},setFromPointsAndIndices:function(a,b,c,e){this.a.copy(a[b]);this.b.copy(a[c]);this.c.copy(a[e]);return this},copy:function(a){this.a.copy(a.a);this.b.copy(a.b);this.c.copy(a.c);return this},area:function(){var a=new c.Vector3, -b=new c.Vector3;return function(){a.subVectors(this.c,this.b);b.subVectors(this.a,this.b);return.5*a.cross(b).length()}}(),midpoint:function(a){return(a||new c.Vector3).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(a){return c.Triangle.normal(this.a,this.b,this.c,a)},plane:function(a){return(a||new c.Plane).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(a,b){return c.Triangle.barycoordFromPoint(a,this.a,this.b,this.c,b)},containsPoint:function(a){return c.Triangle.containsPoint(a, -this.a,this.b,this.c)},equals:function(a){return a.a.equals(this.a)&&a.b.equals(this.b)&&a.c.equals(this.c)},clone:function(){return(new c.Triangle).copy(this)}};c.EventDispatcher=function(){};c.EventDispatcher.prototype={constructor:c.EventDispatcher,apply:function(a){a.addEventListener=c.EventDispatcher.prototype.addEventListener;a.hasEventListener=c.EventDispatcher.prototype.hasEventListener;a.removeEventListener=c.EventDispatcher.prototype.removeEventListener;a.dispatchEvent=c.EventDispatcher.prototype.dispatchEvent}, -addEventListener:function(a,b){void 0===this._listeners&&(this._listeners={});var c=this._listeners;void 0===c[a]&&(c[a]=[]);-1===c[a].indexOf(b)&&c[a].push(b)},hasEventListener:function(a,b){if(void 0===this._listeners)return!1;var c=this._listeners;return void 0!==c[a]&&-1!==c[a].indexOf(b)?!0:!1},removeEventListener:function(a,b){if(void 0!==this._listeners){var c=this._listeners[a];if(void 0!==c){var e=c.indexOf(b);-1!==e&&c.splice(e,1)}}},dispatchEvent:function(a){if(void 0!==this._listeners){var b= -this._listeners[a.type];if(void 0!==b){a.target=this;for(var c=[],e=b.length,f=0;fa = "+s.obj3d.descr.a+" Å
b = "+s.obj3d.descr.b+" Å
c = "+s.obj3d.descr.c+" Å
α = "+s.obj3d.descr.alpha+"°
β = "+s.obj3d.descr.beta+ +"°
γ = "+s.obj3d.descr.gamma+"°
");(a=document.getElementById("optionpanel"))&&a.parentNode.removeChild(a);a=b("optionpanel"," ");if(Object.keys(s.obj3d.overlayed).length)for(var c in s.obj3d.overlayed)a.innerHTML+= +" ",s.available_overlays.push(c);a.onclick=function(a){a=a||window.event;a=(a.target||a.srcElement).id.replace("optionpanel_","");if(-1!==s.available_overlays.indexOf(a)){var b=s.scene.getObjectByName("atombox"),b=b.children,d=b.filter(function(a){return"label"==a.name}),c,f=d.length;for(c=0;cc;c++)a=Math.round(1E3*parseFloat(s.obj3d.cell[c][0]))/10,k=Math.round(1E3*parseFloat(s.obj3d.cell[c][1]))/10,m=Math.round(1E3*parseFloat(s.obj3d.cell[c][2]))/10,f.push([a,k,m]),0==c?B=10027008:1==c?B=39168:2==c&&(B=153),s.atombox.add(new A.ArrowHelper((new A.Vector3(a, +k,m)).normalize(),new A.Vector3(0,0,0),Math.sqrt(a*a+k*k+m*m),B,75,10));c=[f[0][0]+f[1][0],f[0][1]+f[1][1],f[0][2]+f[1][2]];a=[f[0][0]+f[2][0],f[0][1]+f[2][1],f[0][2]+f[2][2]];k=[c[0]+f[2][0],c[1]+f[2][1],c[2]+f[2][2]];m=[f[1][0]+f[2][0],f[1][1]+f[2][1],f[1][2]+f[2][2]];B=[];B.push([f[0],c]);B.push([f[0],a]);B.push([f[1],m]);B.push([f[1],c]);B.push([f[2],m]);B.push([f[2],a]);B.push([c,k]);B.push([a,k]);B.push([k,m]);a=B.length;for(c=0;c
');document.getElementById("cross").onclick=function(){d.style.display="none"};b("versionbox","v"+s.version);b("cmdbox","New model").onclick=n;b("landing",'
Choose a CIF or POSCAR file (drag & drop is supported). Files are processed offline in the browser, no remote server is used. Example.
'); +document.getElementById("play_demo").onclick=r;h=h(g,{warning:a,error:a});window.addEventListener("resize",m,!1);window.addEventListener("hashchange",B,!1);if(s.local_supported){window.addEventListener("dragover",u,!1);window.addEventListener("drop",t,!1);var c=document.getElementById("fileapi"),e=new FileReader;c.onchange=function(){if(!this.files[0]||!this.files[0].size)return a("Error: file cannot be read (unaccessible?)");e.currentFilename=this.files[0].name;e.readAsText(this.files[0])};e.onloadend= +function(a){v(a.target.result,!1)}}window.parent&&window.parent.cifdata?v(window.parent.cifdata,!1):document.location.hash.length?B():n()})}).apply(null,q)}()},function(O,Q,R){String.prototype.startswith=function(q){return 0===this.indexOf(q)};String.prototype.endswith=function(q,h){var g=this.toString();if(void 0===h||h>g.length)h=g.length;h-=q.length;g=g.indexOf(q,h);return-1!==g&&g===h};String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")};Q=function(q,h){function g(a){if(0g.length)return h.error("Error: invalid atom definition!"),!1;for(e=0;4>e;e++)u[r[e]]=3>e?parseFloat(g[e]):g[e];u.symbol=u.symbol.replace(/\W/g,"");d.push(u);t++}b=q.multiply(b,c);if(d.length)return{cell:b,atoms:d,types:n};h.error("Error: unexpected POSCAR format!");return!1}var d= +{JmolColors:{D:"#FFFFC0",H:"#FFFFFF",He:"#D9FFFF",Li:"#CC80FF",Be:"#C2FF00",B:"#FFB5B5",C:"#909090",N:"#3050F8",O:"#FF0D0D",F:"#90E050",Ne:"#B3E3F5",Na:"#AB5CF2",Mg:"#8AFF00",Al:"#BFA6A6",Si:"#F0C8A0",P:"#FF8000",S:"#FFFF30",Cl:"#1FF01F",Ar:"#80D1E3",K:"#8F40D4",Ca:"#3DFF00",Sc:"#E6E6E6",Ti:"#BFC2C7",V:"#A6A6AB",Cr:"#8A99C7",Mn:"#9C7AC7",Fe:"#E06633",Co:"#F090A0",Ni:"#50D050",Cu:"#C88033",Zn:"#7D80B0",Ga:"#C28F8F",Ge:"#668F8F",As:"#BD80E3",Se:"#FFA100",Br:"#A62929",Kr:"#5CB8D1",Rb:"#702EB0",Sr:"#00FF00", +Y:"#94FFFF",Zr:"#94E0E0",Nb:"#73C2C9",Mo:"#54B5B5",Tc:"#3B9E9E",Ru:"#248F8F",Rh:"#0A7D8C",Pd:"#006985",Ag:"#C0C0C0",Cd:"#FFD98F",In:"#A67573",Sn:"#668080",Sb:"#9E63B5",Te:"#D47A00",I:"#940094",Xe:"#429EB0",Cs:"#57178F",Ba:"#00C900",La:"#70D4FF",Ce:"#FFFFC7",Pr:"#D9FFC7",Nd:"#C7FFC7",Pm:"#A3FFC7",Sm:"#8FFFC7",Eu:"#61FFC7",Gd:"#45FFC7",Tb:"#30FFC7",Dy:"#1FFFC7",Ho:"#00FF9C",Er:"#00E675",Tm:"#00D452",Yb:"#00BF38",Lu:"#00AB24",Hf:"#4DC2FF",Ta:"#4DA6FF",W:"#2194D6",Re:"#267DAB",Os:"#266696",Ir:"#175487", +Pt:"#D0D0E0",Au:"#FFD123",Hg:"#B8B8D0",Tl:"#A6544D",Pb:"#575961",Bi:"#9E4FB5",Po:"#AB5C00",At:"#754F45",Rn:"#428296",Fr:"#420066",Ra:"#007D00",Ac:"#70ABFA",Th:"#00BAFF",Pa:"#00A1FF",U:"#008FFF",Np:"#0080FF",Pu:"#006BFF",Am:"#545CF2",Cm:"#785CE3",Bk:"#8A4FE3",Cf:"#A136D4",Es:"#B31FD4",Fm:"#B31FBA",Md:"#B30DA6",No:"#BD0D87",Lr:"#C70066",Rf:"#CC0059",Db:"#D1004F",Sg:"#D90045",Bh:"#E00038",Hs:"#E6002E",Mt:"#EB0026"},AseRadii:{X:.66,H:.31,He:.28,Li:1.28,Be:.96,B:.84,C:.76,N:.71,O:.66,F:.57,Ne:.58,Na:1.66, +Mg:1.41,Al:1.21,Si:1.11,P:1.07,S:1.05,Cl:1.02,Ar:1.06,K:2.03,Ca:1.76,Sc:1.7,Ti:1.6,V:1.53,Cr:1.39,Mn:1.39,Fe:1.32,Co:1.26,Ni:1.24,Cu:1.32,Zn:1.22,Ga:1.22,Ge:1.2,As:1.19,Se:1.2,Br:1.2,Kr:1.16,Rb:2.2,Sr:1.95,Y:1.9,Zr:1.75,Nb:1.64,Mo:1.54,Tc:1.47,Ru:1.46,Rh:1.42,Pd:1.39,Ag:1.45,Cd:1.44,In:1.42,Sn:1.39,Sb:1.39,Te:1.38,I:1.39,Xe:1.4,Cs:2.44,Ba:2.15,La:2.07,Ce:2.04,Pr:2.03,Nd:2.01,Pm:1.99,Sm:1.98,Eu:1.98,Gd:1.96,Tb:1.94,Dy:1.92,Ho:1.92,Er:1.89,Tm:1.9,Yb:1.87,Lu:1.87,Hf:1.75,Ta:1.7,W:1.62,Re:1.51,Os:1.44, +Ir:1.41,Pt:1.36,Au:1.36,Hg:1.32,Tl:1.45,Pb:1.46,Bi:1.48,Po:1.4,At:1.5,Rn:1.5,Fr:2.6,Ra:2.21,Ac:2.15,Th:2.06,Pa:2,U:1.96,Np:1.9,Pu:1.87,Am:1.8,Cm:1.69,Bk:3,Cf:3,Es:3,Fm:3,Md:3,No:3,Lr:3,Rf:3,Db:3,Sg:3,Bh:3,Hs:3,Mt:3}},e={_atom_site_occupancy:"site occupancies",_atom_site_charge:"formal charges"};return{to_player:function(c){var k;switch(g(c)){case "CIF":k=a(c);break;case "POSCAR":k=b(c);break;default:h.error("Error: file format cannot be recognized!")}if(!k)return!1;c=k;var m=!1,y;6==Object.keys(c.cell).length? +(y=p(c.cell.a,c.cell.b,c.cell.c,c.cell.alpha,c.cell.beta,c.cell.gamma),m=c.cell):y=c.cell;var B=[],n=c.atoms.length;for(k=0;kc.atoms[k].overlays._atom_site_occupancy&&(v=!0);for(w in c.atoms[k].overlays)l[w]=c.atoms[k].overlays[w];m.atoms.push({x:B[k][0],y:B[k][1],z:B[k][2],c:y,r:r,overlays:l})}for(w in l)"S"!==w&&"N"!==w&&(m.overlayed[w]=e[w]);v&&h.warning("Warning! Rendering of alloys (with fractional site occupancies) is not yet implemented.");return m},to_flatten:function(d){var e;switch(g(d)){case "CIF":e=a(d);break;case "POSCAR":e=b(d);break;default:h.error("Error: file format cannot be recognized!")}return e?c(e): +!1},version:"0.0.2.3"}};"undefined"!==typeof O&&O.exports?O.exports=Q:"function"===typeof R(2).specified&&!(void 0!==Q&&(O.exports=Q))},function(O,Q,R){function q(g){return R(h(g))}function h(h){var c;if(!(c=g[h]))throw Error("Cannot find module '"+h+"'.");return c}var g={"./domReady":3,"./domReady.js":3,"./math.custom":4,"./math.custom.js":4,"./matinfio":1,"./matinfio.js":1,"./require":5,"./require.js":5,"./three.custom":6,"./three.custom.js":6};q.keys=function(){return Object.keys(g)};q.resolve= +h;O.exports=q;q.id=2},function(O,Q,R){var q;!(q=function(){function h(){if(!d){d=!0;a&&clearInterval(a);var b=f;if(d&&b.length){f=[];var c;for(c=0;c15 significant digits to BigNumber (value: "+a+"). Use function bignumber(x) to convert to BigNumber."); +return new b.BigNumber(a)}},{from:"number",to:"Complex",convert:function(a){return new b.Complex(a,0)}},{from:"number",to:"string",convert:function(a){return a+""}},{from:"BigNumber",to:"Complex",convert:function(a){return new b.Complex(a.toNumber(),0)}},{from:"number",to:"Fraction",convert:function(a){if(1515 significant digits to Fraction (value: "+a+"). Use function fraction(x) to convert to Fraction.");return new b.Fraction(a)}}, +{from:"string",to:"number",convert:function(a){var b=Number(a);if(isNaN(b))throw Error('Cannot convert "'+a+'" to a number');return b}},{from:"boolean",to:"number",convert:function(a){return+a}},{from:"boolean",to:"BigNumber",convert:function(a){return new b.BigNumber(+a)}},{from:"boolean",to:"string",convert:function(a){return+a}},{from:"null",to:"number",convert:function(){return 0}},{from:"null",to:"string",convert:function(){return"null"}},{from:"null",to:"BigNumber",convert:function(){return new b.BigNumber(0)}}, +{from:"Array",to:"Matrix",convert:function(a){return new b.DenseMatrix(a)}},{from:"Matrix",to:"Array",convert:function(a){return a.valueOf()}}];return d}},function(q,h,g){var p,c,a;"use strict";(function(b){!(c=[],p=b,a="function"===typeof p?p.apply(h,c):p,void 0!==a&&(q.exports=a))})(function(){function a(){function d(a){for(var b,d=0;dd&&!m?"Unexpected type of argument in function "+ +k+" (expected: "+e.join(" or ")+", actual: "+f+", index: "+d+")":"Too few arguments in function "+k+" (expected: "+e.join(" or ")+", index: "+d+")":"Too many arguments in function "+k+" (expected: "+d+", actual: "+b+")";b=new TypeError(b);b.data=a;return b}function k(a){this.name=a||"refs";this.categories={}}function m(a,b){if("string"===typeof a){var d=a.trim(),c="..."===d.substr(0,3);c&&(d=d.substr(3));if(""===d)this.types=["any"];else for(this.types=d.split("|"),d=0;dl)d[m]=k;else{if(0===l)throw Error('Signature "'+m+'" is defined twice');}else d[m]=k}for(m in d)d.hasOwnProperty(m)&& +c.push(d[m]);c.sort(function(a,b){return y.compare(a,b)});for(e=0;el&&(l=w)}B=[];for(w=0;w +b.params.length)return 1;if(a.params.lengthf)return 1;if(e "+f+") {"),e.push(b+" var varArgs = [];"),e.push(b+" for (var i = "+f+"; i < arguments.length; i++) {"),e.push(b+" varArgs.push(arguments[i]);");else{var m=function(b,c){for(var e=[],f=0;f "+d+") {",b+" throw createError(name, arguments.length, "+d+", arguments["+d+"]);",b+"}"].join("\n");for(var c={},e=[],f=0;fc?-1:0};h.format=function(c,a){if("function"===typeof a)return a(c);if(Infinity=== +c)return"Infinity";if(-Infinity===c)return"-Infinity";if(isNaN(c))return"NaN";var b="auto",d=void 0;a&&(a.notation&&(b=a.notation),h.isNumber(a)?d=a:a.precision&&(d=a.precision));switch(b){case "fixed":return h.toFixed(c,d);case "exponential":return h.toExponential(c,d);case "auto":return h.toPrecision(c,d,a&&a.exponential).replace(/((\.\d*?)(0+))($|e)/,function(a,b,d,c,y){return"."!==d?d+y:y});default:throw Error('Unknown notation "'+b+'". Choose "auto", "exponential", or "fixed".');}};h.toExponential= +function(c,a){return(new p(c)).toExponential(a)};h.toFixed=function(c,a){return(new p(c)).toFixed(a)};h.toPrecision=function(c,a,b){return(new p(c)).toPrecision(a,b)};h.digits=function(c){return c.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length};h.DBL_EPSILON=Number.EPSILON||2.220446049250313E-16;h.nearlyEqual=function(c,a,b){if(null==b)return c==a;if(c==a)return!0;if(isNaN(c)||isNaN(a))return!1;if(isFinite(c)&&isFinite(a)){var d=Math.abs(c-a);return da&&(b=p(-a+1).concat(b),a=1);c&&b.splice(a,0,0===a?"0.":".");return this.sign+b.join("")};g.prototype.toExponential=function(c){var a=c?this.roundDigits(c):this.clone(),b=a.coefficients,a=a.exponent;b.length=d)return this.toExponential(c);d=c?this.roundDigits(c):this.clone();b=d.coefficients;d=d.exponent;b.length=c;)b.unshift(0),a.exponent++,c++;if(b.length>c&&5<=b.splice(c)[0])for(c-=1,b[c]++;10===b[c];)b.pop(),0===c&&(b.unshift(0),a.exponent++,c++),c--,b[c]++;return a};q.exports=g},function(q,h,g){var p=g(9);h.mixin=function(c){var a=new p;c.on=a.on.bind(a);c.off=a.off.bind(a);c.once=a.once.bind(a);c.emit= +a.emit.bind(a);return c}},function(q,h){function g(){}g.prototype={on:function(g,c,a){var b=this.e||(this.e={});(b[g]||(b[g]=[])).push({fn:c,ctx:a});return this},once:function(g,c,a){function b(){d.off(g,b);c.apply(a,arguments)}var d=this;b._=c;return this.on(g,b,a)},emit:function(g){var c=[].slice.call(arguments,1),a=((this.e||(this.e={}))[g]||[]).slice(),b=0,d=a.length;for(b;b");}function c(a,b,d,e){var k,m=b[d],g=Math.min(a.length,m);a.length=m;if(da)throw new m(a);if(void 0!==b&&a>=b)throw new m(a, +b);};h.UNINITIALIZED={};h.resize=function(a,b,f){if(!Array.isArray(a)||!Array.isArray(b))throw new TypeError("Array expected");if(0===b.length)throw Error("Resizing to scalar is not supported");b.forEach(function(a){if(!d.isNumber(a)||!d.isInteger(a)||0>a)throw new TypeError("Invalid size, must contain positive integers (size: "+e.format(b)+")");});c(a,b,0,void 0!==f?f:0);return a};h.squeeze=function(b,d){for(var c=d||h.size(b);Array.isArray(b)&&1===b.length;)b=b[0],c.shift();for(var e=c.length;1=== +c[e-1];)e--;earguments.length?(this.min=0,this.max=c):(this.min= +c,this.max=a);this.message=void 0!==this.min&&this.index=this.max?"Index out of range ("+this.index+" > "+(this.max-1)+")":"Index out of range ("+this.index+")";this.stack=Error().stack}g.prototype=new RangeError;g.prototype.constructor=RangeError;g.prototype.name="IndexError";g.prototype.isIndexError=!0;q.exports=g},function(q,h){h.isBoolean=function(g){return"boolean"==typeof g}},function(q,h){h.memoize= +function(g,h){return function a(){"object"!==typeof a.cache&&(a.cache={});for(var b=[],d=0;d");y=e.max().map(function(a){return a+1});s(a,y,k);u(a._data,e,f,m.length,0)}return a}function u(a,b,d,c,e){var f=e==c-1,k=b.dimension(e);f?k.forEach(function(b,c){y(b);a[b]=d[c[0]]}):k.forEach(function(f,k){y(f);u(a[f],b,d[k[0]],c,e+1)})}function s(a,b,c){for(var e=d.clone(a._size),f=!1;e.lengthe[k]&&(e[k]=b[k],f=!0);f&&x(a,e,c)}function A(a){for(var b=0,d=a.length;ba?-a:0;for(var c=Math.min(this._size[0]-a,this._size[1]-b),e=[],m=0;ma)throw Error("Size values must be positive integers");return a});if(c){if(c&&!0===c.isBigNumber&&(c=c.toNumber()),!f(c)||!k(c))throw new TypeError("The parameter k must be an integer number");}else c=0;y&&m(n)&&(y=w.convert(y,n));n=0c?-c:0;var r=a[0],g=a[1],h=Math.min(r-c,g-n),s;if(e(d)){if(d.length!==h)throw Error("Invalid value array length"); +s=function(a){return d[a]}}else if(d&&!0===d.isMatrix){s=d.size();if(1!==s.length||s[0]!==h)throw Error("Invalid matrix length");s=function(a){return d.get([a])}}else s=function(){return d};y||(y=s(0)&&!0===s(0).isBigNumber?new B.BigNumber(0):0);var u=[];if(0n;++n){var m=d.times(d),r=m.times(d),m=r.times(m);d=y.times(m).minus(B.times(r)).plus(k.times(d))}a&& +(d.s=-d.s)}else for(k.abs().lt(b.ONE)?(y=64,a=3):(y=256,a=4),d=c(k.div(y),d),b.config({precision:Math.min(m,f+8)}),k=new b(8);0Math.abs(a)?a+a*a*a/6+a*a*a*a*a/120:(Math.exp(a)-Math.exp(-a))/ +2}var c=g(25),a=g(32);h.name="sinh";h.factory=function(b,d,e,f){var k=f("sinh",{number:p,Complex:function(a){var d=Math.cos(a.im),c=Math.sin(a.im),e=Math.exp(a.re);a=Math.exp(-a.re);return new b.Complex(d*(e-a)/2,c*(e+a)/2)},BigNumber:function(d){return a(d,b.BigNumber,!0,!1)},Unit:function(a){if(!a.hasBase(b.Unit.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sinh is no angle");return p(a.value)},"Array | Matrix":function(a){return c(a,k,!0)}});k.toTex="\\sinh\\left(${args[0]}\\right)"; +return k}},function(q,h,g){var p=g(25),c=g(26);h.name="cos";h.factory=function(a,b,d,e){var f=e.find(d(g(31)),["number"]),k=e.find(d(g(33)),["number"]),m=e("cos",{number:Math.cos,Complex:function(b){return new a.Complex(Math.cos(b.re)*f(-b.im),Math.sin(b.re)*k(-b.im))},BigNumber:function(b){return c(b,a.BigNumber,0,!1)},Unit:function(b){if(!b.hasBase(a.Unit.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cos is no angle");return Math.cos(b.value)},"Array | Matrix":function(a){return p(a,m)}}); +m.toTex="\\cos\\left(${args[0]}\\right)";return m}},function(q,h,g){var p=g(25);h.name="sqrt";h.factory=function(c,a,b,d){function e(b){return 0<=b||a.predictable?Math.sqrt(b):f(new c.Complex(b,0))}function f(a){var b=Math.sqrt(a.re*a.re+a.im*a.im),d;d=0<=a.re?.5*Math.sqrt(2*(b+a.re)):Math.abs(a.im)/Math.sqrt(2*(b-a.re));b=0>=a.re?.5*Math.sqrt(2*(b-a.re)):Math.abs(a.im)/Math.sqrt(2*(b+a.re));return 0<=a.im?new c.Complex(d,b):new c.Complex(d,-b)}var k=d("sqrt",{number:e,Complex:f,BigNumber:function(b){return!b.isNegative()|| +a.predictable?b.sqrt():e(b.toNumber())},"Array | Matrix":function(a){return p(a,k,!0)},Unit:function(a){return a.pow(.5)}});k.toTex="\\sqrt{${args[0]}}";return k}},function(q,h,g){h.name="norm";h.factory=function(h,c,a,b){function d(a,b){var c=a.size();if(1==c.length){if(b===Number.POSITIVE_INFINITY||"inf"===b){var w=0;a.forEach(function(a){a=e(a);n(a,w)&&(w=a)},!0);return w}if(b===Number.NEGATIVE_INFINITY||"-inf"===b){var g;a.forEach(function(a){a=e(a);if(!g||r(a,g))g=a},!0);return g||0}if("fro"=== +b)return d(a,2);if("number"===typeof b&&!isNaN(b)){if(!B(b,0)){var h=0;a.forEach(function(a){h=f(k(e(a),b),h)},!0);return k(h,1/b)}return Number.POSITIVE_INFINITY}throw Error("Unsupported parameter value");}if(2==c.length){if(1===b){var t=[],p=0;a.forEach(function(a,b){var d=b[1],c=f(t[d]||0,e(a));n(c,p)&&(p=c);t[d]=c},!0);return p}if(b===Number.POSITIVE_INFINITY||"inf"===b){var q=[],F=0;a.forEach(function(a,b){var d=b[0],c=f(q[d]||0,e(a));n(c,F)&&(F=c);q[d]=c},!0);return F}if("fro"===b)return m(l(y(v(a), +a)));if(2===b)throw Error("Unsupported parameter value, missing implementation of matrix singular value decomposition");throw Error("Unsupported parameter value");}}var e=a(g(37)),f=a(g(38)),k=a(g(48)),m=a(g(35)),y=a(g(53)),B=a(g(44)),n=a(g(56)),r=a(g(60)),w=a(g(39)),l=a(g(61)),v=a(g(62));h=b.find(e,["Complex"]);var t=b("norm",{number:Math.abs,Complex:h,BigNumber:function(a){return a.abs()},"boolean | null":function(a){return Math.abs(a)},Array:function(a){return d(w(a),2)},Matrix:function(a){return d(a, +2)},"number | Complex | BigNumber | boolean | null, number | BigNumber | string":function(a){return t(a)},"Array, number | BigNumber | string":function(a,b){return d(w(a),b)},"Matrix, number | BigNumber | string":function(a,b){return d(a,b)}});t.toTex={1:"\\left\\|${args[0]}\\right\\|",2:"\\mathrm{${name}}\\left(${args}\\right)"};return t}},function(q,h,g){var p=g(25);h.name="abs";h.factory=function(c,a,b,d){var e=d("abs",{number:Math.abs,Complex:function(a){var b=Math.abs(a.re);a=Math.abs(a.im); +if(1E3>b&&1E3>a)return Math.sqrt(b*b+a*a);if(b>=a)return a/=b,b*Math.sqrt(1+a*a);b/=a;return a*Math.sqrt(1+b*b)},BigNumber:function(a){return a.abs()},Fraction:function(a){return a.abs()},"Array | Matrix":function(a){return p(a,e,!0)},Unit:function(a){a=a.clone();a.value=Math.abs(a.value);return a}});e.toTex="\\left|${args[0]}\\right|";return e}},function(q,h,g){var p=g(3).extend;h.name="add";h.factory=function(c,a,b,d){var e=b(g(39)),f=b(g(40));c=g(41);var k=b(g(42)),m=b(g(43)),y=b(g(45)),B=b(g(46)), +n=b(g(47)),r=d("add",p({"Matrix, Matrix":function(a,b){var d;switch(a.storage()){case "sparse":switch(b.storage()){case "sparse":d=m(a,b,f);break;default:d=k(b,a,f,!0)}break;default:switch(b.storage()){case "sparse":d=k(a,b,f,!1);break;default:d=B(a,b,f)}}return d},"Array, Array":function(a,b){return r(e(a),e(b)).valueOf()},"Array, Matrix":function(a,b){return r(e(a),b)},"Matrix, Array":function(a,b){return r(a,e(b))},"Matrix, any":function(a,b){var d;switch(a.storage()){case "sparse":d=y(a,b,f,!1); +break;default:d=n(a,b,f,!1)}return d},"any, Matrix":function(a,b){var d;switch(b.storage()){case "sparse":d=y(b,a,f,!0);break;default:d=n(b,a,f,!0)}return d},"Array, any":function(a,b){return n(e(a),b,f,!1).valueOf()},"any, Array":function(a,b){return n(e(b),a,f,!0).valueOf()}},f.signatures));r.toTex="\\left(${args[0]}"+c.operators.add+"${args[1]}\\right)";return r}},function(q,h){h.name="matrix";h.factory=function(g,h,c,a){function b(a,b,c){return new (g.Matrix.storage(b||"default"))(a,c)}h=a("matrix", +{"":function(){return b([])},string:function(a){return b([],a)},"string, string":function(a,c){return b([],a,c)},Array:function(a){return b(a)},Matrix:function(a){return b(a,a.storage())},"Array | Matrix, string":b,"Array | Matrix, string, string":b});h.toTex={0:"\\begin{bmatrix}\\end{bmatrix}",1:"\\left(${args[0]}\\right)",2:"\\left(${args[0]}\\right)"};return h}},function(q,h){h.factory=function(g,h,c,a){return a("add",{"number, number":function(a,d){return a+d},"Complex, Complex":function(a,d){return new g.Complex(a.re+ +d.re,a.im+d.im)},"BigNumber, BigNumber":function(a,d){return a.plus(d)},"Fraction, Fraction":function(a,d){return a.add(d)},"Unit, Unit":function(a,d){if(null==a.value)throw Error("Parameter x contains a unit with undefined value");if(null==d.value)throw Error("Parameter y contains a unit with undefined value");if(!a.equalBase(d))throw Error("Units do not match");var c=a.clone();c.value+=d.value;c.fixPrefix=!1;return c}})}},function(q,h){h.symbols={Alpha:"A",alpha:"\\alpha",Beta:"B",beta:"\\beta", +Gamma:"\\Gamma",gamma:"\\gamma",Delta:"\\Delta",delta:"\\delta",Epsilon:"E",epsilon:"\\epsilon",varepsilon:"\\varepsilon",Zeta:"Z",zeta:"\\zeta",Eta:"H",eta:"\\eta",Theta:"\\Theta",theta:"\\theta",vartheta:"\\vartheta",Iota:"I",iota:"\\iota",Kappa:"K",kappa:"\\kappa",varkappa:"\\varkappa",Lambda:"\\Lambda",lambda:"\\lambda",Mu:"M",mu:"\\mu",Nu:"N",nu:"\\nu",Xi:"\\Xi",xi:"\\xi",Omicron:"O",omicron:"o",Pi:"\\Pi",pi:"\\pi",varpi:"\\varpi",Rho:"P",rho:"\\rho",varrho:"\\varrho",Sigma:"\\Sigma",sigma:"\\sigma", +varsigma:"\\varsigma",Tau:"T",tau:"\\tau",Upsilon:"\\Upsilon",upsilon:"\\upsilon",Phi:"\\Phi",phi:"\\phi",varphi:"\\varphi",Chi:"X",chi:"\\chi",Psi:"\\Psi",psi:"\\psi",Omega:"\\Omega",omega:"\\omega","true":"\\mathrm{True}","false":"\\mathrm{False}",i:"i",inf:"\\infty",Inf:"\\infty",infinity:"\\infty",Infinity:"\\infty",oo:"\\infty",lim:"\\lim",undefined:"\\mathbf{?}"};h.operators={transpose:"^\\top",factorial:"!",pow:"^",dotPow:".^\\wedge",unaryPlus:"+",unaryMinus:"-",bitNot:"~",not:"\\neg",multiply:"\\cdot", +divide:"\\frac",dotMultiply:".\\cdot",dotDivide:".:",mod:"\\mod",add:"+",subtract:"-",to:"\\rightarrow",leftShift:"<<",rightArithShift:">>",rightLogShift:">>>",equal:"=",unequal:"\\neq",smaller:"<",larger:">",smallerEq:"\\leq",largerEq:"\\geq",bitAnd:"\\&",bitXor:"\\underline{|}",bitOr:"|",and:"\\wedge",xor:"\\veebar",or:"\\vee"};h.defaultTemplate="\\mathrm{${name}}\\left(${args}\\right)";var g={deg:"^\\circ"};h.toSymbol=function(p,c){if("undefined"===typeof c?0:c)return g.hasOwnProperty(p)?g[p]: +"\\mathrm{"+p+"}";if(h.symbols.hasOwnProperty(p))return h.symbols[p];if(-1!==p.indexOf("_")){var a=p.indexOf("_");return h.toSymbol(p.substring(0,a))+"_{"+h.toSymbol(p.substring(a+1))+"}"}return p}},function(q,h,g){var p=g(19);h.name="algorithm01";h.factory=function(c,a,b,d){var e=c.DenseMatrix;return function(a,b,c,y){var B=a._data,n=a._size,r=a._datatype;a=b._values;var g=b._index,l=b._ptr,h=b._size,t=b._datatype;if(n.length!==h.length)throw new p(n.length,h.length);if(n[0]!==h[0]||n[1]!==h[1])throw new RangeError("Dimension mismatch. Matrix A ("+ +n+") must match Matrix B ("+h+")");if(!a)throw Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");b=n[0];n=n[1];c=(r="string"===typeof r&&r===t?r:void 0)?d.find(c,[r,r]):c;for(var u=[],t=0;tb)throw new TypeError("For A^b, b must be a positive integer (value is "+b+")");var d=c(a);if(2!=d.length)throw Error("For A^b, A must be 2 dimensional (A has "+d.length+" dimensions)");if(d[0]!=d[1])throw Error("For A^b, A must be square (size is "+d[0]+"x"+d[1]+")");for(var d=r(d[0]).valueOf(),e=a;1<=b;)1==(b&1)&&(d=l(e,d)),b>>=1,e=l(e,e);return d}function y(a,b){return v(m(a.valueOf(), +b))}var B=g(41),n=d(g(49)),r=d(g(50)),h=d(g(51)),l=d(g(53)),v=d(g(39));d=e("pow",{"number, number":f,"Complex, Complex":k,"BigNumber, BigNumber":function(d,c){return c.isInteger()||0<=d||b.predictable?d.pow(c):k(new a.Complex(d.toNumber(),0),new a.Complex(c.toNumber(),0))},"Fraction, Fraction":function(a,d){if(1!==d.d){if(b.predictable)throw Error("Function pow does not support non-integer exponents for fractions.");return f(a.valueOf(),d.valueOf())}return a.pow(d)},"Array, number":m,"Array, BigNumber":function(a, +b){return m(a,b.toNumber())},"Matrix, number":y,"Matrix, BigNumber":function(a,b){return y(a,b.toNumber())},"Unit, number":function(a,b){return a.pow(b)}});d.toTex="\\left(${args[0]}\\right)"+B.operators.pow+"{${args[1]}}";return d}},function(q,h,g){var p=g(25);h.name="exp";h.factory=function(c,a,b,d){var e=d("exp",{number:Math.exp,Complex:function(a){var b=Math.exp(a.re);return new c.Complex(b*Math.cos(a.im),b*Math.sin(a.im))},BigNumber:function(a){return a.exp()},"Array | Matrix":function(a){return p(a, +e)}});e.toTex="\\exp\\left(${args[0]}\\right)";return e}},function(q,h,g){var p=g(15),c=g(6).isInteger;h.name="eye";h.factory=function(a,b,d,e){function f(a,b){switch(a.length){case 0:return b?m(b):[];case 1:return k(a[0],a[0],b);case 2:return k(a[0],a[1],b);default:throw Error("Vector containing two values expected");}}function k(b,d,e){var f=b&&!0===b.isBigNumber?a.BigNumber:d&&!0===d.isBigNumber?a.BigNumber:null;b&&!0===b.isBigNumber&&(b=b.toNumber());d&&!0===d.isBigNumber&&(d=d.toNumber());if(!c(b)|| +1>b)throw Error("Parameters in function eye must be positive integers");if(!c(d)||1>d)throw Error("Parameters in function eye must be positive integers");var k=f?new a.BigNumber(1):1,f=f?new f(0):0,m=[b,d];if(e)return a.Matrix.storage(e).diagonal(m,k,0,f);e=p.resize([],m,f);b=bka)for(var Y=0,O=0;Ob},"number, number":function(b,d){return b>d&&!p(b,d,a.epsilon)},"BigNumber, BigNumber":function(a,b){return a.gt(b)},"Fraction, Fraction":function(a,b){return 1===a.compare(b)},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers");},"Unit, Unit":function(b,d){if(!b.equalBase(d))throw Error("Cannot compare units with different base");return b.value>d.value&&!p(b.value,d.value, +a.epsilon)},"string, string":function(a,b){return a>b},"Matrix, Matrix":function(a,b){var d;switch(a.storage()){case "sparse":switch(b.storage()){case "sparse":d=k(a,b,n);break;default:d=f(b,a,n,!0)}break;default:switch(b.storage()){case "sparse":d=f(a,b,n,!1);break;default:d=y(a,b,n)}}return d},"Array, Array":function(a,b){return n(e(a),e(b)).valueOf()},"Array, Matrix":function(a,b){return n(e(a),b)},"Matrix, Array":function(a,b){return n(a,e(b))},"Matrix, any":function(a,b){var d;switch(a.storage()){case "sparse":d= +m(a,b,n,!1);break;default:d=h(a,b,n,!1)}return d},"any, Matrix":function(a,b){var d;switch(b.storage()){case "sparse":d=m(b,a,n,!0);break;default:d=h(b,a,n,!0)}return d},"Array, any":function(a,b){return h(e(a),b,n,!1).valueOf()},"any, Array":function(a,b){return h(e(b),a,n,!0).valueOf()}});n.toTex="\\left(${args[0]}"+c.operators.larger+"${args[1]}\\right)";return n}},function(q,h,g){var p=g(19);h.name="algorithm03";h.factory=function(c,a,b,d){var e=c.DenseMatrix;return function(a,b,c,y){var g=a._data, +n=a._size,h=a._datatype;a=b._values;var w=b._index,l=b._ptr,v=b._size,t=b._datatype;if(n.length!==v.length)throw new p(n.length,v.length);if(n[0]!==v[0]||n[1]!==v[1])throw new RangeError("Dimension mismatch. Matrix A ("+n+") must match Matrix B ("+v+")");if(!a)throw Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");b=n[0];var n=n[1],u,v=0,s=c;"string"===typeof h&&h===t&&(u=h,v=d.convert(0,u),s=d.find(c,[u,u]));c=[];for(h=0;hm)break}b=f}else throw new RangeError("Matrix must be square (size: "+c(f)+")");}return b},any:p});m.toTex="\\mathrm{tr}\\left(${args[0]}\\right)";return m}},function(q,h,g){var p=g(3).clone,c=g(16).format;h.name= +"transpose";h.factory=function(a,b,d,e){b=g(41);var f=d(g(39)),k=a.DenseMatrix,m=a.SparseMatrix,h=e("transpose",{Array:function(a){return h(f(a)).valueOf()},Matrix:function(a){var b=a.size(),d;switch(b.length){case 1:d=a.clone();break;case 2:var e=b[0],f=b[1];if(0===f)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+c(b)+")");switch(a.storage()){case "dense":b=a._data;d=[];for(var h,g=0;gthis.depCount&&!this.defined){if(c(k)){if(this.events.error&& +this.map.isDefine||l.onError!==B)try{f=S.execCb(d,k,b,f)}catch(m){a=m}else f=S.execCb(d,k,b,f);this.map.isDefine&&void 0===f&&((b=this.module)?f=b.exports:this.usingExports&&(f=this.exports));if(a)return a.requireMap=this.map,a.requireModules=this.map.isDefine?[this.map.id]:null,a.requireType=this.map.isDefine?"define":"require",A(this.error=a)}else f=k;this.exports=f;if(this.map.isDefine&&!this.ignore&&(aa[d]=f,l.onResourceLoad))l.onResourceLoad(S,this.map,this.depMaps);z(d);this.defined=!0}this.defining= +!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else e(S.defQueueMap,d)||this.fetch()}},callPlugin:function(){var a=this.map,b=a.id,d=q(a.prefix);this.depMaps.push(d);v(d,"defined",y(this,function(d){var c,m;m=f($,this.map.id);var g=this.map.name,n=this.map.parentMap?this.map.parentMap.name:null,B=S.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(d.normalize&&(g=d.normalize(g,function(a){return h(a, +n,!0)})||""),d=q(a.prefix+"!"+g,this.map.parentMap),v(d,"defined",y(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),m=f(Y,d.id)){this.depMaps.push(d);if(this.events.error)m.on("error",y(this,function(a){this.emit("error",a)}));m.enable()}}else m?(this.map.url=S.nameToUrl(m),this.load()):(c=y(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),c.error=y(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b];k(Y,function(a){0===a.map.id.indexOf(b+ +"_unnormalized")&&z(a.map.id)});A(a)}),c.fromText=y(this,function(d,f){var k=a.name,m=q(k),g=Z;f&&(d=f);g&&(Z=!1);u(m);e(W.config,b)&&(W.config[k]=W.config[b]);try{l.exec(d)}catch(h){return A(r("fromtexteval","fromText eval for "+b+" failed: "+h,h,[b]))}g&&(Z=!0);this.depMaps.push(m);S.completeLoad(k);B([k],c)}),d.load(a.name,B,c,W))}));S.enable(d,this);this.pluginMaps[d.id]=d},enable:function(){Q[this.map.id]=this;this.enabling=this.enabled=!0;b(this.depMaps,y(this,function(a,b){var d,c;if("string"=== +typeof a){a=q(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(d=f(M,a.id)){this.depExports[b]=d(this);return}this.depCount+=1;v(a,"defined",y(this,function(a){this.undefed||(this.defineDep(b,a),this.check())}));this.errback?v(a,"error",y(this,this.errback)):this.events.error&&v(a,"error",y(this,function(a){this.emit("error",a)}))}d=a.id;c=Y[d];!e(M,d)&&c&&!c.enabled&&S.enable(a,this)}));k(this.pluginMaps,y(this,function(a){var b=f(Y,a.id);b&&!b.enabled&&S.enable(a, +this)}));this.enabling=!1;this.check()},on:function(a,b){var d=this.events[a];d||(d=this.events[a]=[]);d.push(b)},emit:function(a,d){b(this.events[a],function(a){a(d)});"error"===a&&delete this.events[a]}};S={config:W,contextName:g,registry:Y,defined:aa,urlFetched:pa,defQueue:da,defQueueMap:{},Module:U,makeModuleMap:q,nextTick:l.nextTick,onError:A,configure:function(d){d.baseUrl&&"/"!==d.baseUrl.charAt(d.baseUrl.length-1)&&(d.baseUrl+="/");var c=W.shim,e={paths:!0,bundles:!0,config:!0,map:!0};k(d, +function(a,b){e[b]?(W[b]||(W[b]={}),m(W[b],a,!0,!0)):W[b]=a});d.bundles&&k(d.bundles,function(a,d){b(a,function(a){a!==d&&($[a]=d)})});d.shim&&(k(d.shim,function(b,d){a(b)&&(b={deps:b});!b.exports&&!b.init||b.exportsFn||(b.exportsFn=S.makeShimExports(b));c[d]=b}),W.shim=c);d.packages&&b(d.packages,function(a){var b;a="string"===typeof a?{name:a}:a;b=a.name;a.location&&(W.paths[b]=a.location);W.pkgs[b]=a.name+"/"+(a.main||"main").replace(D,"").replace(F,"")});k(Y,function(a,b){a.inited||a.map.unnormalized|| +(a.map=q(b,null,!0))});(d.deps||d.callback)&&S.require(d.deps||[],d.callback)},makeShimExports:function(a){return function(){var b;a.init&&(b=a.init.apply(p,arguments));return b||a.exports&&n(a.exports)}},makeRequire:function(a,b){function k(d,f,m){var h,y;b.enableBuildCallback&&f&&c(f)&&(f.__requireJsBuild=!0);if("string"===typeof d){if(c(f))return A(r("requireargs","Invalid require call"),m);if(a&&e(M,d))return M[d](Y[a.id]);if(l.get)return l.get(S,d,a,k);h=q(d,a,!1,!0);h=h.id;return e(aa,h)?aa[h]: +A(r("notloaded",'Module name "'+h+'" has not been loaded yet for context: '+g+(a?"":". Use require([])")))}J();S.nextTick(function(){J();y=u(q(null,a));y.skipMap=b.skipMap;y.init(d,f,m,{enabled:!0});E()});return k}b=b||{};m(k,{isBrowser:P,toUrl:function(b){var d,c=b.lastIndexOf("."),e=b.split("/")[0];-1!==c&&("."!==e&&".."!==e||1e.attachEvent.toString().indexOf("[native code")||I?(e.addEventListener("load",a.onScriptLoad,!1),e.addEventListener("error",a.onScriptError,!1)):(Z=!0,e.attachEvent("onreadystatechange",a.onScriptLoad));e.src=d;J=e;u?t.insertBefore(e,u):t.appendChild(e);J=null;return e}if(G)try{importScripts(d), +a.completeLoad(b)}catch(f){a.onError(r("importscripts","importScripts failed for "+b+" at "+d,f,[b]))}};P&&!V.skipDataMain&&d(document.getElementsByTagName("script"),function(a){t||(t=a.parentNode);if(s=a.getAttribute("data-main"))return z=s,V.baseUrl||(A=z.split("/"),z=A.pop(),E=A.length?A.join("/")+"/":"./",V.baseUrl=E),z=z.replace(F,""),l.jsExtRegExp.test(z)&&(z=s),V.deps=V.deps?V.deps.concat(z):[z],!0});g=function(b,e,f){var k,m;"string"!==typeof b&&(f=e,e=b,b=null);a(e)||(f=e,e=null);!e&&c(f)&& +(e=[],f.length&&(f.toString().replace(K,"").replace(H,function(a,b){e.push(b)}),e=(1===f.length?["require"]:["require","exports","module"]).concat(e)));Z&&((k=J)||(x&&"interactive"===x.readyState||d(document.getElementsByTagName("script"),function(a){if("interactive"===a.readyState)return x=a}),k=x),k&&(b||(b=k.getAttribute("data-requiremodule")),m=M[k.getAttribute("data-requirecontext")]));m?(m.defQueue.push([b,e,f]),m.defQueueMap[b]=!0):X.push([b,e,f])};g.amd={jQuery:!0};l.exec=function(a){return eval(a)}; +l(V)}})(this)},function(O,Q,R){var q,h,g;(function(p,c){!(h=[Q],q=c,g="function"===typeof q?q.apply(Q,h):q,void 0!==g&&(O.exports=g))})(this,function(h){var c={REVISION:"72"};!(q=c,g="function"===typeof q?q.call(h,R,h,O):q,void 0!==g&&(O.exports=g));void 0!==self.requestAnimationFrame&&void 0!==self.cancelAnimationFrame||function(){for(var a=0,b=["ms","moz","webkit","o"],d=0;da?-1:0>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},setRGB:function(a,b,d){this.r=a;this.g=b;this.b=d;return this},setHSL:function(){function a(a,d,c){0>c&&(c+=1);1c?d:c<2/3?a+6*(d-a)*(2/3-c):a}return function(b, +d,e){b=c.Math.euclideanModulo(b,1);d=c.Math.clamp(d,0,1);e=c.Math.clamp(e,0,1);0===d?this.r=this.g=this.b=e:(d=.5>=e?e*(1+d):e+d-e*d,e=2*e-d,this.r=a(e,d,b+1/3),this.g=a(e,d,b),this.b=a(e,d,b-1/3));return this}}(),setStyle:function(a){var b=function(b){b=parseFloat(b);1>b&&console.warn("THREE.Color: Alpha component of color "+a+" will be ignored.");return b},d;if(d=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(a)){var e=d[2];switch(d[1]){case "rgb":if(d=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*$/.exec(e))return this.r= +Math.min(255,parseInt(d[1],10))/255,this.g=Math.min(255,parseInt(d[2],10))/255,this.b=Math.min(255,parseInt(d[3],10))/255,this;if(d=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*$/.exec(e))return this.r=Math.min(100,parseInt(d[1],10))/100,this.g=Math.min(100,parseInt(d[2],10))/100,this.b=Math.min(100,parseInt(d[3],10))/100,this;break;case "rgba":if(d=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([0-9]*\.?[0-9]+)\s*$/.exec(e))return this.r=Math.min(255,parseInt(d[1],10))/255,this.g=Math.min(255,parseInt(d[2],10))/ +255,this.b=Math.min(255,parseInt(d[3],10))/255,b(d[4]),this;if(d=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*([0-9]*\.?[0-9]+)\s*$/.exec(e))return this.r=Math.min(100,parseInt(d[1],10))/100,this.g=Math.min(100,parseInt(d[2],10))/100,this.b=Math.min(100,parseInt(d[3],10))/100,b(d[4]),this;break;case "hsl":if(d=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*$/.exec(e)){var e=parseFloat(d[1]),f=parseInt(d[2],10)/100,k=parseInt(d[3],10)/100;return this.setHSL(e,f,k)}break;case "hsla":if(d=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*([0-9]*\.?[0-9]+)\s*$/.exec(e))return e= +parseFloat(d[1]),f=parseInt(d[2],10)/100,k=parseInt(d[3],10)/100,b(d[4]),this.setHSL(e,f,k)}}else if(d=/^\#([A-Fa-f0-9]+)$/.exec(a)){b=d[1];d=b.length;if(3===d)return this.r=parseInt(b.charAt(0)+b.charAt(0),16)/255,this.g=parseInt(b.charAt(1)+b.charAt(1),16)/255,this.b=parseInt(b.charAt(2)+b.charAt(2),16)/255,this;if(6===d)return this.r=parseInt(b.charAt(0)+b.charAt(1),16)/255,this.g=parseInt(b.charAt(2)+b.charAt(3),16)/255,this.b=parseInt(b.charAt(4)+b.charAt(5),16)/255,this}a&&0=g?h/(f+k): +h/(2-f-k);switch(f){case b:m=(d-c)/h+(dk&&d>b?(d=2*Math.sqrt(1+d-k-b),this._w=(h-m)/d,this._x=.25*d,this._y=(a+f)/d,this._z=(c+g)/d):k>b?(d=2*Math.sqrt(1+k-d-b),this._w=(c-g)/d,this._x=(a+f)/d,this._y=.25*d,this._z=(m+h)/d):(d=2*Math.sqrt(1+b-d-k),this._w=(f-a)/d,this._x=(c+g)/d,this._y=(m+h)/d,this._z=.25*d);this.onChangeCallback();return this},setFromUnitVectors:function(){var a,b;return function(d,e){void 0===a&&(a=new c.Vector3);b=d.dot(e)+ +1;1E-6>b?(b=0,Math.abs(d.x)>Math.abs(d.z)?a.set(-d.y,d.x,0):a.set(0,-d.z,d.y)):a.crossVectors(d,e);this._x=a.x;this._y=a.y;this._z=a.z;this._w=b;this.normalize();return this}}(),inverse:function(){this.conjugate().normalize();return this},conjugate:function(){this._x*=-1;this._y*=-1;this._z*=-1;this.onChangeCallback();return this},dot:function(a){return this._x*a._x+this._y*a._y+this._z*a._z+this._w*a._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}, +length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var a=this.length();0===a?(this._z=this._y=this._x=0,this._w=1):(a=1/a,this._x*=a,this._y*=a,this._z*=a,this._w*=a);this.onChangeCallback();return this},multiply:function(a,b){return void 0!==b?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(a,b)):this.multiplyQuaternions(this,a)}, +multiplyQuaternions:function(a,b){var d=a._x,c=a._y,f=a._z,k=a._w,m=b._x,g=b._y,h=b._z,n=b._w;this._x=d*n+k*m+c*h-f*g;this._y=c*n+k*g+f*m-d*h;this._z=f*n+k*h+d*g-c*m;this._w=k*n-d*m-c*g-f*h;this.onChangeCallback();return this},multiplyVector3:function(a){console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.");return a.applyQuaternion(this)},slerp:function(a,b){if(0===b)return this;if(1===b)return this.copy(a);var d=this._x,c= +this._y,f=this._z,k=this._w,m=k*a._w+d*a._x+c*a._y+f*a._z;0>m?(this._w=-a._w,this._x=-a._x,this._y=-a._y,this._z=-a._z,m=-m):this.copy(a);if(1<=m)return this._w=k,this._x=d,this._y=c,this._z=f,this;var g=Math.acos(m),h=Math.sqrt(1-m*m);if(.001>Math.abs(h))return this._w=.5*(k+this._w),this._x=.5*(d+this._x),this._y=.5*(c+this._y),this._z=.5*(f+this._z),this;m=Math.sin((1-b)*g)/h;g=Math.sin(b*g)/h;this._w=k*m+this._w*g;this._x=d*m+this._x*g;this._y=c*m+this._y*g;this._z=f*m+this._z*g;this.onChangeCallback(); +return this},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._w===this._w},fromArray:function(a,b){void 0===b&&(b=0);this._x=a[b];this._y=a[b+1];this._z=a[b+2];this._w=a[b+3];this.onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._w;return a},onChange:function(a){this.onChangeCallback=a;return this},onChangeCallback:function(){}};c.Quaternion.slerp=function(a,b,d,c){return d.copy(a).slerp(b, +c)};c.Vector2=function(a,b){this.x=a||0;this.y=b||0};c.Vector2.prototype={constructor:c.Vector2,set:function(a,b){this.x=a;this.y=b;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;default:throw Error("index is out of range: "+a);}},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x, +this.y)},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;return this},addScalar:function(a){this.x+=a;this.y+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), +this.subVectors(a,b);this.x-=a.x;this.y-=a.y;return this},subScalar:function(a){this.x-=a;this.y-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiply:function(a){this.x*=a.x;this.y*=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},divide:function(a){this.x/=a.x;this.y/=a.y;return this},divideScalar:function(a){0!==a?(a=1/a,this.x*=a,this.y*=a):this.y=this.x=0;return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y= +a.y);return this},max:function(a){this.xb.x&&(this.x=b.x);this.yb.y&&(this.y=b.y);return this},clampScalar:function(){var a,b;return function(d,e){void 0===a&&(a=new c.Vector2,b=new c.Vector2);a.set(d,d);b.set(e,e);return this.clamp(a,b)}}(),floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this},ceil:function(){this.x=Math.ceil(this.x);this.y= +Math.ceil(this.y);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);return this},negate:function(){this.x=-this.x;this.y=-this.y;return this},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+ +Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x;a=this.y-a.y;return b*b+a*a},setLength:function(a){var b=this.length();0!==b&&a!==b&&this.multiplyScalar(a/b);return this},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;return this},lerpVectors:function(a,b,d){this.subVectors(b,a).multiplyScalar(d).add(a);return this},equals:function(a){return a.x=== +this.x&&a.y===this.y},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;return a},fromAttribute:function(a,b,d){void 0===d&&(d=0);b=b*a.itemSize+d;this.x=a.array[b];this.y=a.array[b+1];return this}};c.Vector3=function(a,b,d){this.x=a||0;this.y=b||0;this.z=d||0};c.Vector3.prototype={constructor:c.Vector3,set:function(a,b,d){this.x=a;this.y=b;this.z=d;return this},setX:function(a){this.x= +a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;default:throw Error("index is out of range: "+a);}},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(a){this.x=a.x;this.y= +a.y;this.z=a.z;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;this.z+=a.z*b;return this},sub:function(a,b){if(void 0!== +b)return console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},subScalar:function(a){this.x-=a;this.y-=a;this.z-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},multiply:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(a, +b);this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},multiplyVectors:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},applyEuler:function(){var a;return function(b){!1===b instanceof c.Euler&&console.error("THREE.Vector3: .applyEuler() now expects a Euler rotation rather than a Vector3 and order.");void 0===a&&(a=new c.Quaternion);this.applyQuaternion(a.setFromEuler(b));return this}}(),applyAxisAngle:function(){var a; +return function(b,d){void 0===a&&(a=new c.Quaternion);this.applyQuaternion(a.setFromAxisAngle(b,d));return this}}(),applyMatrix3:function(a){var b=this.x,d=this.y,c=this.z;a=a.elements;this.x=a[0]*b+a[3]*d+a[6]*c;this.y=a[1]*b+a[4]*d+a[7]*c;this.z=a[2]*b+a[5]*d+a[8]*c;return this},applyMatrix4:function(a){var b=this.x,d=this.y,c=this.z;a=a.elements;this.x=a[0]*b+a[4]*d+a[8]*c+a[12];this.y=a[1]*b+a[5]*d+a[9]*c+a[13];this.z=a[2]*b+a[6]*d+a[10]*c+a[14];return this},applyProjection:function(a){var b= +this.x,d=this.y,c=this.z;a=a.elements;var f=1/(a[3]*b+a[7]*d+a[11]*c+a[15]);this.x=(a[0]*b+a[4]*d+a[8]*c+a[12])*f;this.y=(a[1]*b+a[5]*d+a[9]*c+a[13])*f;this.z=(a[2]*b+a[6]*d+a[10]*c+a[14])*f;return this},applyQuaternion:function(a){var b=this.x,d=this.y,c=this.z,f=a.x,k=a.y,m=a.z;a=a.w;var g=a*b+k*c-m*d,h=a*d+m*b-f*c,n=a*c+f*d-k*b,b=-f*b-k*d-m*c;this.x=g*a+b*-f+h*-m-n*-k;this.y=h*a+b*-k+n*-f-g*-m;this.z=n*a+b*-m+g*-k-h*-f;return this},project:function(){var a;return function(b){void 0===a&&(a=new c.Matrix4); +a.multiplyMatrices(b.projectionMatrix,a.getInverse(b.matrixWorld));return this.applyProjection(a)}}(),unproject:function(){var a;return function(b){void 0===a&&(a=new c.Matrix4);a.multiplyMatrices(b.matrixWorld,a.getInverse(b.projectionMatrix));return this.applyProjection(a)}}(),transformDirection:function(a){var b=this.x,d=this.y,c=this.z;a=a.elements;this.x=a[0]*b+a[4]*d+a[8]*c;this.y=a[1]*b+a[5]*d+a[9]*c;this.z=a[2]*b+a[6]*d+a[10]*c;this.normalize();return this},divide:function(a){this.x/=a.x; +this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){0!==a?(a=1/a,this.x*=a,this.y*=a,this.z*=a):this.z=this.y=this.x=0;return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);this.z>a.z&&(this.z=a.z);return this},max:function(a){this.xb.x&&(this.x=b.x);this.yb.y&&(this.y=b.y);this.zb.z&&(this.z= +b.z);return this},clampScalar:function(){var a,b;return function(d,e){void 0===a&&(a=new c.Vector3,b=new c.Vector3);a.set(d,d,d);b.set(e,e,e);return this.clamp(a,b)}}(),floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);return this},roundToZero:function(){this.x= +0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+ +Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){var b=this.length();0!==b&&a!==b&&this.multiplyScalar(a/b);return this},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;return this},lerpVectors:function(a,b,d){this.subVectors(b,a).multiplyScalar(d).add(a);return this},cross:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."), +this.crossVectors(a,b);var d=this.x,c=this.y,f=this.z;this.x=c*a.z-f*a.y;this.y=f*a.x-d*a.z;this.z=d*a.y-c*a.x;return this},crossVectors:function(a,b){var d=a.x,c=a.y,f=a.z,k=b.x,m=b.y,g=b.z;this.x=c*g-f*m;this.y=f*k-d*g;this.z=d*m-c*k;return this},projectOnVector:function(){var a,b;return function(d){void 0===a&&(a=new c.Vector3);a.copy(d).normalize();b=this.dot(a);return this.copy(a).multiplyScalar(b)}}(),projectOnPlane:function(){var a;return function(b){void 0===a&&(a=new c.Vector3);a.copy(this).projectOnVector(b); +return this.sub(a)}}(),reflect:function(){var a;return function(b){void 0===a&&(a=new c.Vector3);return this.sub(a.copy(b).multiplyScalar(2*this.dot(b)))}}(),angleTo:function(a){a=this.dot(a)/(this.length()*a.length());return Math.acos(c.Math.clamp(a,-1,1))},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return b*b+d*d+a*a},setEulerFromRotationMatrix:function(a,b){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")}, +setEulerFromQuaternion:function(a,b){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(a){console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().");return this.setFromMatrixPosition(a)},getScaleFromMatrix:function(a){console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().");return this.setFromMatrixScale(a)},getColumnFromMatrix:function(a, +b){console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().");return this.setFromMatrixColumn(a,b)},setFromMatrixPosition:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},setFromMatrixScale:function(a){var b=this.set(a.elements[0],a.elements[1],a.elements[2]).length(),d=this.set(a.elements[4],a.elements[5],a.elements[6]).length();a=this.set(a.elements[8],a.elements[9],a.elements[10]).length();this.x=b;this.y=d;this.z= +a;return this},setFromMatrixColumn:function(a,b){var d=4*a,c=b.elements;this.x=c[d];this.y=c[d+1];this.z=c[d+2];return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;return a},fromAttribute:function(a,b,d){void 0===d&&(d=0);b=b*a.itemSize+d;this.x=a.array[b];this.y=a.array[b+1];this.z= +a.array[b+2];return this}};c.Vector4=function(a,b,d,c){this.x=a||0;this.y=b||0;this.z=d||0;this.w=void 0!==c?c:1};c.Vector4.prototype={constructor:c.Vector4,set:function(a,b,d,c){this.x=a;this.y=b;this.z=d;this.w=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setW:function(a){this.w=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;case 3:this.w= +b;break;default:throw Error("index is out of range: "+a);}},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=void 0!==a.w?a.w:1;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."), +this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;this.w+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;this.z+=a.z*b;this.w+=a.w*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a, +b);this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},subScalar:function(a){this.x-=a;this.y-=a;this.z-=a;this.w-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},applyMatrix4:function(a){var b=this.x,d=this.y,c=this.z,f=this.w;a=a.elements;this.x=a[0]*b+a[4]*d+a[8]*c+a[12]*f;this.y=a[1]*b+a[5]*d+a[9]*c+a[13]*f;this.z=a[2]*b+a[6]*d+a[10]*c+a[14]* +f;this.w=a[3]*b+a[7]*d+a[11]*c+a[15]*f;return this},divideScalar:function(a){0!==a?(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a):(this.z=this.y=this.x=0,this.w=1);return this},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);1E-4>b?(this.x=1,this.z=this.y=0):(this.x=a.x/b,this.y=a.y/b,this.z=a.z/b);return this},setAxisAngleFromRotationMatrix:function(a){var b,d,c;a=a.elements;var f=a[0];c=a[4];var k=a[8],m=a[1],g=a[5],h=a[9];d=a[2];b=a[6];var n=a[10];if(.01> +Math.abs(c-m)&&.01>Math.abs(k-d)&&.01>Math.abs(h-b)){if(.1>Math.abs(c+m)&&.1>Math.abs(k+d)&&.1>Math.abs(h+b)&&.1>Math.abs(f+g+n-3))return this.set(1,0,0,0),this;a=Math.PI;f=(f+1)/2;g=(g+1)/2;n=(n+1)/2;c=(c+m)/4;k=(k+d)/4;h=(h+b)/4;f>g&&f>n?.01>f?(b=0,c=d=.707106781):(b=Math.sqrt(f),d=c/b,c=k/b):g>n?.01>g?(b=.707106781,d=0,c=.707106781):(d=Math.sqrt(g),b=c/d,c=h/d):.01>n?(d=b=.707106781,c=0):(c=Math.sqrt(n),b=k/c,d=h/c);this.set(b,d,c,a);return this}a=Math.sqrt((b-h)*(b-h)+(k-d)*(k-d)+(m-c)*(m-c)); +.001>Math.abs(a)&&(a=1);this.x=(b-h)/a;this.y=(k-d)/a;this.z=(m-c)/a;this.w=Math.acos((f+g+n-1)/2);return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);this.z>a.z&&(this.z=a.z);this.w>a.w&&(this.w=a.w);return this},max:function(a){this.xb.x&&(this.x=b.x);this.yb.y&&(this.y=b.y);this.zb.z&&(this.z=b.z);this.wb.w&&(this.w=b.w);return this},clampScalar:function(){var a,b;return function(d,e){void 0===a&&(a=new c.Vector4,b=new c.Vector4);a.set(d,d,d,d);b.set(e,e,e,e);return this.clamp(a,b)}}(),floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);this.w=Math.floor(this.w);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);this.w=Math.ceil(this.w);return this}, +round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);this.w=Math.round(this.w);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);this.w=0>this.w?Math.ceil(this.w):Math.floor(this.w);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this},dot:function(a){return this.x* +a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){var b=this.length();0!==b&&a!==b&&this.multiplyScalar(a/b);return this},lerp:function(a,b){this.x+= +(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this},lerpVectors:function(a,b,d){this.subVectors(b,a).multiplyScalar(d).add(a);return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&a.w===this.w},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];this.w=a[b+3];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;a[b+3]=this.w;return a},fromAttribute:function(a, +b,d){void 0===d&&(d=0);b=b*a.itemSize+d;this.x=a.array[b];this.y=a.array[b+1];this.z=a.array[b+2];this.w=a.array[b+3];return this}};c.Euler=function(a,b,d,e){this._x=a||0;this._y=b||0;this._z=d||0;this._order=e||c.Euler.DefaultOrder};c.Euler.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" ");c.Euler.DefaultOrder="XYZ";c.Euler.prototype={constructor:c.Euler,get x(){return this._x},set x(a){this._x=a;this.onChangeCallback()},get y(){return this._y},set y(a){this._y=a;this.onChangeCallback()},get z(){return this._z}, +set z(a){this._z=a;this.onChangeCallback()},get order(){return this._order},set order(a){this._order=a;this.onChangeCallback()},set:function(a,b,d,c){this._x=a;this._y=b;this._z=d;this._order=c||this._order;this.onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(a){this._x=a._x;this._y=a._y;this._z=a._z;this._order=a._order;this.onChangeCallback();return this},setFromRotationMatrix:function(a,b,d){var e=c.Math.clamp,f=a.elements; +a=f[0];var k=f[4],m=f[8],g=f[1],h=f[5],n=f[9],r=f[2],p=f[6],f=f[10];b=b||this._order;"XYZ"===b?(this._y=Math.asin(e(m,-1,1)),.99999>Math.abs(m)?(this._x=Math.atan2(-n,f),this._z=Math.atan2(-k,a)):(this._x=Math.atan2(p,h),this._z=0)):"YXZ"===b?(this._x=Math.asin(-e(n,-1,1)),.99999>Math.abs(n)?(this._y=Math.atan2(m,f),this._z=Math.atan2(g,h)):(this._y=Math.atan2(-r,a),this._z=0)):"ZXY"===b?(this._x=Math.asin(e(p,-1,1)),.99999>Math.abs(p)?(this._y=Math.atan2(-r,f),this._z=Math.atan2(-k,h)):(this._y= +0,this._z=Math.atan2(g,a))):"ZYX"===b?(this._y=Math.asin(-e(r,-1,1)),.99999>Math.abs(r)?(this._x=Math.atan2(p,f),this._z=Math.atan2(g,a)):(this._x=0,this._z=Math.atan2(-k,h))):"YZX"===b?(this._z=Math.asin(e(g,-1,1)),.99999>Math.abs(g)?(this._x=Math.atan2(-n,h),this._y=Math.atan2(-r,a)):(this._x=0,this._y=Math.atan2(m,f))):"XZY"===b?(this._z=Math.asin(-e(k,-1,1)),.99999>Math.abs(k)?(this._x=Math.atan2(p,h),this._y=Math.atan2(m,a)):(this._x=Math.atan2(-n,f),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+ +b);this._order=b;if(!1!==d)this.onChangeCallback();return this},setFromQuaternion:function(){var a;return function(b,d,e){void 0===a&&(a=new c.Matrix4);a.makeRotationFromQuaternion(b);this.setFromRotationMatrix(a,d,e);return this}}(),setFromVector3:function(a,b){return this.set(a.x,a.y,a.z,b||this._order)},reorder:function(){var a=new c.Quaternion;return function(b){a.setFromEuler(this);this.setFromQuaternion(a,b)}}(),equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order=== +this._order},fromArray:function(a){this._x=a[0];this._y=a[1];this._z=a[2];void 0!==a[3]&&(this._order=a[3]);this.onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._order;return a},toVector3:function(a){return a?a.set(this._x,this._y,this._z):new c.Vector3(this._x,this._y,this._z)},onChange:function(a){this.onChangeCallback=a;return this},onChangeCallback:function(){}};c.Matrix3=function(){this.elements= +new Float32Array([1,0,0,0,1,0,0,0,1]);0this.determinant()&&(m=-m);d.x=k[12];d.y=k[13];d.z=k[14];b.elements.set(this.elements);d=1/m;var k=1/g,n=1/h;b.elements[0]*=d;b.elements[1]*=d;b.elements[2]*=d;b.elements[4]*= +k;b.elements[5]*=k;b.elements[6]*=k;b.elements[8]*=n;b.elements[9]*=n;b.elements[10]*=n;e.setFromRotationMatrix(b);f.x=m;f.y=g;f.z=h;return this}}(),makeFrustum:function(a,b,d,c,f,k){var m=this.elements;m[0]=2*f/(b-a);m[4]=0;m[8]=(b+a)/(b-a);m[12]=0;m[1]=0;m[5]=2*f/(c-d);m[9]=(c+d)/(c-d);m[13]=0;m[2]=0;m[6]=0;m[10]=-(k+f)/(k-f);m[14]=-2*k*f/(k-f);m[3]=0;m[7]=0;m[11]=-1;m[15]=0;return this},makePerspective:function(a,b,d,e){a=d*Math.tan(c.Math.degToRad(.5*a));var f=-a;return this.makeFrustum(f*b,a* +b,f,a,d,e)},makeOrthographic:function(a,b,d,c,f,k){var m=this.elements,g=b-a,h=d-c,n=k-f;m[0]=2/g;m[4]=0;m[8]=0;m[12]=-((b+a)/g);m[1]=0;m[5]=2/h;m[9]=0;m[13]=-((d+c)/h);m[2]=0;m[6]=0;m[10]=-2/n;m[14]=-((k+f)/n);m[3]=0;m[7]=0;m[11]=0;m[15]=1;return this},equals:function(a){var b=this.elements;a=a.elements;for(var d=0;16>d;d++)if(b[d]!==a[d])return!1;return!0},fromArray:function(a){this.elements.set(a);return this},toArray:function(){var a=this.elements;return[a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7], +a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15]]}};c.Ray=function(a,b){this.origin=void 0!==a?a:new c.Vector3;this.direction=void 0!==b?b:new c.Vector3};c.Ray.prototype={constructor:c.Ray,set:function(a,b){this.origin.copy(a);this.direction.copy(b);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.origin.copy(a.origin);this.direction.copy(a.direction);return this},at:function(a,b){return(b||new c.Vector3).copy(this.direction).multiplyScalar(a).add(this.origin)}, +recast:function(){var a=new c.Vector3;return function(b){this.origin.copy(this.at(b,a));return this}}(),closestPointToPoint:function(a,b){var d=b||new c.Vector3;d.subVectors(a,this.origin);var e=d.dot(this.direction);return 0>e?d.copy(this.origin):d.copy(this.direction).multiplyScalar(e).add(this.origin)},distanceToPoint:function(a){return Math.sqrt(this.distanceSqToPoint(a))},distanceSqToPoint:function(){var a=new c.Vector3;return function(b){var d=a.subVectors(b,this.origin).dot(this.direction); +if(0>d)return this.origin.distanceToSquared(b);a.copy(this.direction).multiplyScalar(d).add(this.origin);return a.distanceToSquared(b)}}(),distanceSqToSegment:function(){var a=new c.Vector3,b=new c.Vector3,d=new c.Vector3;return function(c,f,k,m){a.copy(c).add(f).multiplyScalar(.5);b.copy(f).sub(c).normalize();d.copy(this.origin).sub(a);var g=.5*c.distanceTo(f),h=-this.direction.dot(b),n=d.dot(this.direction),r=-d.dot(b),p=d.lengthSq(),l=Math.abs(1-h*h),q;0=-q?f<= +q?(g=1/l,c*=g,f*=g,h=c*(c+h*f+2*n)+f*(h*c+f+2*r)+p):(f=g,c=Math.max(0,-(h*f+n)),h=-c*c+f*(f+2*r)+p):(f=-g,c=Math.max(0,-(h*f+n)),h=-c*c+f*(f+2*r)+p):f<=-q?(c=Math.max(0,-(-h*g+n)),f=0k)return null;k=Math.sqrt(k-f);f=e-k;e+=k;return 0>f&&0>e?null:0>f?this.at(e,c):this.at(f,c)}}(),isIntersectionPlane:function(a){var b=a.distanceToPoint(this.origin);return 0===b||0>a.normal.dot(this.direction)*b?!0:!1},distanceToPlane:function(a){var b= +a.normal.dot(this.direction);if(0===b)return 0===a.distanceToPoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+a.constant)/b;return 0<=a?a:null},intersectPlane:function(a,b){var c=this.distanceToPlane(a);return null===c?null:this.at(c,b)},isIntersectionBox:function(){var a=new c.Vector3;return function(b){return null!==this.intersectBox(b,a)}}(),intersectBox:function(a,b){var c,e,f,k,g;e=1/this.direction.x;k=1/this.direction.y;g=1/this.direction.z;var h=this.origin;0<=e?(c=(a.min.x-h.x)*e,e*= +a.max.x-h.x):(c=(a.max.x-h.x)*e,e*=a.min.x-h.x);0<=k?(f=(a.min.y-h.y)*k,k*=a.max.y-h.y):(f=(a.max.y-h.y)*k,k*=a.min.y-h.y);if(c>k||f>e)return null;if(f>c||c!==c)c=f;if(kg||f>e)return null;if(f>c||c!==c)c=f;if(ge?null:this.at(0<=c?c:e,b)},intersectTriangle:function(){var a=new c.Vector3,b=new c.Vector3,d=new c.Vector3,e=new c.Vector3;return function(c,k,g,h,p){b.subVectors(k,c);d.subVectors(g, +c);e.crossVectors(b,d);k=this.direction.dot(e);if(0k)h=-1,k=-k;else return null;a.subVectors(this.origin,c);c=h*this.direction.dot(d.crossVectors(a,d));if(0>c)return null;g=h*this.direction.dot(b.cross(a));if(0>g||c+g>k)return null;c=-h*a.dot(e);return 0>c?null:this.at(c/k,p)}}(),applyMatrix4:function(a){this.direction.add(this.origin).applyMatrix4(a);this.origin.applyMatrix4(a);this.direction.sub(this.origin);this.direction.normalize();return this},equals:function(a){return a.origin.equals(this.origin)&& +a.direction.equals(this.direction)}};c.Box2=function(a,b){this.min=void 0!==a?a:new c.Vector2(Infinity,Infinity);this.max=void 0!==b?b:new c.Vector2(-Infinity,-Infinity)};c.Box2.prototype={constructor:c.Box2,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setFromPoints:function(a){this.makeEmpty();for(var b=0,c=a.length;bthis.max.x||a.ythis.max.y?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y?!0:!1},getParameter:function(a,b){return(b||new c.Vector2).set((a.x- +this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y))},isIntersectionBox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y?!1:!0},clampPoint:function(a,b){return(b||new c.Vector2).copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new c.Vector2;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min); +this.max.max(a.max);return this},translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)}};c.Box3=function(a,b){this.min=void 0!==a?a:new c.Vector3(Infinity,Infinity,Infinity);this.max=void 0!==b?b:new c.Vector3(-Infinity,-Infinity,-Infinity)};c.Box3.prototype={constructor:c.Box3,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setFromPoints:function(a){this.makeEmpty();for(var b=0,c=a.length;bthis.max.x||a.ythis.max.y||a.zthis.max.z?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&&a.max.z<=this.max.z?!0:!1},getParameter:function(a,b){return(b||new c.Vector3).set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y),(a.z-this.min.z)/(this.max.z-this.min.z))},isIntersectionBox:function(a){return a.max.xthis.max.x||a.max.y +this.max.y||a.max.zthis.max.z?!1:!0},clampPoint:function(a,b){return(b||new c.Vector3).copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new c.Vector3;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),getBoundingSphere:function(){var a=new c.Vector3;return function(b){b=b||new c.Sphere;b.center=this.center();b.radius=.5*this.size(a).length();return b}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this}, +union:function(a){this.min.min(a.min);this.max.max(a.max);return this},applyMatrix4:function(){var a=[new c.Vector3,new c.Vector3,new c.Vector3,new c.Vector3,new c.Vector3,new c.Vector3,new c.Vector3,new c.Vector3];return function(b){a[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(b);a[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(b);a[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(b);a[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(b);a[4].set(this.max.x,this.min.y, +this.min.z).applyMatrix4(b);a[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(b);a[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(b);a[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(b);this.makeEmpty();this.setFromPoints(a);return this}}(),translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)}};c.Sphere=function(a,b){this.center=void 0!==a?a:new c.Vector3;this.radius=void 0!==b?b:0};c.Sphere.prototype= +{constructor:c.Sphere,set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromPoints:function(){var a=new c.Box3;return function(b,c){var e=this.center;void 0!==c?e.copy(c):a.setFromPoints(b).center(e);for(var f=0,k=0,g=b.length;k=this.radius}, +containsPoint:function(a){return a.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-this.radius},intersectsSphere:function(a){var b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},clampPoint:function(a,b){var d=this.center.distanceToSquared(a),e=b||new c.Vector3;e.copy(a);d>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center));return e},getBoundingBox:function(a){a= +a||new c.Box3;a.set(this.center,this.center);a.expandByScalar(this.radius);return a},applyMatrix4:function(a){this.center.applyMatrix4(a);this.radius*=a.getMaxScaleOnAxis();return this},translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius}};c.Plane=function(a,b){this.normal=void 0!==a?a:new c.Vector3(1,0,0);this.constant=void 0!==b?b:0};c.Plane.prototype={constructor:c.Plane,set:function(a,b){this.normal.copy(a);this.constant= +b;return this},setComponents:function(a,b,c,e){this.normal.set(a,b,c);this.constant=e;return this},setFromNormalAndCoplanarPoint:function(a,b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(){var a=new c.Vector3,b=new c.Vector3;return function(c,e,f){e=a.subVectors(f,e).cross(b.subVectors(c,e)).normalize();this.setFromNormalAndCoplanarPoint(e,c);return this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.normal.copy(a.normal); +this.constant=a.constant;return this},normalize:function(){var a=1/this.normal.length();this.normal.multiplyScalar(a);this.constant*=a;return this},negate:function(){this.constant*=-1;this.normal.negate();return this},distanceToPoint:function(a){return this.normal.dot(a)+this.constant},distanceToSphere:function(a){return this.distanceToPoint(a.center)-a.radius},projectPoint:function(a,b){return this.orthoPoint(a,b).sub(a).negate()},orthoPoint:function(a,b){var d=this.distanceToPoint(a);return(b|| +new c.Vector3).copy(this.normal).multiplyScalar(d)},isIntersectionLine:function(a){var b=this.distanceToPoint(a.start);a=this.distanceToPoint(a.end);return 0>b&&0a&&0k||1c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b= +this.planes,c=a.elements;a=c[0];var e=c[1],f=c[2],k=c[3],g=c[4],h=c[5],p=c[6],n=c[7],r=c[8],q=c[9],l=c[10],v=c[11],t=c[12],u=c[13],s=c[14],c=c[15];b[0].setComponents(k-a,n-g,v-r,c-t).normalize();b[1].setComponents(k+a,n+g,v+r,c+t).normalize();b[2].setComponents(k+e,n+h,v+q,c+u).normalize();b[3].setComponents(k-e,n-h,v-q,c-u).normalize();b[4].setComponents(k-f,n-p,v-l,c-s).normalize();b[5].setComponents(k+f,n+p,v+l,c+s).normalize();return this},intersectsObject:function(){var a=new c.Sphere;return function(b){var c= +b.geometry;null===c.boundingSphere&&c.computeBoundingSphere();a.copy(c.boundingSphere);a.applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(),intersectsSphere:function(a){var b=this.planes,c=a.center;a=-a.radius;for(var e=0;6>e;e++)if(b[e].distanceToPoint(c)f;f++){var k=e[f];a.x=0g&&0>k)return!1}return!0}}(),containsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0}};c.Math={generateUUID:function(){var a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),b=Array(36),c=0,e;return function(){for(var f=0;36>f;f++)8===f||13===f||18===f||23===f?b[f]= +"-":14===f?b[f]="4":(2>=c&&(c=33554432+16777216*Math.random()|0),e=c&15,c>>=4,b[f]=a[19===f?e&3|8:e]);return b.join("")}}(),clamp:function(a,b,c){return ac?c:a},clampBottom:function(a,b){return a=c)return 1;a=(a-b)/(c-b);return a*a*(3-2*a)},smootherstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*a*(a* +(6*a-15)+10)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(.5-Math.random())},degToRad:function(){var a=Math.PI/180;return function(b){return b*a}}(),radToDeg:function(){var a=180/Math.PI;return function(b){return b*a}}(),isPowerOfTwo:function(a){return 0===(a&a-1)&&0!==a},nextPowerOfTwo:function(a){a--;a|=a>>1;a|= +a>>2;a|=a>>4;a|=a>>8;a|=a>>16;a++;return a}};c.Triangle=function(a,b,d){this.a=void 0!==a?a:new c.Vector3;this.b=void 0!==b?b:new c.Vector3;this.c=void 0!==d?d:new c.Vector3};c.Triangle.normal=function(){var a=new c.Vector3;return function(b,d,e,f){f=f||new c.Vector3;f.subVectors(e,d);a.subVectors(b,d);f.cross(a);b=f.lengthSq();return 0=b.x+b.y}}();c.Triangle.prototype={constructor:c.Triangle,set:function(a,b,c){this.a.copy(a);this.b.copy(b); +this.c.copy(c);return this},setFromPointsAndIndices:function(a,b,c,e){this.a.copy(a[b]);this.b.copy(a[c]);this.c.copy(a[e]);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.a.copy(a.a);this.b.copy(a.b);this.c.copy(a.c);return this},area:function(){var a=new c.Vector3,b=new c.Vector3;return function(){a.subVectors(this.c,this.b);b.subVectors(this.a,this.b);return.5*a.cross(b).length()}}(),midpoint:function(a){return(a||new c.Vector3).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/ +3)},normal:function(a){return c.Triangle.normal(this.a,this.b,this.c,a)},plane:function(a){return(a||new c.Plane).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(a,b){return c.Triangle.barycoordFromPoint(a,this.a,this.b,this.c,b)},containsPoint:function(a){return c.Triangle.containsPoint(a,this.a,this.b,this.c)},equals:function(a){return a.a.equals(this.a)&&a.b.equals(this.b)&&a.c.equals(this.c)}};c.EventDispatcher=function(){};c.EventDispatcher.prototype={constructor:c.EventDispatcher, +apply:function(a){a.addEventListener=c.EventDispatcher.prototype.addEventListener;a.hasEventListener=c.EventDispatcher.prototype.hasEventListener;a.removeEventListener=c.EventDispatcher.prototype.removeEventListener;a.dispatchEvent=c.EventDispatcher.prototype.dispatchEvent},addEventListener:function(a,b){void 0===this._listeners&&(this._listeners={});var c=this._listeners;void 0===c[a]&&(c[a]=[]);-1===c[a].indexOf(b)&&c[a].push(b)},hasEventListener:function(a,b){if(void 0===this._listeners)return!1; +var c=this._listeners;return void 0!==c[a]&&-1!==c[a].indexOf(b)?!0:!1},removeEventListener:function(a,b){if(void 0!==this._listeners){var c=this._listeners[a];if(void 0!==c){var e=c.indexOf(b);-1!==e&&c.splice(e,1)}}},dispatchEvent:function(a){if(void 0!==this._listeners){var b=this._listeners[a.type];if(void 0!==b){a.target=this;for(var c=[],e=b.length,f=0;fe?-1:1,f.vertexTangents[d]=new c.Vector4(E.x,E.y,E.z,e);this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,e=b.length;ce;e++)if(f[e]===f[(e+1)%3]){a.push(g);break}for(g=a.length-1;0<=g;g--)for(f=a[g],this.faces.splice(f,1),c=0,k=this.faceVertexUvs.length;cZ?-1:1;m[4*a]=fa.x;m[4*a+1]=fa.y;m[4*a+2]=fa.z;m[4*a+3]=sa}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("THREE.BufferGeometry: Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var d=this.attributes.index.array,e=this.attributes.position.array,f=this.attributes.normal.array,g=this.attributes.uv.array,k=e.length/3;void 0===this.attributes.tangent&& -this.addAttribute("tangent",new c.BufferAttribute(new Float32Array(4*k),4));for(var m=this.attributes.tangent.array,u=[],p=[],s=0;sx;x++)t=b[3*d+x],-1===n[t]?(q[2*x]=t,q[2*x+1]=-1,s++):n[t]u.index+a)for(u={start:g,count:0,index:k},m.push(u),s=0;6>s;s+=2)x=q[s+1],-1s;s+=2)t=q[s],x=q[s+1],-1===x&&(x=k++),n[t]=x,h[x]=t,f[g++]=x-u.index, -u.count++}this.reorderBuffers(f,h,k);this.clearDrawCalls();for(a=0;athis.opacity&& -(b.opacity=this.opacity);!0===this.transparent&&(b.transparent=this.transparent);0g||(A=b.origin.distanceTo(s),Ae.far||f.push({distance:A,point:p.clone().applyMatrix4(this.matrixWorld),index:k, -offsetIndex:x,face:null,faceIndex:null,object:this}))}}else for(n=n.position.array,k=0;kg||(A=b.origin.distanceTo(s),Ae.far||f.push({distance:A,point:p.clone().applyMatrix4(this.matrixWorld),index:k,face:null,faceIndex:null,object:this}))}else if(k instanceof c.Geometry)for(m=k.vertices,u=m.length,k=0;kg||(A=b.origin.distanceTo(s),Ae.far||f.push({distance:A,point:p.clone().applyMatrix4(this.matrixWorld),index:k,face:null,faceIndex:null,object:this}))}}}();c.Line.prototype.clone=function(){return(new c.Line(this.geometry,this.material)).copy(this)};c.Line.prototype.copy=function(a){c.Object3D.prototype.copy.call(this,a);return this};c.Line.prototype.toJSON=function(a){var b=c.Object3D.prototype.toJSON.call(this,a);void 0===a.geometries[this.geometry.uuid]&&(a.geometries[this.geometry.uuid]=this.geometry.toJSON());void 0=== -a.materials[this.material.uuid]&&(a.materials[this.material.uuid]=this.material.toJSON());b.object.geometry=this.geometry.uuid;b.object.material=this.material.uuid;return b};c.LineStrip=0;c.LinePieces=1;c.LineSegments=function(a,b){c.Line.call(this,a,b);this.type="LineSegments"};c.LineSegments.prototype=Object.create(c.Line.prototype);c.LineSegments.prototype.constructor=c.LineSegments;c.LineSegments.prototype.clone=function(){var a=new c.LineSegments(this.geometry,this.material);a.copy(this);return a}; -c.Mesh=function(a,b){c.Object3D.call(this);this.type="Mesh";this.geometry=void 0!==a?a:new c.Geometry;this.material=void 0!==b?b:new c.MeshBasicMaterial({color:16777215*Math.random()});this.updateMorphTargets()};c.Mesh.prototype=Object.create(c.Object3D.prototype);c.Mesh.prototype.constructor=c.Mesh;c.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&0p.far||s.push({distance:z,point:C,face:new c.Face3(h,t,x,c.Triangle.normal(e,f,g)),faceIndex:Math.floor(B/3),object:this})}}}}else for(l=h.position.array,B=0,r=l.length;Bp.far||(h=B/3,t=h+1,x=h+2,s.push({distance:z,point:C,face:new c.Face3(h, -t,x,c.Triangle.normal(e,f,g)),index:h,object:this})));else if(q instanceof c.Geometry)for(v=n instanceof c.MeshFaceMaterial,l=!0===v?n.materials:null,y=q.vertices,A=q.faces,E=0,B=A.length;Ep.far||s.push({distance:z,point:C,face:r,faceIndex:E,object:this}))}}}}();c.Mesh.prototype.clone=function(){return(new c.Mesh(this.geometry,this.material)).copy(this)};c.Mesh.prototype.copy= -function(a){c.Object3D.prototype.copy.call(this,a);return this};c.Mesh.prototype.toJSON=function(a){var b=c.Object3D.prototype.toJSON.call(this,a);void 0===a.geometries[this.geometry.uuid]&&(a.geometries[this.geometry.uuid]=this.geometry.toJSON(a));void 0===a.materials[this.material.uuid]&&(a.materials[this.material.uuid]=this.material.toJSON(a));b.object.geometry=this.geometry.uuid;b.object.material=this.material.uuid;return b};c.Sprite=function(){var a=new Uint16Array([0,1,2,0,2,3]),b=new Float32Array([-.5, --.5,0,.5,-.5,0,.5,.5,0,-.5,.5,0]),d=new Float32Array([0,0,1,0,1,1,0,1]),e=new c.BufferGeometry;e.addAttribute("index",new c.BufferAttribute(a,1));e.addAttribute("position",new c.BufferAttribute(b,3));e.addAttribute("uv",new c.BufferAttribute(d,2));return function(a){c.Object3D.call(this);this.type="Sprite";this.geometry=e;this.material=void 0!==a?a:new c.SpriteMaterial}}();c.Sprite.prototype=Object.create(c.Object3D.prototype);c.Sprite.prototype.constructor=c.Sprite;c.Sprite.prototype.raycast=function(){var a= -new c.Vector3;return function(b,c){a.setFromMatrixPosition(this.matrixWorld);var e=b.ray.distanceSqToPoint(a);e>this.scale.x*this.scale.y||c.push({distance:Math.sqrt(e),point:this.position,face:null,object:this})}}();c.Sprite.prototype.clone=function(){return(new c.Sprite(this.material)).copy(this)};c.Sprite.prototype.copy=function(a){c.Object3D.prototype.copy.call(this,a);return this};c.Sprite.prototype.toJSON=function(a){var b=c.Object3D.prototype.toJSON.call(this,a);void 0===a.materials[this.material.uuid]&& -(a.materials[this.material.uuid]=this.material.toJSON());b.object.material=this.material.uuid;return b};c.Particle=c.Sprite;c.Scene=function(){c.Object3D.call(this);this.type="Scene";this.overrideMaterial=this.fog=null;this.autoUpdate=!0};c.Scene.prototype=Object.create(c.Object3D.prototype);c.Scene.prototype.constructor=c.Scene;c.Scene.prototype.clone=function(){return(new c.Scene).copy(this)};c.Scene.prototype.copy=function(a){c.Object3D.prototype.copy.call(this,a);null!==a.fog&&(this.fog=a.fog.clone()); -null!==a.overrideMaterial&&(this.overrideMaterial=a.overrideMaterial.clone());this.autoUpdate=a.autoUpdate;this.matrixAutoUpdate=a.matrixAutoUpdate;return this};c.RenderableObject=function(){this.id=0;this.object=null;this.renderOrder=this.z=0};c.RenderableFace=function(){this.id=0;this.v1=new c.RenderableVertex;this.v2=new c.RenderableVertex;this.v3=new c.RenderableVertex;this.normalModel=new c.Vector3;this.vertexNormalsModel=[new c.Vector3,new c.Vector3,new c.Vector3];this.vertexNormalsLength=0; -this.color=new c.Color;this.material=null;this.uvs=[new c.Vector2,new c.Vector2,new c.Vector2];this.renderOrder=this.z=0};c.RenderableVertex=function(){this.position=new c.Vector3;this.positionWorld=new c.Vector3;this.positionScreen=new c.Vector4;this.visible=!0};c.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};c.RenderableLine=function(){this.id=0;this.v1=new c.RenderableVertex;this.v2=new c.RenderableVertex;this.vertexColors= -[new c.Color,new c.Color];this.material=null;this.renderOrder=this.z=0};c.RenderableSprite=function(){this.id=0;this.object=null;this.rotation=this.z=this.y=this.x=0;this.scale=new c.Vector2;this.material=null;this.renderOrder=0};c.Projector=function(){function a(){if(q===h){var a=new c.RenderableVertex;n.push(a);h++;q++;return a}return n[q++]}function b(){if(x===l){var a=new c.RenderableFace;v.push(a);l++;x++;return a}return v[x++]}function d(){if(A===B){var a=new c.RenderableLine;E.push(a);B++; -A++;return a}return E[A++]}function e(){if(C===H){var a=new c.RenderableSprite;z.push(a);H++;C++;return a}return z[C++]}function f(a,b){return a.renderOrder!==b.renderOrder?a.renderOrder-b.renderOrder:a.z!==b.z?b.z-a.z:a.id!==b.id?a.id-b.id:0}function g(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,k=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=k)return!0;if(0>e&&0>f||0>g&&0>k)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-k)):0>k&&(d=Math.min(d,g/(g-k)));if(d=c.x&&-1<=c.y&&1>=c.y&&-1<=c.z&&1>=c.z},u=function(a, -b,c){if(!0===a.visible||!0===b.visible||!0===c.visible)return!0;S[0]=a.positionScreen;S[1]=b.positionScreen;S[2]=c.positionScreen;return M.isIntersectionBox(F.setFromPoints(S))},p=function(a,b,c){return 0>(c.positionScreen.x-a.positionScreen.x)*(b.positionScreen.y-a.positionScreen.y)-(c.positionScreen.y-a.positionScreen.y)*(b.positionScreen.x-a.positionScreen.x)};return{setObject:function(a){g=a;k=g.material;m.getNormalMatrix(g.matrixWorld);e.length=0;f.length=0},projectVertex:q,checkTriangleVisibility:u, -checkBackfaceCulling:p,pushVertex:function(b,c,d){s=a();s.position.set(b,c,d);q(s)},pushNormal:function(a,b,c){e.push(a,b,c)},pushUv:function(a,b){f.push(a,b)},pushLine:function(a,b){var c=n[a],e=n[b];y=d();y.id=g.id;y.v1.copy(c);y.v2.copy(e);y.z=(c.positionScreen.z+e.positionScreen.z)/2;y.renderOrder=g.renderOrder;y.material=g.material;w.elements.push(y)},pushTriangle:function(a,d,q){var s=n[a],h=n[d],A=n[q];if(!1!==u(s,h,A)&&(k.side===c.DoubleSide||!0===p(s,h,A))){t=b();t.id=g.id;t.v1.copy(s);t.v2.copy(h); -t.v3.copy(A);t.z=(s.positionScreen.z+h.positionScreen.z+A.positionScreen.z)/3;t.renderOrder=g.renderOrder;t.normalModel.fromArray(e,3*a);t.normalModel.applyMatrix3(m).normalize();for(s=0;3>s;s++)h=t.vertexNormalsModel[s],h.fromArray(e,3*arguments[s]),h.applyMatrix3(m).normalize(),t.uvs[s].fromArray(f,2*arguments[s]);t.vertexNormalsLength=3;t.material=g.material;w.elements.push(t)}}}};this.projectScene=function(s,h,v,E){C=A=x=0;w.elements.length=0;!0===s.autoUpdate&&s.updateMatrixWorld();void 0=== -h.parent&&h.updateMatrixWorld();K.copy(h.matrixWorldInverse.getInverse(h.matrixWorld));I.multiplyMatrices(h.projectionMatrix,K);P.setFromMatrix(I);m=0;w.objects.length=0;w.lights.length=0;s.traverseVisible(function(a){if(a instanceof c.Light)w.lights.push(a);else if(a instanceof c.Mesh||a instanceof c.Line||a instanceof c.Sprite){var b=a.material;null===b||!1===b.visible||!1!==a.frustumCulled&&!0!==P.intersectsObject(a)||(m===p?(b=new c.RenderableObject,u.push(b),p++,m++,k=b):k=u[m++],k.id=a.id,k.object= -a,L.setFromMatrixPosition(a.matrixWorld),L.applyProjection(I),k.z=L.z,k.renderOrder=a.renderOrder,w.objects.push(k))}});!0===v&&w.objects.sort(f);s=0;for(v=w.objects.length;sba;ba++)t.uvs[ba].copy(ea[ba]);t.color=G.color;t.material=D;t.z=(B.positionScreen.z+$.positionScreen.z+da.positionScreen.z)/3;t.renderOrder=l.renderOrder;w.elements.push(t)}}}else if(l instanceof c.Line)if(B instanceof c.BufferGeometry){if(D=B.attributes,void 0!==D.position){W=D.position.array;z=0;for(H=W.length;z=N.z&&(r=e(), -r.id=l.id,r.x=N.x*z,r.y=N.y*z,r.z=N.z,r.renderOrder=l.renderOrder,r.object=l,r.rotation=l.rotation,r.scale.x=l.scale.x*Math.abs(r.x-(N.x+h.projectionMatrix.elements[0])/(N.w+h.projectionMatrix.elements[12])),r.scale.y=l.scale.y*Math.abs(r.y-(N.y+h.projectionMatrix.elements[5])/(N.w+h.projectionMatrix.elements[13])),r.material=l.material,w.elements.push(r)))}!0===E&&w.elements.sort(f);return w}};c.SpriteCanvasMaterial=function(a){c.Material.call(this);this.type="SpriteCanvasMaterial";this.color=new c.Color(16777215); -this.program=function(a,c){};this.setValues(a)};c.SpriteCanvasMaterial.prototype=Object.create(c.Material.prototype);c.SpriteCanvasMaterial.prototype.constructor=c.SpriteCanvasMaterial;c.SpriteCanvasMaterial.prototype.clone=function(){var a=new c.SpriteCanvasMaterial;a.copy(this);a.color.copy(this.color);a.program=this.program;return a};c.CanvasRenderer=function(a){function b(a,b,c,d){u(b);h(c);s(d);q(a.getStyle());F.stroke();ka.expandByScalar(2*b)}function d(a){n(a.getStyle());F.fill()}function e(a){if(0=== -a.version||a instanceof c.CompressedTexture||a instanceof c.DataTexture)return{canvas:void 0,version:a.version};var b=a.image,d=document.createElement("canvas");d.width=b.width;d.height=b.height;var e=d.getContext("2d");e.setTransform(1,0,0,-1,0,b.height);e.drawImage(b,0,0);var b=a.wrapS===c.RepeatWrapping,e=a.wrapT===c.RepeatWrapping,f="no-repeat";!0===b&&!0===e?f="repeat":!0===b?f="repeat-x":!0===e&&(f="repeat-y");return{canvas:F.createPattern(d,f),version:a.version}}function f(a,b,c,d,f,g,k,m, -q,s,u,h,p){var A=$[p.id];if(void 0===A||A.version!==p.version)A=e(p),$[p.id]=A;if(void 0!==A.canvas){n(A.canvas);var A=p.offset.x/p.repeat.x,t=p.offset.y/p.repeat.y,x=p.image.width*p.repeat.x;p=p.image.height*p.repeat.y;k=(k+A)*x;m=(m+t)*p;c-=a;d-=b;f-=a;g-=b;q=(q+A)*x-k;s=(s+t)*p-m;u=(u+A)*x-k;h=(h+t)*p-m;p=q*h-u*s;0!==p&&(A=1/p,p=(h*c-s*f)*A,s=(h*d-s*g)*A,c=(q*f-u*c)*A,d=(q*g-u*d)*A,a=a-p*k-c*m,b=b-s*k-d*m,F.save(),F.transform(p,s,c,d,a,b),F.fill(),F.restore())}else n("rgba( 0, 0, 0, 1)"),F.fill()} -function g(a,b,c){var d=b.x-a.x,e=b.y-a.y,f=d*d+e*e;0!==f&&(c/=Math.sqrt(f),d*=c,e*=c,b.x+=d,b.y+=e,a.x-=d,a.y-=e)}function k(a){I!==a&&(I=F.globalAlpha=a)}function m(a){Q!==a&&(a===c.NormalBlending?F.globalCompositeOperation="source-over":a===c.AdditiveBlending?F.globalCompositeOperation="lighter":a===c.SubtractiveBlending&&(F.globalCompositeOperation="darker"),Q=a)}function u(a){J!==a&&(J=F.lineWidth=a)}function h(a){P!==a&&(P=F.lineCap=a)}function s(a){Y!==a&&(Y=F.lineJoin=a)}function q(a){G!== -a&&(G=F.strokeStyle=a)}function n(a){R!==a&&(R=F.fillStyle=a)}function l(a){X.length!==a.length&&(F.setLineDash(a),X=a)}console.log("THREE.CanvasRenderer",c.REVISION);var t=c.Math.smoothstep;a=a||{};var x=this,v,r,y,A=new c.Projector,E=void 0!==a.canvas?a.canvas:document.createElement("canvas"),B=E.width,ca=E.height,C=Math.floor(B/2),z=Math.floor(ca/2),H=0,w=0,L=B,N=ca,M=1,F=E.getContext("2d",{alpha:!0===a.alpha}),S=new c.Color(0),K=!0===a.alpha?0:1,I=1,Q=0,G=null,R=null,J=null,P=null,Y=null,X=[], -sa,V,Z,ia;new c.RenderableVertex;new c.RenderableVertex;var ra,la,xa,ua,ya,za,aa=new c.Color;new c.Color;new c.Color;new c.Color;new c.Color;var va=new c.Color,Ea=new c.Color,Ka=new c.Color,$={},da,ea,ba,ja,ga,ma,oa,wa=new c.Box2,U=new c.Box2,ka=new c.Box2,Ma=new c.Color,Na=new c.Color,Aa=new c.Color,Oa=new c.Vector3,Pa=new c.Vector3,ha=new c.Vector3,Ba=new c.Matrix3;void 0===F.setLineDash&&(F.setLineDash=function(){});this.domElement=E;this.sortElements=this.sortObjects=this.autoClear=!0;this.info= -{render:{vertices:0,faces:0}};this.supportsVertexTextures=function(){};this.setFaceCulling=function(){};this.getContext=function(){return F};this.getContextAttributes=function(){return F.getContextAttributes()};this.getPixelRatio=function(){return M};this.setPixelRatio=function(a){void 0!==a&&(M=a)};this.setSize=function(a,b,c){B=a*M;ca=b*M;E.width=B;E.height=ca;C=Math.floor(B/2);z=Math.floor(ca/2);!1!==c&&(E.style.width=a+"px",E.style.height=b+"px");wa.min.set(-C,-z);wa.max.set(C,z);U.min.set(-C, --z);U.max.set(C,z);I=1;Q=0;Y=P=J=R=G=null;this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){H=a*M;w=b*M;L=c*M;N=d*M};this.setScissor=function(){};this.enableScissorTest=function(){};this.setClearColor=function(a,b){S.set(a);K=void 0!==b?b:1;U.min.set(-C,-z);U.max.set(C,z)};this.setClearColorHex=function(a,b){console.warn("THREE.CanvasRenderer: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getClearColor=function(){return S};this.getClearAlpha= -function(){return K};this.getMaxAnisotropy=function(){return 0};this.clear=function(){!1===U.empty()&&(U.intersect(wa),U.expandByScalar(2),U.min.x+=C,U.min.y=-U.min.y+z,U.max.x+=C,U.max.y=-U.max.y+z,1>K&&F.clearRect(U.min.x|0,U.max.y|0,U.max.x-U.min.x|0,U.min.y-U.max.y|0),0V.positionScreen.z||1Z.positionScreen.z||1ia.positionScreen.z||1=J||(J*=P.intensity,T.add(Ka.multiplyScalar(J)))):P instanceof c.PointLight&&(R=Oa.setFromMatrixPosition(P.matrixWorld),J=G.dot(Oa.subVectors(R,K).normalize()),0>=J||(J*=0==P.distance?1:1-Math.min(K.distanceTo(R)/P.distance,1),0!=J&&(J*=P.intensity,T.add(Ka.multiplyScalar(J)))));aa.multiply(va).add(Ea);!0===I.wireframe?b(aa,I.wireframeLinewidth,I.wireframeLinecap,I.wireframeLinejoin): -d(aa)}else I instanceof c.MeshBasicMaterial||I instanceof c.MeshLambertMaterial||I instanceof c.MeshPhongMaterial?null!==I.map?I.map.mapping===c.UVMapping&&(da=O.uvs,f(ra,la,xa,ua,ya,za,da[0].x,da[0].y,da[1].x,da[1].y,da[2].x,da[2].y,I.map)):null!==I.envMap?I.envMap.mapping===c.SphericalReflectionMapping&&(ha.copy(O.vertexNormalsModel[0]).applyMatrix3(Ba),ea=.5*ha.x+.5,ba=.5*ha.y+.5,ha.copy(O.vertexNormalsModel[1]).applyMatrix3(Ba),ja=.5*ha.x+.5,ga=.5*ha.y+.5,ha.copy(O.vertexNormalsModel[2]).applyMatrix3(Ba), -ma=.5*ha.x+.5,oa=.5*ha.y+.5,f(ra,la,xa,ua,ya,za,ea,ba,ja,ga,ma,oa,I.envMap)):(aa.copy(I.color),I.vertexColors===c.FaceColors&&aa.multiply(O.color),!0===I.wireframe?b(aa,I.wireframeLinewidth,I.wireframeLinecap,I.wireframeLinejoin):d(aa)):(I instanceof c.MeshDepthMaterial?aa.r=aa.g=aa.b=1-t(K.positionScreen.z*K.positionScreen.w,sa.near,sa.far):I instanceof c.MeshNormalMaterial?(ha.copy(O.normalModel).applyMatrix3(Ba),aa.setRGB(ha.x,ha.y,ha.z).multiplyScalar(.5).addScalar(.5)):aa.setRGB(1,1,1),!0=== -I.wireframe?b(aa,I.wireframeLinewidth,I.wireframeLinecap,I.wireframeLinejoin):d(aa))}}U.union(ka)}}F.setTransform(1,0,0,1,0,0)}}};c.OrthographicTrackballControls=function(a,b){function d(a){!1!==n.enabled&&(window.removeEventListener("keydown",d),v=x,x===h.NONE)&&(a.keyCode!==n.keys[h.ROTATE]||n.noRotate?a.keyCode!==n.keys[h.ZOOM]||n.noZoom?a.keyCode!==n.keys[h.PAN]||n.noPan||(x=h.PAN):x=h.ZOOM:x=h.ROTATE)}function e(a){!1!==n.enabled&&(x=v,window.addEventListener("keydown",d,!1))}function f(a){!1!== -n.enabled&&(a.preventDefault(),a.stopPropagation(),x===h.NONE&&(x=a.button),x!==h.ROTATE||n.noRotate?x!==h.ZOOM||n.noZoom?x!==h.PAN||n.noPan||(z.copy(M(a.pageX,a.pageY)),H.copy(z)):(E.copy(M(a.pageX,a.pageY)),B.copy(E)):(y.copy(F(a.pageX,a.pageY)),A.copy(y)),document.addEventListener("mousemove",g,!1),document.addEventListener("mouseup",k,!1),n.dispatchEvent(L))}function g(a){!1!==n.enabled&&(a.preventDefault(),a.stopPropagation(),x!==h.ROTATE||n.noRotate?x!==h.ZOOM||n.noZoom?x!==h.PAN||n.noPan|| -H.copy(M(a.pageX,a.pageY)):B.copy(M(a.pageX,a.pageY)):A.copy(F(a.pageX,a.pageY)))}function k(a){!1!==n.enabled&&(a.preventDefault(),a.stopPropagation(),x=h.NONE,document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",k),n.dispatchEvent(N))}function m(a){if(!1!==n.enabled){a.preventDefault();a.stopPropagation();var b=0;a.wheelDelta?b=a.wheelDelta/40:a.detail&&(b=-a.detail/3);E.y+=.01*b;n.dispatchEvent(L);n.dispatchEvent(N)}}function u(a){if(!1!==n.enabled){switch(a.touches.length){case 1:x= -h.TOUCH_ROTATE;y.copy(F(a.touches[0].pageX,a.touches[0].pageY));A.copy(y);break;case 2:x=h.TOUCH_ZOOM_PAN;var b=a.touches[0].pageX-a.touches[1].pageX,c=a.touches[0].pageY-a.touches[1].pageY;C=r=Math.sqrt(b*b+c*c);z.copy(M((a.touches[0].pageX+a.touches[1].pageX)/2,(a.touches[0].pageY+a.touches[1].pageY)/2));H.copy(z);break;default:x=h.NONE}n.dispatchEvent(L)}}function p(a){if(!1!==n.enabled)switch(a.preventDefault(),a.stopPropagation(),a.touches.length){case 1:A.copy(F(a.touches[0].pageX,a.touches[0].pageY)); -break;case 2:var b=a.touches[0].pageX-a.touches[1].pageX,c=a.touches[0].pageY-a.touches[1].pageY;C=Math.sqrt(b*b+c*c);H.copy(M((a.touches[0].pageX+a.touches[1].pageX)/2,(a.touches[0].pageY+a.touches[1].pageY)/2));break;default:x=h.NONE}}function s(a){if(!1!==n.enabled){switch(a.touches.length){case 1:A.copy(F(a.touches[0].pageX,a.touches[0].pageY));y.copy(A);break;case 2:r=C=0,H.copy(M((a.touches[0].pageX+a.touches[1].pageX)/2,(a.touches[0].pageY+a.touches[1].pageY)/2)),z.copy(H)}x=h.NONE;n.dispatchEvent(N)}} -function q(a){a.preventDefault()}var n=this,h={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4};this.object=a;this.domElement=void 0!==b?b:document;this.enabled=!0;this.screen={left:0,top:0,width:0,height:0};this.radius=0;this.rotateSpeed=1;this.zoomSpeed=1.2;this.staticMoving=this.noRoll=this.noPan=this.noZoom=this.noRotate=!1;this.dynamicDampingFactor=.2;this.keys=[65,83,68];this.target=new c.Vector3;var t=!0,x=h.NONE,v=h.NONE,l=new c.Vector3,y=new c.Vector3,A=new c.Vector3,E=new c.Vector2, -B=new c.Vector2,r=0,C=0,z=new c.Vector2,H=new c.Vector2;this.target0=this.target.clone();this.position0=this.object.position.clone();this.up0=this.object.up.clone();this.left0=this.object.left;this.right0=this.object.right;this.top0=this.object.top;this.bottom0=this.object.bottom;var w={type:"change"},L={type:"start"},N={type:"end"};this.handleResize=function(){if(this.domElement===document)this.screen.left=0,this.screen.top=0,this.screen.width=window.innerWidth,this.screen.height=window.innerHeight; -else{var a=this.domElement.getBoundingClientRect(),b=this.domElement.ownerDocument.documentElement;this.screen.left=a.left+window.pageXOffset-b.clientLeft;this.screen.top=a.top+window.pageYOffset-b.clientTop;this.screen.width=a.width;this.screen.height=a.height}this.radius=.5*Math.min(this.screen.width,this.screen.height);this.left0=this.object.left;this.right0=this.object.right;this.top0=this.object.top;this.bottom0=this.object.bottom};this.handleEvent=function(a){if("function"==typeof this[a.type])this[a.type](a)}; -var M=function(){var a=new c.Vector2;return function(b,c){a.set((b-n.screen.left)/n.screen.width,(c-n.screen.top)/n.screen.height);return a}}(),F=function(){var a=new c.Vector3,b=new c.Vector3,d=new c.Vector3;return function(c,e){d.set((c-.5*n.screen.width-n.screen.left)/n.radius,(.5*n.screen.height+n.screen.top-e)/n.radius,0);var f=d.length();n.noRoll?d.z=f15 significant digits to BigNumber (value: "+a+"). Use function bignumber(x) to convert to BigNumber.");return new b.BigNumber(a)}},{from:"number",to:"Complex",convert:function(a){return new b.Complex(a,0)}},{from:"number",to:"string",convert:function(a){return a+""}},{from:"BigNumber",to:"Complex",convert:function(a){return new b.Complex(a.toNumber(),0)}},{from:"number",to:"Fraction",convert:function(a){if(15< -c(a))throw new TypeError("Cannot implicitly convert a number with >15 significant digits to Fraction (value: "+a+"). Use function fraction(x) to convert to Fraction.");return new b.Fraction(a)}},{from:"string",to:"number",convert:function(a){var b=Number(a);if(isNaN(b))throw Error('Cannot convert "'+a+'" to a number');return b}},{from:"boolean",to:"number",convert:function(a){return+a}},{from:"boolean",to:"BigNumber",convert:function(a){return new b.BigNumber(+a)}},{from:"boolean",to:"string",convert:function(a){return+a}}, -{from:"null",to:"number",convert:function(){return 0}},{from:"null",to:"string",convert:function(){return"null"}},{from:"null",to:"BigNumber",convert:function(){return new b.BigNumber(0)}},{from:"Array",to:"Matrix",convert:function(a){return new b.DenseMatrix(a)}},{from:"Matrix",to:"Array",convert:function(a){return a.valueOf()}}];return d}},function(w,l,h){var r,c,a;"use strict";(function(b){!(c=[],r=b,a="function"===typeof r?r.apply(l,c):r,void 0!==a&&(w.exports=a))})(function(){function a(){function c(a){for(var b, -d=0;dc&&!k?"Unexpected type of argument in function "+g+" (expected: "+e.join(" or ")+", actual: "+f+", index: "+c+")":"Too few arguments in function "+g+" (expected: "+e.join(" or ")+", index: "+c+")":"Too many arguments in function "+g+" (expected: "+c+", actual: "+b+")";b=new TypeError(b);b.data=a;return b}function g(a){this.name=a||"refs";this.categories={}} -function k(a,b){if("string"===typeof a){var c=a.trim(),d="..."===c.substr(0,3);d&&(c=c.substr(3));if(""===c)this.types=["any"];else for(this.types=c.split("|"),c=0;ch)c[k]=g;else{if(0===h)throw Error('Signature "'+k+'" is defined twice');}else c[k]=g}for(k in c)c.hasOwnProperty(k)&&d.push(c[k]);d.sort(function(a,b){return m.compare(a,b)});for(e=0;eh&&(h=n)}q=[];for(n=0;nb.params.length)return 1;if(a.params.lengthf)return 1;if(e "+g+") {"),f.push(b+" var varArgs = [];"), -f.push(b+" for (var i = "+g+"; i < arguments.length; i++) {"),f.push(b+" varArgs.push(arguments[i]);");else{var m=function(b,e){for(var f=[],g=0;g "+c+") {",b+" throw createError(name, arguments.length, "+c+", arguments["+c+"]);",b+"}"].join("\n");for(var d={},e=[],f=0;fc?-1:0};l.format=function(c,a){if("function"===typeof a)return a(c);if(Infinity===c)return"Infinity";if(-Infinity===c)return"-Infinity";if(isNaN(c))return"NaN";var b="auto",d=void 0;a&&(a.notation&&(b=a.notation),l.isNumber(a)?d=a:a.precision&&(d=a.precision));switch(b){case "fixed":return l.toFixed(c,d);case "exponential":return l.toExponential(c,d);case "auto":return l.toPrecision(c,d,a&& -a.exponential).replace(/((\.\d*?)(0+))($|e)/,function(a,b,c,d,m){return"."!==c?c+m:m});default:throw Error('Unknown notation "'+b+'". Choose "auto", "exponential", or "fixed".');}};l.toExponential=function(c,a){return(new r(c)).toExponential(a)};l.toFixed=function(c,a){return(new r(c)).toFixed(a)};l.toPrecision=function(c,a,b){return(new r(c)).toPrecision(a,b)};l.digits=function(c){return c.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length};l.DBL_EPSILON=Number.EPSILON||2.220446049250313E-16; -l.nearlyEqual=function(c,a,b){if(null==b)return c==a;if(c==a)return!0;if(isNaN(c)||isNaN(a))return!1;if(isFinite(c)&&isFinite(a)){var d=Math.abs(c-a);return da&&(b=r(-a+1).concat(b),a=1);c&&b.splice(a,0,0===a?"0.":".");return this.sign+b.join("")}; -h.prototype.toExponential=function(c){var a=c?this.roundDigits(c):this.clone(),b=a.coefficients,a=a.exponent;b.length=d)return this.toExponential(c);d=c?this.roundDigits(c):this.clone();b=d.coefficients;d=d.exponent;b.length=c;)b.unshift(0),a.exponent++,c++;if(b.length>c&&5<=b.splice(c)[0])for(c-=1,b[c]++;10===b[c];)b.pop(),0===c&&(b.unshift(0), -a.exponent++,c++),c--,b[c]++;return a};w.exports=h},function(w,l,h){var r=h(9);l.mixin=function(c){var a=new r;c.on=a.on.bind(a);c.off=a.off.bind(a);c.once=a.once.bind(a);c.emit=a.emit.bind(a);return c}},function(w,l){function h(){}h.prototype={on:function(h,c,a){var b=this.e||(this.e={});(b[h]||(b[h]=[])).push({fn:c,ctx:a});return this},once:function(h,c,a){var b=this,d=function(){b.off(h,d);c.apply(a,arguments)};return this.on(h,d,a)},emit:function(h){var c=[].slice.call(arguments,1),a=((this.e|| -(this.e={}))[h]||[]).slice(),b=0,d=a.length;for(b;b");}function c(a,b,d,e){var g,k=b[d],h=Math.min(a.length,k);a.length=k;if(da)throw new k(a);if(void 0!==b&&a>=b)throw new k(a,b);};l.UNINITIALIZED={};l.resize=function(a,b,f){if(!Array.isArray(a)||!Array.isArray(b))throw new TypeError("Array expected");if(0===b.length)throw Error("Resizing to scalar is not supported");b.forEach(function(a){if(!d.isNumber(a)|| -!d.isInteger(a)||0>a)throw new TypeError("Invalid size, must contain positive integers (size: "+e.format(b)+")");});c(a,b,0,void 0!==f?f:0);return a};l.squeeze=function(b,c){for(var d=c||l.size(b);Array.isArray(b)&&1===b.length;)b=b[0],d.shift();for(var e=d.length;1===d[e-1];)e--;earguments.length?(this.min=0,this.max=c):(this.min=c,this.max=a);this.message=void 0!==this.min&&this.index=this.max?"Index out of range ("+this.index+" > "+(this.max-1)+")":"Index out of range ("+ -this.index+")";this.stack=Error().stack}h.prototype=new RangeError;h.prototype.constructor=RangeError;h.prototype.name="IndexError";h.prototype.isIndexError=!0;w.exports=h},function(w,l){l.isBoolean=function(h){return"boolean"==typeof h}},function(w,l){l.memoize=function(h,l){return function a(){"object"!==typeof a.cache&&(a.cache={});for(var b=[],d=0;d");m=e.max().map(function(a){return a+ -1});v(a,m,g);x(a._data,e,f,k.length,0)}return a}function x(a,b,c,d,e){var f=e==d-1,g=b.dimension(e);f?g.forEach(function(b,d){m(b);a[b]=c[d[0]]}):g.forEach(function(f,g){m(f);x(a[f],b,c[g[0]],d,e+1)})}function v(a,b,c){for(var e=d.clone(a._size),f=!1;e.lengthe[g]&&(e[g]=b[g],f=!0);f&&y(a,e,c)}function D(a){for(var b=0,c=a.length;ba?-a:0;for(var c=Math.min(this._size[0]-a,this._size[1]-b),e=[],k=0;ka)throw Error("Size values must be positive integers");return a});if(d){if(d&&!0===d.isBigNumber&&(d=d.toNumber()),!f(d)||!g(d))throw new TypeError("The parameter k must be an integer number");}else d=0;h&&k(m)&&(h=q.convert(h,m));m=0d?-d:0;var s=a[0],p=a[1],l=Math.min(s-d,p-m),t;if(e(c)){if(c.length!==l)throw Error("Invalid value array length");t=function(a){return c[a]}}else if(c&&!0===c.isMatrix){t=c.size();if(1!==t.length||t[0]!==l)throw Error("Invalid matrix length"); -t=function(a){return c.get([a])}}else t=function(){return c};h||(h=t(0)&&!0===t(0).isBigNumber?new u.BigNumber(0):0);var x=[];if(0p;++p){var k=d.times(d),s=k.times(d),k=s.times(k);d=h.times(k).minus(l.times(s)).plus(g.times(d))}a&&(d.s=-d.s)}else for(g.abs().lt(b.ONE)?(h=64,a=3):(h=256,a=4),d=c(g.div(h),d),b.config({precision:Math.min(k,f+8)}),g=new b(8);0Math.abs(a)?a+a*a*a/6+a*a*a*a*a/120:(Math.exp(a)-Math.exp(-a))/2}var c=h(25),a=h(32);l.name="sinh";l.factory=function(b,d,e,f){var g=f("sinh",{number:r,Complex:function(a){var c=Math.cos(a.im),d=Math.sin(a.im),e=Math.exp(a.re);a=Math.exp(-a.re);return new b.Complex(c*(e-a)/2,d*(e+a)/2)}, -BigNumber:function(c){return a(c,b.BigNumber,!0,!1)},Unit:function(a){if(!a.hasBase(b.Unit.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sinh is no angle");return r(a.value)},"Array | Matrix":function(a){return c(a,g,!0)}});g.toTex="\\sinh\\left(${args[0]}\\right)";return g}},function(w,l,h){var r=h(25),c=h(26);l.name="cos";l.factory=function(a,b,d,e){var f=e.find(d(h(31)),["number"]),g=e.find(d(h(33)),["number"]),k=e("cos",{number:Math.cos,Complex:function(b){return new a.Complex(Math.cos(b.re)* -f(-b.im),Math.sin(b.re)*g(-b.im))},BigNumber:function(b){return c(b,a.BigNumber,0,!1)},Unit:function(b){if(!b.hasBase(a.Unit.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cos is no angle");return Math.cos(b.value)},"Array | Matrix":function(a){return r(a,k)}});k.toTex="\\cos\\left(${args[0]}\\right)";return k}},function(w,l,h){var r=h(25);l.name="sqrt";l.factory=function(c,a,b,d){function e(b){return 0<=b||a.predictable?Math.sqrt(b):f(new c.Complex(b,0))}function f(a){var b=Math.sqrt(a.re* -a.re+a.im*a.im),d;d=0<=a.re?.5*Math.sqrt(2*(b+a.re)):Math.abs(a.im)/Math.sqrt(2*(b-a.re));b=0>=a.re?.5*Math.sqrt(2*(b-a.re)):Math.abs(a.im)/Math.sqrt(2*(b+a.re));return 0<=a.im?new c.Complex(d,b):new c.Complex(d,-b)}var g=d("sqrt",{number:e,Complex:f,BigNumber:function(b){return!b.isNegative()||a.predictable?b.sqrt():e(b.toNumber())},"Array | Matrix":function(a){return r(a,g,!0)}});g.toTex="\\sqrt{${args[0]}}";return g}},function(w,l,h){l.name="norm";l.factory=function(l,c,a,b){function d(a,b){var c= -a.size();if(1==c.length){if(b===Number.POSITIVE_INFINITY||"inf"===b){var h=0;a.forEach(function(a){a=e(a);p(a,h)&&(h=a)},!0);return h}if(b===Number.NEGATIVE_INFINITY||"-inf"===b){var q;a.forEach(function(a){a=e(a);if(!q||s(a,q))q=a},!0);return q||0}if("fro"===b)return d(a,2);if("number"===typeof b&&!isNaN(b)){if(!u(b,0)){var l=0;a.forEach(function(a){l=f(g(e(a),b),l)},!0);return g(l,1/b)}return Number.POSITIVE_INFINITY}throw Error("Unsupported parameter value");}if(2==c.length){if(1===b){var t=[], -r=0;a.forEach(function(a,b){var c=b[1],d=f(t[c]||0,e(a));p(d,r)&&(r=d);t[c]=d},!0);return r}if(b===Number.POSITIVE_INFINITY||"inf"===b){var w=[],z=0;a.forEach(function(a,b){var c=b[0],d=f(w[c]||0,e(a));p(d,z)&&(z=d);w[c]=d},!0);return z}if("fro"===b)return k(n(m(W(a),a)));if(2===b)throw Error("Unsupported parameter value, missing implementation of matrix singular value decomposition");throw Error("Unsupported parameter value");}}var e=a(h(37)),f=a(h(38)),g=a(h(48)),k=a(h(35)),m=a(h(53)),u=a(h(44)), -p=a(h(56)),s=a(h(60)),q=a(h(39)),n=a(h(61)),W=a(h(62));l=b.find(e,["Complex"]);var t=b("norm",{number:Math.abs,Complex:l,BigNumber:function(a){return a.abs()},"boolean | null":function(a){return Math.abs(a)},Array:function(a){return d(q(a),2)},Matrix:function(a){return d(a,2)},"number | Complex | BigNumber | boolean | null, number | BigNumber | string":function(a){return t(a)},"Array, number | BigNumber | string":function(a,b){return d(q(a),b)},"Matrix, number | BigNumber | string":function(a,b){return d(a, -b)}});t.toTex={1:"\\left\\|${args[0]}\\right\\|",2:"\\mathrm{${name}}\\left(${args}\\right)"};return t}},function(w,l,h){var r=h(25);l.name="abs";l.factory=function(c,a,b,d){var e=d("abs",{number:Math.abs,Complex:function(a){var b=Math.abs(a.re);a=Math.abs(a.im);if(1E3>b&&1E3>a)return Math.sqrt(b*b+a*a);if(b>=a)return a/=b,b*Math.sqrt(1+a*a);b/=a;return a*Math.sqrt(1+b*b)},BigNumber:function(a){return a.abs()},Fraction:function(a){return a.abs()},"Array | Matrix":function(a){return r(a,e,!0)}});e.toTex= -"\\left|${args[0]}\\right|";return e}},function(w,l,h){var r=h(3).extend;l.name="add";l.factory=function(c,a,b,d){var e=b(h(39)),f=b(h(40));c=h(41);var g=b(h(42)),k=b(h(43)),m=b(h(45)),l=b(h(46)),p=b(h(47)),s=d("add",r({"Matrix, Matrix":function(a,b){var c;switch(a.storage()){case "sparse":switch(b.storage()){case "sparse":c=k(a,b,f);break;default:c=g(b,a,f,!0)}break;default:switch(b.storage()){case "sparse":c=g(a,b,f,!1);break;default:c=l(a,b,f)}}return c},"Array, Array":function(a,b){return s(e(a), -e(b)).valueOf()},"Array, Matrix":function(a,b){return s(e(a),b)},"Matrix, Array":function(a,b){return s(a,e(b))},"Matrix, any":function(a,b){var c;switch(a.storage()){case "sparse":c=m(a,b,f,!1);break;default:c=p(a,b,f,!1)}return c},"any, Matrix":function(a,b){var c;switch(b.storage()){case "sparse":c=m(b,a,f,!0);break;default:c=p(b,a,f,!0)}return c},"Array, any":function(a,b){return p(e(a),b,f,!1).valueOf()},"any, Array":function(a,b){return p(e(b),a,f,!0).valueOf()}},f.signatures));s.toTex="\\left(${args[0]}"+ -c.operators.add+"${args[1]}\\right)";return s}},function(w,l){l.name="matrix";l.factory=function(h,l,c,a){function b(a,b,c){return new (h.Matrix.storage(b||"default"))(a,c)}l=a("matrix",{"":function(){return b([])},string:function(a){return b([],a)},"string, string":function(a,c){return b([],a,c)},Array:function(a){return b(a)},Matrix:function(a){return b(a,a.storage())},"Array | Matrix, string":b,"Array | Matrix, string, string":b});l.toTex={0:"\\begin{bmatrix}\\end{bmatrix}",1:"\\left(${args[0]}\\right)", -2:"\\left(${args[0]}\\right)"};return l}},function(w,l){l.factory=function(h,l,c,a){return a("add",{"number, number":function(a,c){return a+c},"Complex, Complex":function(a,c){return new h.Complex(a.re+c.re,a.im+c.im)},"BigNumber, BigNumber":function(a,c){return a.plus(c)},"Fraction, Fraction":function(a,c){return a.add(c)},"Unit, Unit":function(a,c){if(null==a.value)throw Error("Parameter x contains a unit with undefined value");if(null==c.value)throw Error("Parameter y contains a unit with undefined value"); -if(!a.equalBase(c))throw Error("Units do not match");var e=a.clone();e.value+=c.value;e.fixPrefix=!1;return e}})}},function(w,l){l.symbols={Alpha:"A",alpha:"\\alpha",Beta:"B",beta:"\\beta",Gamma:"\\Gamma",gamma:"\\gamma",Delta:"\\Delta",delta:"\\delta",Epsilon:"E",epsilon:"\\epsilon",varepsilon:"\\varepsilon",Zeta:"Z",zeta:"\\zeta",Eta:"H",eta:"\\eta",Theta:"\\Theta",theta:"\\theta",vartheta:"\\vartheta",Iota:"I",iota:"\\iota",Kappa:"K",kappa:"\\kappa",varkappa:"\\varkappa",Lambda:"\\Lambda",lambda:"\\lambda", -Mu:"M",mu:"\\mu",Nu:"N",nu:"\\nu",Xi:"\\Xi",xi:"\\xi",Omicron:"O",omicron:"o",Pi:"\\Pi",pi:"\\pi",varpi:"\\varpi",Rho:"P",rho:"\\rho",varrho:"\\varrho",Sigma:"\\Sigma",sigma:"\\sigma",varsigma:"\\varsigma",Tau:"T",tau:"\\tau",Upsilon:"\\Upsilon",upsilon:"\\upsilon",Phi:"\\Phi",phi:"\\phi",varphi:"\\varphi",Chi:"X",chi:"\\chi",Psi:"\\Psi",psi:"\\psi",Omega:"\\Omega",omega:"\\omega","true":"\\mathrm{True}","false":"\\mathrm{False}",i:"i",inf:"\\infty",Inf:"\\infty",infinity:"\\infty",Infinity:"\\infty", -oo:"\\infty",lim:"\\lim",undefined:"\\mathbf{?}"};l.operators={transpose:"^\\top",factorial:"!",pow:"^",dotPow:".^\\wedge",unaryPlus:"+",unaryMinus:"-",bitNot:"~",not:"\\neg",multiply:"\\cdot",divide:"\\frac",dotMultiply:".\\cdot",dotDivide:".:",mod:"\\mod",add:"+",subtract:"-",to:"\\rightarrow",leftShift:"<<",rightArithShift:">>",rightLogShift:">>>",equal:"=",unequal:"\\neq",smaller:"<",larger:">",smallerEq:"\\leq",largerEq:"\\geq",bitAnd:"\\&",bitXor:"\\underline{|}",bitOr:"|",and:"\\wedge",xor:"\\veebar", -or:"\\vee"};l.defaultTemplate="\\mathrm{${name}}\\left(${args}\\right)";var h={deg:"^\\circ"};l.toSymbol=function(r,c){if("undefined"===typeof c?0:c)return h.hasOwnProperty(r)?h[r]:"\\mathrm{"+r+"}";if(l.symbols.hasOwnProperty(r))return l.symbols[r];if(-1!==r.indexOf("_")){var a=r.indexOf("_");return l.toSymbol(r.substring(0,a))+"_{"+l.toSymbol(r.substring(a+1))+"}"}return r}},function(w,l,h){var r=h(19);l.name="algorithm01";l.factory=function(c,a,b,d){var e=c.DenseMatrix;return function(a,b,c,h){var l= -a._data,p=a._size,s=a._datatype;a=b._values;var q=b._index,n=b._ptr,w=b._size,t=b._datatype;if(p.length!==w.length)throw new r(p.length,w.length);if(p[0]!==w[0]||p[1]!==w[1])throw new RangeError("Dimension mismatch. Matrix A ("+p+") must match Matrix B ("+w+")");if(!a)throw Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");b=p[0];p=p[1];c=(s="string"===typeof s&&s===t?s:void 0)?d.find(c,[s,s]):c;for(var x=[],t=0;tb)throw new TypeError("For A^b, b must be a positive integer (value is "+b+")");var d=c(a);if(2!=d.length)throw Error("For A^b, A must be 2 dimensional (A has "+ -d.length+" dimensions)");if(d[0]!=d[1])throw Error("For A^b, A must be square (size is "+d[0]+"x"+d[1]+")");for(var d=s(d[0]).valueOf(),e=a;1<=b;)1==(b&1)&&(d=n(e,d)),b>>=1,e=n(e,e);return d}function m(a,b){return w(k(a.valueOf(),b))}var l=h(41),p=d(h(49)),s=d(h(50)),q=d(h(51)),n=d(h(53)),w=d(h(39));d=e("pow",{"number, number":f,"Complex, Complex":g,"BigNumber, BigNumber":function(c,d){return d.isInteger()||0<=c||b.predictable?c.pow(d):g(new a.Complex(c.toNumber(),0),new a.Complex(d.toNumber(),0))}, -"Fraction, Fraction":function(a,c){if(1!==c.d){if(b.predictable)throw Error("Function pow does not support non-integer exponents for fractions.");return f(a.valueOf(),c.valueOf())}return a.pow(c)},"Array, number":k,"Array, BigNumber":function(a,b){return k(a,b.toNumber())},"Matrix, number":m,"Matrix, BigNumber":function(a,b){return m(a,b.toNumber())}});d.toTex="\\left(${args[0]}\\right)"+l.operators.pow+"{${args[1]}}";return d}},function(w,l,h){var r=h(25);l.name="exp";l.factory=function(c,a,b,d){var e= -d("exp",{number:Math.exp,Complex:function(a){var b=Math.exp(a.re);return new c.Complex(b*Math.cos(a.im),b*Math.sin(a.im))},BigNumber:function(a){return a.exp()},"Array | Matrix":function(a){return r(a,e)}});e.toTex="\\exp\\left(${args[0]}\\right)";return e}},function(w,l,h){var r=h(15),c=h(6).isInteger;l.name="eye";l.factory=function(a,b,d,e){function f(a,b){switch(a.length){case 0:return b?k(b):[];case 1:return g(a[0],a[0],b);case 2:return g(a[0],a[1],b);default:throw Error("Vector containing two values expected"); -}}function g(b,d,e){var f=b&&!0===b.isBigNumber?a.BigNumber:d&&!0===d.isBigNumber?a.BigNumber:null;b&&!0===b.isBigNumber&&(b=b.toNumber());d&&!0===d.isBigNumber&&(d=d.toNumber());if(!c(b)||1>b)throw Error("Parameters in function eye must be positive integers");if(!c(d)||1>d)throw Error("Parameters in function eye must be positive integers");var g=f?new a.BigNumber(1):1,f=f?new f(0):0,k=[b,d];if(e)return a.Matrix.storage(e).diagonal(k,g,0,f);e=r.resize([],k,f);b=bda)for(var ba=0,ja=0;jab},"number, number":function(b,c){return b>c&&!r(b,c,a.epsilon)},"BigNumber, BigNumber":function(a,b){return a.gt(b)},"Fraction, Fraction":function(a,b){return 1===a.compare(b)},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers");},"Unit, Unit":function(b, -c){if(!b.equalBase(c))throw Error("Cannot compare units with different base");return b.value>c.value&&!r(b.value,c.value,a.epsilon)},"string, string":function(a,b){return a>b},"Matrix, Matrix":function(a,b){var c;switch(a.storage()){case "sparse":switch(b.storage()){case "sparse":c=g(a,b,p);break;default:c=f(b,a,p,!0)}break;default:switch(b.storage()){case "sparse":c=f(a,b,p,!1);break;default:c=m(a,b,p)}}return c},"Array, Array":function(a,b){return p(e(a),e(b)).valueOf()},"Array, Matrix":function(a, -b){return p(e(a),b)},"Matrix, Array":function(a,b){return p(a,e(b))},"Matrix, any":function(a,b){var c;switch(a.storage()){case "sparse":c=k(a,b,p,!1);break;default:c=l(a,b,p,!1)}return c},"any, Matrix":function(a,b){var c;switch(b.storage()){case "sparse":c=k(b,a,p,!0);break;default:c=l(b,a,p,!0)}return c},"Array, any":function(a,b){return l(e(a),b,p,!1).valueOf()},"any, Array":function(a,b){return l(e(b),a,p,!0).valueOf()}});p.toTex="\\left(${args[0]}"+c.operators.larger+"${args[1]}\\right)";return p}}, -function(w,l,h){var r=h(19);l.name="algorithm03";l.factory=function(c,a,b,d){var e=c.DenseMatrix;return function(a,b,c,h){var l=a._data,p=a._size,s=a._datatype;a=b._values;var q=b._index,n=b._ptr,w=b._size,t=b._datatype;if(p.length!==w.length)throw new r(p.length,w.length);if(p[0]!==w[0]||p[1]!==w[1])throw new RangeError("Dimension mismatch. Matrix A ("+p+") must match Matrix B ("+w+")");if(!a)throw Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");b=p[0];var p=p[1],x,w= -0,v=c;"string"===typeof s&&s===t&&(x=s,w=d.convert(0,x),v=d.find(c,[x,x]));c=[];for(s=0;s -k)break}b=f}else throw new RangeError("Matrix must be square (size: "+c(f)+")");}return b},any:r});k.toTex="\\mathrm{tr}\\left(${args[0]}\\right)";return k}},function(w,l,h){var r=h(3).clone,c=h(16).format;l.name="transpose";l.factory=function(a,b,d,e){b=h(41);var f=d(h(39)),g=a.DenseMatrix,k=a.SparseMatrix,l=e("transpose",{Array:function(a){return l(f(a)).valueOf()},Matrix:function(a){var b=a.size(),d;switch(b.length){case 1:d=a.clone();break;case 2:var e=b[0],f=b[1];if(0===f)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+ -c(b)+")");switch(a.storage()){case "dense":b=a._data;d=[];for(var h,l=0;le;e++)if(f[e]===f[(e+1)%3]){a.push(k);break}for(k=a.length-1;0<=k;k--)for(f=a[k],this.faces.splice(f,1),c=0,g=this.faceVertexUvs.length;cthis.opacity&&(b.opacity=this.opacity);!0===this.transparent&&(b.transparent=this.transparent);0a.x||1a.x?0:1;break;case c.MirroredRepeatWrapping:1===Math.abs(Math.floor(a.x)%2)?a.x=Math.ceil(a.x)-a.x:a.x-=Math.floor(a.x)}if(0>a.y||1a.y?0:1;break;case c.MirroredRepeatWrapping:1===Math.abs(Math.floor(a.y)%2)?a.y=Math.ceil(a.y)-a.y:a.y-=Math.floor(a.y)}this.flipY&&(a.y=1-a.y)}}};c.EventDispatcher.prototype.apply(c.Texture.prototype);c.TextureIdCount=0;c.CompressedTexture=function(a,b,d,e,f,g,h,p,q,n,r){c.Texture.call(this,null,g,h,p,q,n,e,f,r);this.image={width:b,height:d};this.mipmaps=a;this.generateMipmaps=this.flipY=!1};c.CompressedTexture.prototype=Object.create(c.Texture.prototype); +c.CompressedTexture.prototype.constructor=c.CompressedTexture;c.DataTexture=function(a,b,d,e,f,g,h,p,q,n,r){c.Texture.call(this,null,g,h,p,q,n,e,f,r);this.image={data:a,width:b,height:d};this.magFilter=void 0!==q?q:c.NearestFilter;this.minFilter=void 0!==n?n:c.NearestFilter;this.generateMipmaps=this.flipY=!1};c.DataTexture.prototype=Object.create(c.Texture.prototype);c.DataTexture.prototype.constructor=c.DataTexture;c.Line=function(a,b,d){if(1===d)return console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."), +new c.LineSegments(a,b);c.Object3D.call(this);this.type="Line";this.geometry=void 0!==a?a:new c.Geometry;this.material=void 0!==b?b:new c.LineBasicMaterial({color:16777215*Math.random()})};c.Line.prototype=Object.create(c.Object3D.prototype);c.Line.prototype.constructor=c.Line;c.Line.prototype.raycast=function(){var a=new c.Matrix4,b=new c.Ray,d=new c.Sphere;return function(e,f){var g=e.linePrecision,g=g*g,h=this.geometry;null===h.boundingSphere&&h.computeBoundingSphere();d.copy(h.boundingSphere); +d.applyMatrix4(this.matrixWorld);if(!1!==e.ray.isIntersectionSphere(d)){a.getInverse(this.matrixWorld);b.copy(e.ray).applyMatrix4(a);var p=new c.Vector3,q=new c.Vector3,n=new c.Vector3,r=new c.Vector3,w=this instanceof c.LineSegments?2:1;if(h instanceof c.BufferGeometry){var l=h.index,v=h.attributes;if(null!==l)for(var h=l.array,v=v.position.array,l=0,t=h.length-1;lg||(r.applyMatrix4(this.matrixWorld), +u=e.ray.origin.distanceTo(r),ue.far||f.push({distance:u,point:n.clone().applyMatrix4(this.matrixWorld),index:l,face:null,faceIndex:null,object:this}))}else for(v=v.position.array,l=0,t=v.length/3-1;lg||(r.applyMatrix4(this.matrixWorld),u=e.ray.origin.distanceTo(r),ue.far||f.push({distance:u,point:n.clone().applyMatrix4(this.matrixWorld),index:l,face:null,faceIndex:null,object:this}))}else if(h instanceof +c.Geometry)for(p=h.vertices,q=p.length,l=0;lg||(r.applyMatrix4(this.matrixWorld),u=e.ray.origin.distanceTo(r),ue.far||f.push({distance:u,point:n.clone().applyMatrix4(this.matrixWorld),index:l,face:null,faceIndex:null,object:this}))}}}();c.Line.prototype.clone=function(){return(new this.constructor(this.geometry,this.material)).copy(this)};c.Line.prototype.toJSON=function(a){var b=c.Object3D.prototype.toJSON.call(this,a);void 0===a.geometries[this.geometry.uuid]&& +(a.geometries[this.geometry.uuid]=this.geometry.toJSON());void 0===a.materials[this.material.uuid]&&(a.materials[this.material.uuid]=this.material.toJSON());b.object.geometry=this.geometry.uuid;b.object.material=this.material.uuid;return b};c.LineStrip=0;c.LinePieces=1;c.LineSegments=function(a,b){c.Line.call(this,a,b);this.type="LineSegments"};c.LineSegments.prototype=Object.create(c.Line.prototype);c.LineSegments.prototype.constructor=c.LineSegments;c.Mesh=function(a,b){c.Object3D.call(this);this.type= +"Mesh";this.geometry=void 0!==a?a:new c.Geometry;this.material=void 0!==b?b:new c.MeshBasicMaterial({color:16777215*Math.random()});this.updateMorphTargets()};c.Mesh.prototype=Object.create(c.Object3D.prototype);c.Mesh.prototype.constructor=c.Mesh;c.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&0s.far)){var P;void 0!==x.uv&&(P=x.uv.array,r.fromArray(P,2*z),w.fromArray(P,2*E),l.fromArray(P,2*K),P=a(t,f,g,h,r,w,l));v.push({distance:L,point:u.clone(),uv:P,face:new c.Face3(z,E,K,c.Triangle.normal(f,g,h)),faceIndex:Math.floor(D/3),object:this})}}else for(F=x.position.array,D=0,U=F.length;Ds.far||(void 0!==x.uv&&(P=x.uv.array,r.fromArray(P,D),w.fromArray(P,D+2),l.fromArray(P,D+4),P=a(t,f,g,h,r,w,l)),z=D/3,E=z+1,K=z+2,v.push({distance:L,point:u.clone(),uv:P,face:new c.Face3(z,E,K,c.Triangle.normal(f,g,h)),index:z,object:this}))}else if(x instanceof c.Geometry)for(var H=J instanceof c.MeshFaceMaterial,F=!0=== +H?J.materials:null,D=x.vertices,U=x.faces,G=0,C=U.length;Gs.far||(0this.scale.x*this.scale.y||c.push({distance:Math.sqrt(e),point:this.position,face:null,object:this})}}();c.Sprite.prototype.clone=function(){return(new this.constructor(this.material)).copy(this)};c.Sprite.prototype.toJSON=function(a){var b=c.Object3D.prototype.toJSON.call(this,a);void 0===a.materials[this.material.uuid]&&(a.materials[this.material.uuid]=this.material.toJSON());b.object.material=this.material.uuid;return b}; +c.Particle=c.Sprite;c.Scene=function(){c.Object3D.call(this);this.type="Scene";this.overrideMaterial=this.fog=null;this.autoUpdate=!0};c.Scene.prototype=Object.create(c.Object3D.prototype);c.Scene.prototype.constructor=c.Scene;c.Scene.prototype.copy=function(a){c.Object3D.prototype.copy.call(this,a);null!==a.fog&&(this.fog=a.fog.clone());null!==a.overrideMaterial&&(this.overrideMaterial=a.overrideMaterial.clone());this.autoUpdate=a.autoUpdate;this.matrixAutoUpdate=a.matrixAutoUpdate;return this}; +c.RenderableObject=function(){this.id=0;this.object=null;this.renderOrder=this.z=0};c.RenderableFace=function(){this.id=0;this.v1=new c.RenderableVertex;this.v2=new c.RenderableVertex;this.v3=new c.RenderableVertex;this.normalModel=new c.Vector3;this.vertexNormalsModel=[new c.Vector3,new c.Vector3,new c.Vector3];this.vertexNormalsLength=0;this.color=new c.Color;this.material=null;this.uvs=[new c.Vector2,new c.Vector2,new c.Vector2];this.renderOrder=this.z=0};c.RenderableVertex=function(){this.position= +new c.Vector3;this.positionWorld=new c.Vector3;this.positionScreen=new c.Vector4;this.visible=!0};c.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};c.RenderableLine=function(){this.id=0;this.v1=new c.RenderableVertex;this.v2=new c.RenderableVertex;this.vertexColors=[new c.Color,new c.Color];this.material=null;this.renderOrder=this.z=0};c.RenderableSprite=function(){this.id=0;this.object=null;this.rotation=this.z=this.y= +this.x=0;this.scale=new c.Vector2;this.material=null;this.renderOrder=0};c.Projector=function(){function a(){if(w===v){var a=new c.RenderableVertex;l.push(a);v++;w++;return a}return l[w++]}function b(){if(u===A){var a=new c.RenderableFace;s.push(a);A++;u++;return a}return s[u++]}function d(){if(J===E){var a=new c.RenderableLine;z.push(a);E++;J++;return a}return z[J++]}function e(){if(H===D){var a=new c.RenderableSprite;F.push(a);D++;H++;return a}return F[H++]}function f(a,b){return a.renderOrder!== +b.renderOrder?a.renderOrder-b.renderOrder:a.z!==b.z?b.z-a.z:a.id!==b.id?a.id-b.id:0}function g(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,h=-a.z+a.w,k=-b.z+b.w;if(0<=e&&0<=f&&0<=h&&0<=k)return!0;if(0>e&&0>f||0>h&&0>k)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>h?c=Math.max(c,h/(h-k)):0>k&&(d=Math.min(d,h/(h-k)));if(d=c.x&&-1<=c.y&&1>=c.y&&-1<=c.z&&1>=c.z},n=function(a,b,c){if(!0===a.visible||!0===b.visible||!0===c.visible)return!0;I[0]=a.positionScreen;I[1]=b.positionScreen;I[2]=c.positionScreen;return G.isIntersectionBox(C.setFromPoints(I))},p=function(a,b,c){return 0>(c.positionScreen.x- +a.positionScreen.x)*(b.positionScreen.y-a.positionScreen.y)-(c.positionScreen.y-a.positionScreen.y)*(b.positionScreen.x-a.positionScreen.x)};return{setObject:function(a){g=a;h=g.material;k.getNormalMatrix(g.matrixWorld);e.length=0;f.length=0},projectVertex:m,checkTriangleVisibility:n,checkBackfaceCulling:p,pushVertex:function(b,c,d){r=a();r.position.set(b,c,d);m(r)},pushNormal:function(a,b,c){e.push(a,b,c)},pushUv:function(a,b){f.push(a,b)},pushLine:function(a,b){var c=l[a],e=l[b];x=d();x.id=g.id; +x.v1.copy(c);x.v2.copy(e);x.z=(c.positionScreen.z+e.positionScreen.z)/2;x.renderOrder=g.renderOrder;x.material=g.material;U.elements.push(x)},pushTriangle:function(a,d,m){var q=l[a],r=l[d],s=l[m];if(!1!==n(q,r,s)&&(h.side===c.DoubleSide||!0===p(q,r,s))){t=b();t.id=g.id;t.v1.copy(q);t.v2.copy(r);t.v3.copy(s);t.z=(q.positionScreen.z+r.positionScreen.z+s.positionScreen.z)/3;t.renderOrder=g.renderOrder;t.normalModel.fromArray(e,3*a);t.normalModel.applyMatrix3(k).normalize();for(q=0;3>q;q++)r=t.vertexNormalsModel[q], +r.fromArray(e,3*arguments[q]),r.applyMatrix3(k).normalize(),t.uvs[q].fromArray(f,2*arguments[q]);t.vertexNormalsLength=3;t.material=g.material;U.elements.push(t)}}}};this.projectScene=function(r,s,v,A){H=J=u=0;U.elements.length=0;!0===r.autoUpdate&&r.updateMatrixWorld();null===s.parent&&s.updateMatrixWorld();M.copy(s.matrixWorldInverse.getInverse(s.matrixWorld));V.multiplyMatrices(s.projectionMatrix,M);Q.setFromMatrix(V);p=0;U.objects.length=0;U.lights.length=0;r.traverseVisible(function(a){if(a instanceof +c.Light)U.lights.push(a);else if((a instanceof c.Mesh||a instanceof c.Line||a instanceof c.Sprite)&&!1!==a.material.visible&&(!1===a.frustumCulled||!0===Q.intersectsObject(a))){if(p===n){var b=new c.RenderableObject;q.push(b);n++;p++;h=b}else h=q[p++];h.id=a.id;h.object=a;L.setFromMatrixPosition(a.matrixWorld);L.applyProjection(V);h.z=L.z;h.renderOrder=a.renderOrder;U.objects.push(h)}});!0===v&&U.objects.sort(f);r=0;for(v=U.objects.length;rY;Y++)t.uvs[Y].copy(W[Y]);t.color=S.color;t.material=D;t.z=(C.positionScreen.z+ea.positionScreen.z+ka.positionScreen.z)/ +3;t.renderOrder=z.renderOrder;U.elements.push(t)}}}else if(z instanceof c.Line)if(C instanceof c.BufferGeometry){if(E=C.attributes,void 0!==E.position){D=E.position.array;N=0;for(F=D.length;N=P.z&&(K=e(),K.id=z.id,K.x=P.x*N,K.y=P.y*N,K.z=P.z,K.renderOrder=z.renderOrder,K.object=z,K.rotation=z.rotation,K.scale.x=z.scale.x*Math.abs(K.x-(P.x+s.projectionMatrix.elements[0])/(P.w+s.projectionMatrix.elements[12])),K.scale.y=z.scale.y*Math.abs(K.y-(P.y+s.projectionMatrix.elements[5])/(P.w+s.projectionMatrix.elements[13])), +K.material=z.material,U.elements.push(K)))}!0===A&&U.elements.sort(f);return U}};c.SpriteCanvasMaterial=function(a){c.Material.call(this);this.type="SpriteCanvasMaterial";this.color=new c.Color(16777215);this.program=function(a,c){};this.setValues(a)};c.SpriteCanvasMaterial.prototype=Object.create(c.Material.prototype);c.SpriteCanvasMaterial.prototype.constructor=c.SpriteCanvasMaterial;c.SpriteCanvasMaterial.prototype.clone=function(){var a=new c.SpriteCanvasMaterial;a.copy(this);a.color.copy(this.color); +a.program=this.program;return a};c.CanvasRenderer=function(a){function b(a,b,c,d){q(b);n(c);r(d);w(a.getStyle());C.stroke();oa.expandByScalar(2*b)}function d(a){l(a.getStyle());C.fill()}function e(a){if(0===a.version||a instanceof c.CompressedTexture||a instanceof c.DataTexture)return{canvas:void 0,version:a.version};var b=a.image,d=document.createElement("canvas");d.width=b.width;d.height=b.height;var e=d.getContext("2d");e.setTransform(1,0,0,-1,0,b.height);e.drawImage(b,0,0);var b=a.wrapS===c.RepeatWrapping, +e=a.wrapT===c.RepeatWrapping,f="no-repeat";!0===b&&!0===e?f="repeat":!0===b?f="repeat-x":!0===e&&(f="repeat-y");return{canvas:C.createPattern(d,f),version:a.version}}function f(a,b,c,d,f,g,h,k,m,n,p,q,r){var s=ea[r.id];if(void 0===s||s.version!==r.version)s=e(r),ea[r.id]=s;if(void 0!==s.canvas){l(s.canvas);var s=r.offset.x/r.repeat.x,t=r.offset.y/r.repeat.y,u=r.image.width*r.repeat.x;r=r.image.height*r.repeat.y;h=(h+s)*u;k=(k+t)*r;c-=a;d-=b;f-=a;g-=b;m=(m+s)*u-h;n=(n+t)*r-k;p=(p+s)*u-h;q=(q+t)*r- +k;r=m*q-p*n;0!==r&&(s=1/r,r=(q*c-n*f)*s,n=(q*d-n*g)*s,c=(m*f-p*c)*s,d=(m*g-p*d)*s,a=a-r*h-c*k,b=b-n*h-d*k,C.save(),C.transform(r,n,c,d,a,b),C.fill(),C.restore())}else l("rgba( 0, 0, 0, 1)"),C.fill()}function g(a,b,c){var d=b.x-a.x,e=b.y-a.y,f=d*d+e*e;0!==f&&(c/=Math.sqrt(f),d*=c,e*=c,b.x+=d,b.y+=e,a.x-=d,a.y-=e)}function h(a){V!==a&&(V=C.globalAlpha=a)}function p(a){X!==a&&(a===c.NormalBlending?C.globalCompositeOperation="source-over":a===c.AdditiveBlending?C.globalCompositeOperation="lighter":a=== +c.SubtractiveBlending&&(C.globalCompositeOperation="darker"),X=a)}function q(a){R!==a&&(R=C.lineWidth=a)}function n(a){sa!==a&&(sa=C.lineCap=a)}function r(a){ja!==a&&(ja=C.lineJoin=a)}function w(a){O!==a&&(O=C.strokeStyle=a)}function l(a){Q!==a&&(Q=C.fillStyle=a)}function v(a){ca.length!==a.length&&(C.setLineDash(a),ca=a)}console.log("THREE.CanvasRenderer",c.REVISION);var t=c.Math.smoothstep;a=a||{};var u=this,s,A,x,J=new c.Projector,z=void 0!==a.canvas?a.canvas:document.createElement("canvas"),E= +z.width,K=z.height,H=Math.floor(E/2),F=Math.floor(K/2),D=0,U=0,L=E,P=K,G=1,C=z.getContext("2d",{alpha:!0===a.alpha}),I=new c.Color(0),M=!0===a.alpha?0:1,V=1,X=0,O=null,Q=null,R=null,sa=null,ja=null,ca=[],Ia,ba,fa,ma;new c.RenderableVertex;new c.RenderableVertex;var va,na,Ca,ya,N,Da,ga=new c.Color;new c.Color;new c.Color;new c.Color;new c.Color;var za=new c.Color,ia=new c.Color,S=new c.Color,ea={},ka,W,Y,Aa,qa,da,aa,pa=new c.Box2,$=new c.Box2,oa=new c.Box2,Ba=new c.Color,Na=new c.Color,Ea=new c.Color, +Oa=new c.Vector3,Pa=new c.Vector3,la=new c.Vector3,Fa=new c.Matrix3;void 0===C.setLineDash&&(C.setLineDash=function(){});this.domElement=z;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.supportsVertexTextures=function(){};this.setFaceCulling=function(){};this.getContext=function(){return C};this.getContextAttributes=function(){return C.getContextAttributes()};this.getPixelRatio=function(){return G};this.setPixelRatio=function(a){void 0!==a&&(G=a)}; +this.setSize=function(a,b,c){E=a*G;K=b*G;z.width=E;z.height=K;H=Math.floor(E/2);F=Math.floor(K/2);!1!==c&&(z.style.width=a+"px",z.style.height=b+"px");pa.min.set(-H,-F);pa.max.set(H,F);$.min.set(-H,-F);$.max.set(H,F);V=1;X=0;ja=sa=R=Q=O=null;this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){D=a*G;U=b*G;L=c*G;P=d*G};this.setScissor=function(){};this.enableScissorTest=function(){};this.setClearColor=function(a,b){I.set(a);M=void 0!==b?b:1;$.min.set(-H,-F);$.max.set(H,F)};this.setClearColorHex= +function(a,b){console.warn("THREE.CanvasRenderer: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getClearColor=function(){return I};this.getClearAlpha=function(){return M};this.getMaxAnisotropy=function(){return 0};this.clear=function(){!1===$.empty()&&($.intersect(pa),$.expandByScalar(2),$.min.x+=H,$.min.y=-$.min.y+F,$.max.x+=H,$.max.y=-$.max.y+F,1>M&&C.clearRect($.min.x|0,$.max.y|0,$.max.x-$.min.x|0,$.min.y-$.max.y|0),0ba.positionScreen.z|| +1fa.positionScreen.z||1ma.positionScreen.z||1=Z||(Z*=ha.intensity,M.add(S.multiplyScalar(Z)))):ha instanceof c.PointLight&&(R=Oa.setFromMatrixPosition(ha.matrixWorld),Z=Q.dot(Oa.subVectors(R,I).normalize()),0>=Z||(Z*=0== +ha.distance?1:1-Math.min(I.distanceTo(R)/ha.distance,1),0!=Z&&(Z*=ha.intensity,M.add(S.multiplyScalar(Z)))));ga.multiply(za).add(ia);!0===T.wireframe?b(ga,T.wireframeLinewidth,T.wireframeLinecap,T.wireframeLinejoin):d(ga)}else T instanceof c.MeshBasicMaterial||T instanceof c.MeshLambertMaterial||T instanceof c.MeshPhongMaterial?null!==T.map?T.map.mapping===c.UVMapping&&(ka=G.uvs,f(va,na,Ca,ya,N,Da,ka[0].x,ka[0].y,ka[1].x,ka[1].y,ka[2].x,ka[2].y,T.map)):null!==T.envMap?T.envMap.mapping===c.SphericalReflectionMapping&& +(la.copy(G.vertexNormalsModel[0]).applyMatrix3(Fa),W=.5*la.x+.5,Y=.5*la.y+.5,la.copy(G.vertexNormalsModel[1]).applyMatrix3(Fa),Aa=.5*la.x+.5,qa=.5*la.y+.5,la.copy(G.vertexNormalsModel[2]).applyMatrix3(Fa),da=.5*la.x+.5,aa=.5*la.y+.5,f(va,na,Ca,ya,N,Da,W,Y,Aa,qa,da,aa,T.envMap)):(ga.copy(T.color),T.vertexColors===c.FaceColors&&ga.multiply(G.color),!0===T.wireframe?b(ga,T.wireframeLinewidth,T.wireframeLinecap,T.wireframeLinejoin):d(ga)):(T instanceof c.MeshDepthMaterial?ga.r=ga.g=ga.b=1-t(I.positionScreen.z* +I.positionScreen.w,Ia.near,Ia.far):T instanceof c.MeshNormalMaterial?(la.copy(G.normalModel).applyMatrix3(Fa),ga.setRGB(la.x,la.y,la.z).multiplyScalar(.5).addScalar(.5)):ga.setRGB(1,1,1),!0===T.wireframe?b(ga,T.wireframeLinewidth,T.wireframeLinecap,T.wireframeLinejoin):d(ga))}}$.union(oa)}}C.setTransform(1,0,0,1,0,0)}}};c.TrackballControls=function(a,b){function d(a){!1!==l.enabled&&(window.removeEventListener("keydown",d),s=u,u===v.NONE)&&(a.keyCode!==l.keys[v.ROTATE]||l.noRotate?a.keyCode!==l.keys[v.ZOOM]|| +l.noZoom?a.keyCode!==l.keys[v.PAN]||l.noPan||(u=v.PAN):u=v.ZOOM:u=v.ROTATE)}function e(a){!1!==l.enabled&&(u=s,window.addEventListener("keydown",d,!1))}function f(a){!1!==l.enabled&&(a.preventDefault(),a.stopPropagation(),u===v.NONE&&(u=a.button),u!==v.ROTATE||l.noRotate?u!==v.ZOOM||l.noZoom?u!==v.PAN||l.noPan||(O.copy(I(a.pageX,a.pageY)),L.copy(O)):(K.copy(I(a.pageX,a.pageY)),H.copy(K)):(J.copy(M(a.pageX,a.pageY)),x.copy(J)),document.addEventListener("mousemove",g,!1),document.addEventListener("mouseup", +h,!1),l.dispatchEvent(G))}function g(a){!1!==l.enabled&&(a.preventDefault(),a.stopPropagation(),u!==v.ROTATE||l.noRotate?u!==v.ZOOM||l.noZoom?u!==v.PAN||l.noPan||L.copy(I(a.pageX,a.pageY)):H.copy(I(a.pageX,a.pageY)):(x.copy(J),J.copy(M(a.pageX,a.pageY))))}function h(a){!1!==l.enabled&&(a.preventDefault(),a.stopPropagation(),u=v.NONE,document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",h),l.dispatchEvent(C))}function p(a){if(!1!==l.enabled){a.preventDefault();a.stopPropagation(); +var b=0;a.wheelDelta?b=a.wheelDelta/40:a.detail&&(b=-a.detail/3);K.y+=.01*b;l.dispatchEvent(G);l.dispatchEvent(C)}}function q(a){if(!1!==l.enabled){switch(a.touches.length){case 1:u=v.TOUCH_ROTATE;J.copy(M(a.touches[0].pageX,a.touches[0].pageY));x.copy(J);break;case 2:u=v.TOUCH_ZOOM_PAN;var b=a.touches[0].pageX-a.touches[1].pageX,c=a.touches[0].pageY-a.touches[1].pageY;D=F=Math.sqrt(b*b+c*c);O.copy(I((a.touches[0].pageX+a.touches[1].pageX)/2,(a.touches[0].pageY+a.touches[1].pageY)/2));L.copy(O);break; +default:u=v.NONE}l.dispatchEvent(G)}}function n(a){if(!1!==l.enabled)switch(a.preventDefault(),a.stopPropagation(),a.touches.length){case 1:x.copy(J);J.copy(M(a.touches[0].pageX,a.touches[0].pageY));break;case 2:var b=a.touches[0].pageX-a.touches[1].pageX,c=a.touches[0].pageY-a.touches[1].pageY;D=Math.sqrt(b*b+c*c);L.copy(I((a.touches[0].pageX+a.touches[1].pageX)/2,(a.touches[0].pageY+a.touches[1].pageY)/2));break;default:u=v.NONE}}function r(a){if(!1!==l.enabled){switch(a.touches.length){case 1:x.copy(J); +J.copy(M(a.touches[0].pageX,a.touches[0].pageY));break;case 2:F=D=0,L.copy(I((a.touches[0].pageX+a.touches[1].pageX)/2,(a.touches[0].pageY+a.touches[1].pageY)/2)),O.copy(L)}u=v.NONE;l.dispatchEvent(C)}}function w(a){a.preventDefault()}var l=this,v={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4};this.object=a;this.domElement=void 0!==b?b:document;this.enabled=!0;this.screen={left:0,top:0,width:0,height:0};this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=.3;this.staticMoving=this.noPan= +this.noZoom=this.noRotate=!1;this.dynamicDampingFactor=.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=new c.Vector3;var t=new c.Vector3,u=v.NONE,s=v.NONE,A=new c.Vector3,x=new c.Vector2,J=new c.Vector2,z=new c.Vector3,E=0,K=new c.Vector2,H=new c.Vector2,F=0,D=0,O=new c.Vector2,L=new c.Vector2;this.target0=this.target.clone();this.position0=this.object.position.clone();this.up0=this.object.up.clone();var P={type:"change"},G={type:"start"},C={type:"end"};this.handleResize= +function(){if(this.domElement===document)this.screen.left=0,this.screen.top=0,this.screen.width=window.innerWidth,this.screen.height=window.innerHeight;else{var a=this.domElement.getBoundingClientRect(),b=this.domElement.ownerDocument.documentElement;this.screen.left=a.left+window.pageXOffset-b.clientLeft;this.screen.top=a.top+window.pageYOffset-b.clientTop;this.screen.width=a.width;this.screen.height=a.height}};this.handleEvent=function(a){if("function"==typeof this[a.type])this[a.type](a)};var I= +function(){var a=new c.Vector2;return function(b,c){a.set((b-l.screen.left)/l.screen.width,(c-l.screen.top)/l.screen.height);return a}}(),M=function(){var a=new c.Vector2;return function(b,c){a.set((b-.5*l.screen.width-l.screen.left)/(.5*l.screen.width),(l.screen.height+2*(l.screen.top-c))/l.screen.width);return a}}();this.rotateCamera=function(){var a=new c.Vector3,b=new c.Quaternion,d=new c.Vector3,e=new c.Vector3,f=new c.Vector3,g=new c.Vector3,h;return function(){g.set(J.x-x.x,J.y-x.y,0);(h=g.length())? +(A.copy(l.object.position).sub(l.target),d.copy(A).normalize(),e.copy(l.object.up).normalize(),f.crossVectors(e,d).normalize(),e.setLength(J.y-x.y),f.setLength(J.x-x.x),g.copy(e.add(f)),a.crossVectors(g,A).normalize(),h*=l.rotateSpeed,b.setFromAxisAngle(a,h),A.applyQuaternion(b),l.object.up.applyQuaternion(b),z.copy(a),E=h):!l.staticMoving&&E&&(E*=Math.sqrt(1-l.dynamicDampingFactor),A.copy(l.object.position).sub(l.target),b.setFromAxisAngle(z,E),A.applyQuaternion(b),l.object.up.applyQuaternion(b)); +x.copy(J)}}();this.zoomCamera=function(){var a;u===v.TOUCH_ZOOM_PAN?(a=F/D,F=D,A.multiplyScalar(a)):(a=1+(H.y-K.y)*l.zoomSpeed,1!==a&&0l.maxDistance*l.maxDistance&&(l.object.position.addVectors(l.target,A.setLength(l.maxDistance)),K.copy(H)),A.lengthSq()c.y?this.quaternion.set(1,0,0,0):(a.set(c.z,0,-c.x).normalize(),b=Math.acos(c.y),this.quaternion.setFromAxisAngle(a,b))}}();c.ArrowHelper.prototype.setLength=function(a,b,c){void 0===b&&(b=.2*a);void 0===c&&(c=.2*b);b