From 51dfdbf48ee9061978830159f81dba3017ca43e2 Mon Sep 17 00:00:00 2001 From: Evgeny Blokhin Date: Wed, 25 May 2016 15:48:17 +0200 Subject: [PATCH] CIF data_ tag contents are now displayed in title --- player.html | 1002 +++++++++++++++++++-------------------- src/js/app/main.js | 3 +- src/js/libs/matinfio.js | 11 +- 3 files changed, 510 insertions(+), 506 deletions(-) diff --git a/player.html b/player.html index 6a1270a..2a864aa 100644 --- a/player.html +++ b/player.html @@ -43,266 +43,266 @@ Available via the MIT or new BSD license. see: http://github.com/requirejs/domReady for details */ -'use strict';var player=function(ea){function ba(r){if(Z[r])return Z[r].exports;var m=Z[r]={exports:{},id:r,loaded:!1};ea[r].call(m.exports,m,m.exports,ba);m.loaded=!0;return m.exports}var Z={};ba.m=ea;ba.c=Z;ba.p="";return ba(0)}([function(ea,ba,Z){!function(){var r=[Z(1),Z(4),Z(6),Z(3)];(function(m,k,u,b){function a(a){var c=document.getElementById("notifybox"),b=document.getElementById("message");c.style.display="block";b.innerHTML="";setTimeout(function(){b.innerHTML=a},250)}function c(a,c){var b= -document.createElement("div");b.setAttribute("id",a);c&&(b.innerHTML=c);document.body.appendChild(b);return b}function d(a,c,b){b||(b=14540253);var d=new D.Geometry;d.vertices.push(new D.Vector3(a[0],a[1],a[2]));d.vertices.push(new D.Vector3(c[0],c[1],c[2]));a=new D.LineBasicMaterial({color:b});v.atombox.add(new D.Line(d,a))}function e(a){var c=document.createElement("canvas"),b=c.getContext("2d"),d=3.5*b.measureText(a).width;c.width=d;c.height=30;b.font="normal 30px Arial";b.textAlign="center";b.textBaseline= -"middle";b.fillStyle="W"==v.colorset?"#000000":"#FFFFFF";b.fillText(a,c.width/2,c.height/2);a=new D.Texture(c);a.needsUpdate=!0;a=new D.SpriteMaterial({map:a,depthTest:!1});a=new D.Sprite(a);a.renderOrder=1;c=new D.Object3D;a.scale.set(d,30,1);c.add(a);c.name="label";return c}function f(){v.loaded=!0;v.container=c("player");v.scene=new D.Scene;v.camera=new D.PerspectiveCamera(45,window.innerWidth/window.innerHeight,.1,2E4);v.camera.position.set(0,0,2600);var a=new D.AmbientLight(10066329);v.scene.add(a); -a=new D.PointLight(6710886,1);a.position.set(1500,1500,1500);v.scene.add(a);v.renderer=v.webgl?new D.WebGLRenderer({antialias:!0,alpha:!0}):new D.CanvasRenderer;"W"==v.colorset?v.renderer.setClearColor(16777215,1):v.renderer.setClearColor(0,1);v.renderer.setPixelRatio(window.devicePixelRatio);v.renderer.setSize(window.innerWidth,window.innerHeight);v.container.appendChild(v.renderer.domElement);c("zoompanel").onclick=function(a){a=a||window.event;a.cancelBubble?a.cancelBubble=!0:(a.stopPropagation(), -a.preventDefault());a=a.pageY?a.pageY:a.clientY;var c=document.getElementById("zoompanel").offsetTop;v.camera.fov-=7.5*(50>a-c?1:-1);v.camera.updateProjectionMatrix()};v.controls=new D.TrackballControls(v.camera);v.controls.rotateSpeed=7.5;v.controls.staticMoving=!0;g()}function g(){var a=v.scene.getObjectByName("atombox");if(a){v.scene.remove(a);var b=a.children.length-1;for(b;0<=b;b--){var f=a.children[b];f.geometry&&f.geometry.dispose();f.material&&f.material.dispose();f.dispose&&f.dispose()}v.controls.reset()}v.atombox= -new D.Object3D;(a=document.getElementById("infopanel"))&&a.parentNode.removeChild(a);v.obj3d.descr&&c("infopanel","a="+(Math.round(1E3*parseFloat(v.obj3d.descr.a))/1E3).toFixed(3)+"Å
b="+(Math.round(1E3*parseFloat(v.obj3d.descr.b))/1E3).toFixed(3)+"Å
c="+(Math.round(1E3*parseFloat(v.obj3d.descr.c))/1E3).toFixed(3)+"Å
α="+(Math.round(100*parseFloat(v.obj3d.descr.alpha))/ +'use strict';var player=function(da){function Z(t){if($[t])return $[t].exports;var m=$[t]={exports:{},id:t,loaded:!1};da[t].call(m.exports,m,m.exports,Z);m.loaded=!0;return m.exports}var $={};Z.m=da;Z.c=$;Z.p="";return Z(0)}([function(da,Z,$){!function(){var t=[$(1),$(4),$(6),$(3)];(function(m,k,x,b){function a(a){var c=document.getElementById("notifybox"),b=document.getElementById("message");c.style.display="block";b.innerHTML="";setTimeout(function(){b.innerHTML=a},250)}function c(a,c){var b=document.createElement("div"); +b.setAttribute("id",a);c&&(b.innerHTML=c);document.body.appendChild(b);return b}function d(a,c,b){b||(b=14540253);var d=new B.Geometry;d.vertices.push(new B.Vector3(a[0],a[1],a[2]));d.vertices.push(new B.Vector3(c[0],c[1],c[2]));a=new B.LineBasicMaterial({color:b});v.atombox.add(new B.Line(d,a))}function e(a){var c=document.createElement("canvas"),b=c.getContext("2d"),d=3.5*b.measureText(a).width;c.width=d;c.height=30;b.font="normal 30px Arial";b.textAlign="center";b.textBaseline="middle";b.fillStyle= +"W"==v.colorset?"#000000":"#FFFFFF";b.fillText(a,c.width/2,c.height/2);a=new B.Texture(c);a.needsUpdate=!0;a=new B.SpriteMaterial({map:a,depthTest:!1});a=new B.Sprite(a);a.renderOrder=1;c=new B.Object3D;a.scale.set(d,30,1);c.add(a);c.name="label";return c}function f(){v.loaded=!0;v.container=c("player");v.scene=new B.Scene;v.camera=new B.PerspectiveCamera(45,window.innerWidth/window.innerHeight,.1,2E4);v.camera.position.set(0,0,2600);var a=new B.AmbientLight(10066329);v.scene.add(a);a=new B.PointLight(6710886, +1);a.position.set(1500,1500,1500);v.scene.add(a);v.renderer=v.webgl?new B.WebGLRenderer({antialias:!0,alpha:!0}):new B.CanvasRenderer;"W"==v.colorset?v.renderer.setClearColor(16777215,1):v.renderer.setClearColor(0,1);v.renderer.setPixelRatio(window.devicePixelRatio);v.renderer.setSize(window.innerWidth,window.innerHeight);v.container.appendChild(v.renderer.domElement);c("zoompanel").onclick=function(a){a=a||window.event;a.cancelBubble?a.cancelBubble=!0:(a.stopPropagation(),a.preventDefault());a=a.pageY? +a.pageY:a.clientY;var c=document.getElementById("zoompanel").offsetTop;v.camera.fov-=7.5*(50>a-c?1:-1);v.camera.updateProjectionMatrix()};v.controls=new B.TrackballControls(v.camera);v.controls.rotateSpeed=7.5;v.controls.staticMoving=!0;g()}function g(){var a=v.scene.getObjectByName("atombox");if(a){v.scene.remove(a);var b=a.children.length-1;for(b;0<=b;b--){var f=a.children[b];f.geometry&&f.geometry.dispose();f.material&&f.material.dispose();f.dispose&&f.dispose()}v.controls.reset()}v.atombox=new B.Object3D; +(a=document.getElementById("infopanel"))&&a.parentNode.removeChild(a);v.obj3d.descr&&c("infopanel","a="+(Math.round(1E3*parseFloat(v.obj3d.descr.a))/1E3).toFixed(3)+"Å
b="+(Math.round(1E3*parseFloat(v.obj3d.descr.b))/1E3).toFixed(3)+"Å
c="+(Math.round(1E3*parseFloat(v.obj3d.descr.c))/1E3).toFixed(3)+"Å
α="+(Math.round(100*parseFloat(v.obj3d.descr.alpha))/ 100).toFixed(2)+"°
β="+(Math.round(100*parseFloat(v.obj3d.descr.beta))/100).toFixed(2)+"°
γ="+(Math.round(100*parseFloat(v.obj3d.descr.gamma))/100).toFixed(2)+"°
");(a=document.getElementById("optionpanel"))&&a.parentNode.removeChild(a);a=c("optionpanel"," "); if(Object.keys(v.obj3d.overlayed).length)for(var h in v.obj3d.overlayed)a.innerHTML+=" ",v.available_overlays.push(h);a=document.getElementsByClassName("optionpanel");for(h=a.length-1;0<=h;h--)a[h].onclick=function(){var a=this.id.replace("optionpanel_","");if(-1!==v.available_overlays.indexOf(a)){var c=v.scene.getObjectByName("atombox"),c=c.children,b=c.filter(function(a){return"label"== a.name}),d,f=b.length;for(d=0;dh;h++)b=Math.round(1E3*parseFloat(v.obj3d.cell[h][0]))/10,f=Math.round(1E3*parseFloat(v.obj3d.cell[h][1]))/ -10,g=Math.round(1E3*parseFloat(v.obj3d.cell[h][2]))/10,a.push([b,f,g]),0==h?n=10027008:1==h?n=39168:2==h&&(n=39423),v.atombox.add(new D.ArrowHelper((new D.Vector3(b,f,g)).normalize(),new D.Vector3(0,0,0),Math.sqrt(b*b+f*f+g*g),n,75,10));h=[a[0][0]+a[1][0],a[0][1]+a[1][1],a[0][2]+a[1][2]];b=[a[0][0]+a[2][0],a[0][1]+a[2][1],a[0][2]+a[2][2]];f=[h[0]+a[2][0],h[1]+a[2][1],h[2]+a[2][2]];g=[a[1][0]+a[2][0],a[1][1]+a[2][1],a[1][2]+a[2][2]];n=[];n.push([a[0],h]);n.push([a[0],b]);n.push([a[1],g]);n.push([a[1], -h]);n.push([a[2],g]);n.push([a[2],b]);n.push([h,f]);n.push([b,f]);n.push([f,g]);a=n.length;for(h=0;ha-c?(a=l("colorset"))&&"W"!=a?t("colorset","W"):t("colorset","B"):(a=l("forcewebgl"))&& -"Y"!=a?t("forcewebgl","Y"):t("forcewebgl","N");document.location.reload()}function t(a,c){document.cookie=c?a+"="+c.toString()+"; expires=Fri, 31 Dec 9999 23:59:59 GMT":a+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT"}function l(a){return"forcewebgl"==a?document.cookie.replace(/(?:(?:^|.*;\s*)forcewebgl\s*\=\s*([^;]*).*$)|^.*$/,"$1"):"colorset"==a?document.cookie.replace(/(?:(?:^|.*;\s*)colorset\s*\=\s*([^;]*).*$)|^.*$/,"$1"):!1}function s(a){a=a||window.event;a.cancelBubble?a.cancelBubble=!0:(a.stopPropagation(), -a.preventDefault());P(v.sample,!1)}function p(c){var b=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");b.onreadystatechange=function(){4==b.readyState&&(200==b.status?P(b.responseText,!0):(a("Error: HTTP "+b.status+" status received during retrieving data from the server"),v.loaded||n()))};b.open("GET",c);b.send(1)}function P(a,c){v.obj3d=m.to_player(a);v.obj3d?(document.getElementById("landing").style.display="none",v.loaded?g():f()):v.loaded||n()}function R(c){c.stopPropagation(); -c.preventDefault();if(1
');document.getElementById("cross").onclick=function(){d.style.display="none"};c("versionbox","v"+v.version);c("cmdbox","Load new").onclick=n;c("tunebox").onclick=z;c("landing",'

Materials Informatics Web-viewer

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=s;m=m(k,{warning:a,error:a});window.addEventListener("resize",h,!1);window.addEventListener("hashchange",x,!1);if(v.local_supported){window.addEventListener("dragover",y,!1);window.addEventListener("drop",R,!1);var b=document.getElementById("fileapi"),e=new FileReader;b.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){P(a.target.result,!1)}}window.parent&&window.parent.playerdata?(b="object"===typeof window.parent.playerdata&&document.location.search?window.parent.playerdata[document.location.search.substr(1)]:window.parent.playerdata,P(b,!1)):document.location.hash.length?x():n()})}).apply(null,r)}()},function(ea,ba,Z){String.prototype.startswith=function(r){return 0===this.indexOf(r)};String.prototype.endswith=function(r,m){var k=this.toString();if(void 0===m||m>k.length)m=k.length;m-=r.length;k= -k.indexOf(r,m);return-1!==k&&k===m};String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")};String.prototype.isnumeric=function(){return!isNaN(parseFloat(this))&&isFinite(this)};ba=function(r,m){function k(a){if(0k.length)return m.error("Error: invalid atom definition!"),!1;for(p=0;4>p;p++)v[l[p]]=3>p?parseFloat(k[p]):k[p];v.symbol=v.symbol.replace(/\W+/,"").replace(/\d+/,"");v.symbol.length||(v.symbol="Xx");b.push(v);y++}c=r.multiply(c,e);if(b.length)return{cell:c,atoms:b,types:t};m.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",label:"labels"};return{to_player:function(b){var g;switch(k(b)){case "CIF":g=a(b);break;case "POSCAR":g=c(b);break;default:m.error("Error: file format cannot be recognized!")}if(!g)return!1;b=g;var h=!1;6==Object.keys(b.cell).length?(g=u(b.cell.a,b.cell.b,b.cell.c,b.cell.alpha,b.cell.beta,b.cell.gamma),h=b.cell):g=b.cell; -var h={atoms:[],cell:g,descr:h,overlayed:{}},q,x,n,z={},t=0,l=b.atoms.length,s={};for(t;th;h++)b=Math.round(1E3*parseFloat(v.obj3d.cell[h][0]))/10,f=Math.round(1E3*parseFloat(v.obj3d.cell[h][1]))/ +10,g=Math.round(1E3*parseFloat(v.obj3d.cell[h][2]))/10,a.push([b,f,g]),0==h?r=10027008:1==h?r=39168:2==h&&(r=39423),v.atombox.add(new B.ArrowHelper((new B.Vector3(b,f,g)).normalize(),new B.Vector3(0,0,0),Math.sqrt(b*b+f*f+g*g),r,75,10));h=[a[0][0]+a[1][0],a[0][1]+a[1][1],a[0][2]+a[1][2]];b=[a[0][0]+a[2][0],a[0][1]+a[2][1],a[0][2]+a[2][2]];f=[h[0]+a[2][0],h[1]+a[2][1],h[2]+a[2][2]];g=[a[1][0]+a[2][0],a[1][1]+a[2][1],a[1][2]+a[2][2]];r=[];r.push([a[0],h]);r.push([a[0],b]);r.push([a[1],g]);r.push([a[1], +h]);r.push([a[2],g]);r.push([a[2],b]);r.push([h,f]);r.push([b,f]);r.push([f,g]);a=r.length;for(h=0;ha-c?(a=l("colorset"))&&"W"!=a?y("colorset","W"):y("colorset","B"):(a=l("forcewebgl"))&& +"Y"!=a?y("forcewebgl","Y"):y("forcewebgl","N");document.location.reload()}function y(a,c){document.cookie=c?a+"="+c.toString()+"; expires=Fri, 31 Dec 9999 23:59:59 GMT":a+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT"}function l(a){return"forcewebgl"==a?document.cookie.replace(/(?:(?:^|.*;\s*)forcewebgl\s*\=\s*([^;]*).*$)|^.*$/,"$1"):"colorset"==a?document.cookie.replace(/(?:(?:^|.*;\s*)colorset\s*\=\s*([^;]*).*$)|^.*$/,"$1"):!1}function s(a){a=a||window.event;a.cancelBubble?a.cancelBubble=!0:(a.stopPropagation(), +a.preventDefault());N(v.sample,!1)}function n(c){var b=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");b.onreadystatechange=function(){4==b.readyState&&(200==b.status?N(b.responseText,!0):(a("Error: HTTP "+b.status+" status received during retrieving data from the server"),v.loaded||r()))};b.open("GET",c);b.send(1)}function N(a,c){v.obj3d=m.to_player(a);v.obj3d?(document.getElementById("landing").style.display="none",v.loaded?g():f(),v.obj3d.info&&(document.title=v.obj3d.info)): +v.loaded||r()}function W(c){c.stopPropagation();c.preventDefault();if(1
');document.getElementById("cross").onclick=function(){d.style.display="none"};c("versionbox","v"+v.version);c("cmdbox","Load new").onclick=r;c("tunebox").onclick=q;c("landing",'

Materials Informatics Web-viewer

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=s;m=m(k,{warning:a,error:a});window.addEventListener("resize",h,!1);window.addEventListener("hashchange",u,!1);if(v.local_supported){window.addEventListener("dragover",z,!1);window.addEventListener("drop",W,!1);var b=document.getElementById("fileapi"),e=new FileReader;b.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){N(a.target.result,!1)}}window.parent&&window.parent.playerdata?(b="object"===typeof window.parent.playerdata&&document.location.search?window.parent.playerdata[document.location.search.substr(1)]:window.parent.playerdata,N(b,!1)):document.location.hash.length?u():r()})}).apply(null,t)}()},function(da,Z,$){String.prototype.startswith=function(t){return 0===this.indexOf(t)};String.prototype.endswith=function(t,m){var k=this.toString();if(void 0===m||m>k.length)m=k.length;m-=t.length;k=k.indexOf(t, +m);return-1!==k&&k===m};String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")};String.prototype.isnumeric=function(){return!isNaN(parseFloat(this))&&isFinite(this)};Z=function(t,m){function k(a){if(0k.length)return m.error("Error: invalid atom definition!"),!1;for(n=0;4>n;n++)v[l[n]]=3>n?parseFloat(k[n]):k[n];v.symbol=v.symbol.replace(/\W+/,"").replace(/\d+/,"");v.symbol.length||(v.symbol="Xx");b.push(v);z++}c=t.multiply(c,e);if(b.length)return{cell:c,atoms:b,types:y};m.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",label:"labels"};return{to_player:function(b){var g;switch(k(b)){case "CIF":g=a(b);break;case "POSCAR":g=c(b);break;default:m.error("Error: file format cannot be recognized!")}if(!g)return!1;b=g;var h=!1;6==Object.keys(b.cell).length?(g=x(b.cell.a,b.cell.b,b.cell.c,b.cell.alpha,b.cell.beta, +b.cell.gamma),h=b.cell):g=b.cell;var h={atoms:[],cell:g,descr:h,overlayed:{},info:b.info},p,u,r,q={},y=0,l=b.atoms.length,s={};for(y;y15 significant digits to BigNumber (value: "+a+"). Use function bignumber(x) to convert to BigNumber."); return new c.BigNumber(a)}},{from:"number",to:"Complex",convert:function(a){return new c.Complex(a,0)}},{from:"number",to:"string",convert:function(a){return a+""}},{from:"BigNumber",to:"Complex",convert:function(a){return new c.Complex(a.toNumber(),0)}},{from:"Fraction",to:"Complex",convert:function(a){return new c.Complex(a.valueOf(),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 c.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 c.BigNumber(+a)}},{from:"boolean",to:"Fraction",convert:function(a){return new c.Fraction(+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 c.BigNumber(0)}},{from:"null",to:"Fraction",convert:function(){return new c.Fraction(0)}},{from:"Array",to:"Matrix",convert:function(a){return new c.DenseMatrix(a)}},{from:"Matrix",to:"Array",convert:function(a){return a.valueOf()}}];return d}},function(r,m,k){var u,b,a;"use strict";(function(c,d){!(b=[],u=d,a="function"===typeof u?u.apply(m, -b):u,void 0!==a&&(r.exports=a))})(this,function(){function a(){function b(a){for(var c,d=0;dc&&!g?"Unexpected type of argument in function "+h+" (expected: "+e.join(" or ")+", actual: "+f+", index: "+c+")":"Too few arguments in function "+h+" (expected: "+e.join(" or ")+", index: "+c+")":"Too many arguments in function "+h+" (expected: "+c+", actual: "+b+")";b=new TypeError(b); -b.data=a;return b}function g(a){this.name=a||"refs";this.categories={}}function h(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;cl)c[g]=h;else{if(0===l)throw Error('Signature "'+g+'" is defined twice');}else c[g]=h}for(g in c)c.hasOwnProperty(g)&&d.push(c[g]);d.sort(function(a,b){return q.compare(a,b)});for(e=0;eq&&(q=p)}x=[];for(p=0;pl)c[g]=h;else{if(0===l)throw Error('Signature "'+g+'" is defined twice');}else c[g]=h}for(g in c)c.hasOwnProperty(g)&&d.push(c[g]);d.sort(function(a,b){return p.compare(a,b)});for(e=0;ep&&(p=s)}u=[];for(s=0;sb.params.length)return 1;if(a.params.lengthf)return 1;if(e "+ -h+") {"),f.push(c+" var varArgs = [];"),f.push(c+" for (var i = "+h+"; i < arguments.length; i++) {"),f.push(c+" varArgs.push(arguments[i]);");else{var l=function(c,e){for(var f=[],h=0;h "+b+") {",c+" throw createError(name, arguments.length, "+b+", arguments["+b+"]);",c+"}"].join("\n");for(var d={},e=[],f= +b.push(e))}return(this.varArgs?"...":"")+b.join("|")};p.prototype.clone=function(){return new p(this.params.slice(),this.fn)};p.prototype.expand=function(){function a(c,d){if(d.lengthb.params.length)return 1;if(a.params.lengthf)return 1;if(e "+ +h+") {"),f.push(c+" var varArgs = [];"),f.push(c+" for (var i = "+h+"; i < arguments.length; i++) {"),f.push(c+" varArgs.push(arguments[i]);");else{var l=function(c,e){for(var f=[],h=0;h "+b+") {",c+" throw createError(name, arguments.length, "+b+", arguments["+b+"]);",c+"}"].join("\n");for(var d={},e=[],f= 0;fb?-1:0};m.format=function(b,a){if("function"===typeof a)return a(b);if(Infinity===b)return"Infinity";if(-Infinity===b)return"-Infinity";if(isNaN(b))return"NaN";var c="auto",d=void 0;a&&(a.notation&&(c=a.notation),m.isNumber(a)?d=a:a.precision&&(d=a.precision));switch(c){case "fixed":return m.toFixed(b, -d);case "exponential":return m.toExponential(b,d);case "engineering":return m.toEngineering(b,d);case "auto":return m.toPrecision(b,d,a&&a.exponential).replace(/((\.\d*?)(0+))($|e)/,function(a,c,b,d,q){return"."!==b?b+q:q});default:throw Error('Unknown notation "'+c+'". Choose "auto", "exponential", or "fixed".');}};m.toExponential=function(b,a){return(new u(b)).toExponential(a)};m.toEngineering=function(b,a){return(new u(b)).toEngineering(a)};m.toFixed=function(b,a){return(new u(b)).toFixed(a)}; -m.toPrecision=function(b,a,c){return(new u(b)).toPrecision(a,c)};m.digits=function(b){return b.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length};m.DBL_EPSILON=Number.EPSILON||2.220446049250313E-16;m.nearlyEqual=function(b,a,c){if(null==c)return b==a;if(b==a)return!0;if(isNaN(b)||isNaN(a))return!1;if(isFinite(b)&&isFinite(a)){var d=Math.abs(b-a);return da?a-3-a%3:a-a%3,e=0<=a?a:Math.abs(d);c.length-1a&&(c=u(-a+1).concat(c),a=1);b&&c.splice(a,0,0===a? -"0.":".");return this.sign+c.join("")};k.prototype.toExponential=function(b){var a=b?this.roundDigits(b):this.clone(),c=a.coefficients,a=a.exponent;c.length=d)return this.toExponential(b);d=b?this.roundDigits(b):this.clone();c= -d.coefficients;d=d.exponent;c.length=b;)c.unshift(0),a.exponent++,b++;if(c.length>b&&5<=c.splice(b,c.length- -b)[0])for(b-=1,c[b]++;10===c[b];)c.pop(),0===b&&(c.unshift(0),a.exponent++,b++),b--,c[b]++;return a};r.exports=k},function(r,m,k){var u=k(9);m.mixin=function(b){var a=new u;b.on=a.on.bind(a);b.off=a.off.bind(a);b.once=a.once.bind(a);b.emit=a.emit.bind(a);return b}},function(r,m){function k(){}k.prototype={on:function(k,b,a){var c=this.e||(this.e={});(c[k]||(c[k]=[])).push({fn:b,ctx:a});return this},once:function(k,b,a){function c(){d.off(k,c);b.apply(a,arguments)}var d=this;c._=b;return this.on(k, -c,a)},emit:function(k){var b=[].slice.call(arguments,1),a=((this.e||(this.e={}))[k]||[]).slice(),c=0,d=a.length;for(c;cb?-1:0};m.format=function(b,a){if("function"===typeof a)return a(b);if(Infinity===b)return"Infinity";if(-Infinity===b)return"-Infinity";if(isNaN(b))return"NaN";var c="auto",d=void 0;a&&(a.notation&&(c=a.notation),m.isNumber(a)?d=a:a.precision&&(d=a.precision));switch(c){case "fixed":return m.toFixed(b, +d);case "exponential":return m.toExponential(b,d);case "engineering":return m.toEngineering(b,d);case "auto":return m.toPrecision(b,d,a&&a.exponential).replace(/((\.\d*?)(0+))($|e)/,function(a,c,b,d,p){return"."!==b?b+p:p});default:throw Error('Unknown notation "'+c+'". Choose "auto", "exponential", or "fixed".');}};m.toExponential=function(b,a){return(new x(b)).toExponential(a)};m.toEngineering=function(b,a){return(new x(b)).toEngineering(a)};m.toFixed=function(b,a){return(new x(b)).toFixed(a)}; +m.toPrecision=function(b,a,c){return(new x(b)).toPrecision(a,c)};m.digits=function(b){return b.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length};m.DBL_EPSILON=Number.EPSILON||2.220446049250313E-16;m.nearlyEqual=function(b,a,c){if(null==c)return b==a;if(b==a)return!0;if(isNaN(b)||isNaN(a))return!1;if(isFinite(b)&&isFinite(a)){var d=Math.abs(b-a);return da?a-3-a%3:a-a%3,e=0<=a?a:Math.abs(d);c.length-1a&&(c=x(-a+1).concat(c),a=1);b&&c.splice(a,0,0===a? +"0.":".");return this.sign+c.join("")};k.prototype.toExponential=function(b){var a=b?this.roundDigits(b):this.clone(),c=a.coefficients,a=a.exponent;c.length=d)return this.toExponential(b);d=b?this.roundDigits(b):this.clone();c= +d.coefficients;d=d.exponent;c.length=b;)c.unshift(0),a.exponent++,b++;if(c.length>b&&5<=c.splice(b,c.length- +b)[0])for(b-=1,c[b]++;10===c[b];)c.pop(),0===b&&(c.unshift(0),a.exponent++,b++),b--,c[b]++;return a};t.exports=k},function(t,m,k){var x=k(9);m.mixin=function(b){var a=new x;b.on=a.on.bind(a);b.off=a.off.bind(a);b.once=a.once.bind(a);b.emit=a.emit.bind(a);return b}},function(t,m){function k(){}k.prototype={on:function(k,b,a){var c=this.e||(this.e={});(c[k]||(c[k]=[])).push({fn:b,ctx:a});return this},once:function(k,b,a){function c(){d.off(k,c);b.apply(a,arguments)}var d=this;c._=b;return this.on(k, +c,a)},emit:function(k){var b=[].slice.call(arguments,1),a=((this.e||(this.e={}))[k]||[]).slice(),c=0,d=a.length;for(c;c");}function b(a,c,d,e){var f,g=c[d],l=Math.min(a.length,g);a.length=g; +};return e}},function(t,m,k){m.array=k(15);m["boolean"]=k(21);m["function"]=k(22);m.number=k(6);m.object=k(3);m.string=k(16);m.types=k(18);m.emitter=k(8)},function(t,m,k){function x(a,c,b){var d=a.length;if(d!=c[b])throw new f(d,c[b]);if(b");}function b(a,c,d,e){var f,g=c[d],l=Math.min(a.length,g);a.length=g; if(da||"number"===typeof c&&a>=c)throw new g(a,c);};m.UNINITIALIZED={};m.resize=function(a,c,f){if(!Array.isArray(a)||!Array.isArray(c))throw new TypeError("Array expected"); +var d=k(6),e=k(16);k(3);k(18);var f=k(19),g=k(20);m.size=function(a){for(var c=[];Array.isArray(a);)c.push(a.length),a=a[0];return c};m.validate=function(a,c){if(0==c.length){if(Array.isArray(a))throw new f(a.length,0);}else x(a,c,0)};m.validateIndex=function(a,c){if(!d.isNumber(a)||!d.isInteger(a))throw new TypeError("Index must be an integer (value: "+a+")");if(0>a||"number"===typeof c&&a>=c)throw new g(a,c);};m.UNINITIALIZED={};m.resize=function(a,c,f){if(!Array.isArray(a)||!Array.isArray(c))throw new TypeError("Array expected"); if(0===c.length)throw Error("Resizing to scalar is not supported");c.forEach(function(a){if(!d.isNumber(a)||!d.isInteger(a)||0>a)throw new TypeError("Invalid size, must contain positive integers (size: "+e.format(c)+")");});b(a,c,0,void 0!==f?f:0);return a};m.squeeze=function(c,b){for(var d=b||m.size(c);Array.isArray(c)&&1===c.length;)c=c[0],d.shift();for(var e=d.length;1===d[e-1];)e--;earguments.length?(this.min=0,this.max=b):(this.min=b,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}k.prototype=new RangeError;k.prototype.constructor=RangeError;k.prototype.name="IndexError";k.prototype.isIndexError=!0;r.exports=k},function(r,m){m.isBoolean= -function(k){return"boolean"==typeof k}},function(r,m){m.memoize=function(k,m){return function a(){"object"!==typeof a.cache&&(a.cache={});for(var c=[],d=0;d");q=e.max().map(function(a){return a+1});m(a,q,h);P(a._data,e,f,g.length,0)}return a}function P(a,c,b,d,e){var f=e==d-1,h=c.dimension(e);f?h.forEach(function(c,d){q(c);a[c]=b[d[0]]}):h.forEach(function(f,h){q(f);P(a[f],c,b[h[0]],d,e+1)})}function m(a,c,b){for(var d= -a._size.slice(0),e=!1;d.lengthd[f]&&(d[f]=c[f],e=!0);e&&v(a,d,b)}function y(a){for(var c=0,b=a.length;carguments.length?(this.min=0,this.max=b):(this.min=b,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}k.prototype=new RangeError;k.prototype.constructor=RangeError;k.prototype.name="IndexError";k.prototype.isIndexError=!0;t.exports=k},function(t,m){m.isBoolean= +function(k){return"boolean"==typeof k}},function(t,m){m.memoize=function(k,m){return function a(){"object"!==typeof a.cache&&(a.cache={});for(var c=[],d=0;d");p=e.max().map(function(a){return a+1});m(a,p,h);N(a._data,e,f,g.length,0)}return a}function N(a,c,b,d,e){var f=e==d-1,h=c.dimension(e);f?h.forEach(function(c,d){p(c);a[c]=b[d[0]]}):h.forEach(function(f,h){p(f);N(a[f],c,b[h[0]],d,e+1)})}function m(a,c,b){for(var d= +a._size.slice(0),e=!1;d.lengthd[f]&&(d[f]=c[f],e=!0);e&&v(a,d,b)}function z(a){for(var c=0,b=a.length;ca?-a:0;for(var b=Math.min(this._size[0]-a,this._size[1]-c),d=[],e=0;ea)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;q&&h(n)&&(q=t.convert(q,n));n=0d?-d:0;var p= -a[0],s=a[1],z=Math.min(p-d,s-n),P;if(e(b)){if(b.length!==z)throw Error("Invalid value array length");P=function(a){return b[a]}}else if(b&&!0===b.isMatrix){P=b.size();if(1!==P.length||P[0]!==z)throw Error("Invalid matrix length");P=function(a){return b.get([a])}}else P=function(){return b};q||(q=P(0)&&!0===P(0).isBigNumber?new x.BigNumber(0):0);var k=[];if(0a)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;p&&h(r)&&(p=y.convert(p,r));r=0d?-d:0;var s= +a[0],n=a[1],q=Math.min(s-d,n-r),N;if(e(b)){if(b.length!==q)throw Error("Invalid value array length");N=function(a){return b[a]}}else if(b&&!0===b.isMatrix){N=b.size();if(1!==N.length||N[0]!==q)throw Error("Invalid matrix length");N=function(a){return b.get([a])}}else N=function(){return b};p||(p=N(0)&&!0===N(0).isBigNumber?new u.BigNumber(0):0);var k=[];if(0>",rightLogShift:">>>",equal:"=",unequal:"\\neq",smaller:"<",larger:">",smallerEq:"\\leq", -largerEq:"\\geq",bitAnd:"\\&",bitXor:"\\underline{|}",bitOr:"|",and:"\\wedge",xor:"\\veebar",or:"\\vee"};m.defaultTemplate="\\mathrm{${name}}\\left(${args}\\right)";var k={deg:"^\\circ"};m.toSymbol=function(u,b){if("undefined"===typeof b?0:b)return k.hasOwnProperty(u)?k[u]:"\\mathrm{"+u+"}";if(m.symbols.hasOwnProperty(u))return m.symbols[u];if(-1!==u.indexOf("_")){var a=u.indexOf("_");return m.toSymbol(u.substring(0,a))+"_{"+m.toSymbol(u.substring(a+1))+"}"}return u}},function(r,m,k){var u=k(19); -m.name="algorithm01";m.factory=function(b,a,c,d){var e=b.DenseMatrix;return function(a,c,b,q){var x=a._data,n=a._size,z=a._datatype;a=c._values;var t=c._index,l=c._ptr,s=c._size,p=c._datatype;if(n.length!==s.length)throw new u(n.length,s.length);if(n[0]!==s[0]||n[1]!==s[1])throw new RangeError("Dimension mismatch. Matrix A ("+n+") must match Matrix B ("+s+")");if(!a)throw Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");c=n[0];n=n[1];b=(z="string"===typeof z&&z===p?z:void 0)? -d.find(b,[z,z]):b;for(var k=[],p=0;pb)try{var e=t(d),f=l(e);if((d===f||1E-14>Math.abs((d-f)/d))&&1===e.d%2)return(0===e.n%2?1:-1)*Math.pow(-b,d)}catch(h){}return u(d)||0<=b||c.predictable?Math.pow(b,d):(new a.Complex(b,0)).pow(d,0)}function g(a,c){if(!u(c)||0>c)throw new TypeError("For A^b, b must be a positive integer (value is "+c+")");var d=b(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=x(d[0]).valueOf(),e=a;1<=c;)1==(c&1)&&(d=n(e,d)),c>>=1,e=n(e,e);return d}function h(a,c){return z(g(a.valueOf(),c))}var q=k(33),x=d(k(42)),n=d(k(43)),z=d(k(31)),t=d(k(46)),l=d(k(47));d=e("pow",{"number, number":f,"Complex, Complex":function(a,c){return a.pow(c)},"BigNumber, BigNumber":function(b,d){return d.isInteger()||0<=b||c.predictable?b.pow(d):(new a.Complex(b.toNumber(),0)).pow(d.toNumber(),0)},"Fraction, Fraction":function(a,b){if(1!==b.d){if(c.predictable)throw Error("Function pow does not support non-integer exponents for fractions."); -return f(a.valueOf(),b.valueOf())}return a.pow(b)},"Array, number":g,"Array, BigNumber":function(a,c){return g(a,c.toNumber())},"Matrix, number":h,"Matrix, BigNumber":function(a,c){return h(a,c.toNumber())},"Unit, number":function(a,c){return a.pow(c)}});d.toTex={2:"\\left(${args[0]}\\right)"+q.operators.pow+"{${args[1]}}"};return d}},function(r,m,k){var u=k(15),b=k(6).isInteger;m.name="eye";m.factory=function(a,c,d,e){function f(a,c){switch(a.length){case 0:return c?h(c):[];case 1:return g(a[0], +largerEq:"\\geq",bitAnd:"\\&",bitXor:"\\underline{|}",bitOr:"|",and:"\\wedge",xor:"\\veebar",or:"\\vee"};m.defaultTemplate="\\mathrm{${name}}\\left(${args}\\right)";var k={deg:"^\\circ"};m.toSymbol=function(x,b){if("undefined"===typeof b?0:b)return k.hasOwnProperty(x)?k[x]:"\\mathrm{"+x+"}";if(m.symbols.hasOwnProperty(x))return m.symbols[x];if(-1!==x.indexOf("_")){var a=x.indexOf("_");return m.toSymbol(x.substring(0,a))+"_{"+m.toSymbol(x.substring(a+1))+"}"}return x}},function(t,m,k){var x=k(19); +m.name="algorithm01";m.factory=function(b,a,c,d){var e=b.DenseMatrix;return function(a,c,b,p){var u=a._data,r=a._size,q=a._datatype;a=c._values;var y=c._index,l=c._ptr,s=c._size,n=c._datatype;if(r.length!==s.length)throw new x(r.length,s.length);if(r[0]!==s[0]||r[1]!==s[1])throw new RangeError("Dimension mismatch. Matrix A ("+r+") must match Matrix B ("+s+")");if(!a)throw Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");c=r[0];r=r[1];b=(q="string"===typeof q&&q===n?q:void 0)? +d.find(b,[q,q]):b;for(var k=[],n=0;nb)try{var e=y(d),f=l(e);if((d===f||1E-14>Math.abs((d-f)/d))&&1===e.d%2)return(0===e.n%2?1:-1)*Math.pow(-b,d)}catch(h){}return x(d)||0<=b||c.predictable?Math.pow(b,d):(new a.Complex(b,0)).pow(d,0)}function g(a,c){if(!x(c)||0>c)throw new TypeError("For A^b, b must be a positive integer (value is "+c+")");var d=b(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=u(d[0]).valueOf(),e=a;1<=c;)1==(c&1)&&(d=r(e,d)),c>>=1,e=r(e,e);return d}function h(a,c){return q(g(a.valueOf(),c))}var p=k(33),u=d(k(42)),r=d(k(43)),q=d(k(31)),y=d(k(46)),l=d(k(47));d=e("pow",{"number, number":f,"Complex, Complex":function(a,c){return a.pow(c)},"BigNumber, BigNumber":function(b,d){return d.isInteger()||0<=b||c.predictable?b.pow(d):(new a.Complex(b.toNumber(),0)).pow(d.toNumber(),0)},"Fraction, Fraction":function(a,b){if(1!==b.d){if(c.predictable)throw Error("Function pow does not support non-integer exponents for fractions."); +return f(a.valueOf(),b.valueOf())}return a.pow(b)},"Array, number":g,"Array, BigNumber":function(a,c){return g(a,c.toNumber())},"Matrix, number":h,"Matrix, BigNumber":function(a,c){return h(a,c.toNumber())},"Unit, number":function(a,c){return a.pow(c)}});d.toTex={2:"\\left(${args[0]}\\right)"+p.operators.pow+"{${args[1]}}"};return d}},function(t,m,k){var x=k(15),b=k(6).isInteger;m.name="eye";m.factory=function(a,c,d,e){function f(a,c){switch(a.length){case 0:return c?h(c):[];case 1:return g(a[0], a[0],c);case 2:return g(a[0],a[1],c);default:throw Error("Vector containing two values expected");}}function g(c,d,e){var f=c&&!0===c.isBigNumber?a.BigNumber:d&&!0===d.isBigNumber?a.BigNumber:null;c&&!0===c.isBigNumber&&(c=c.toNumber());d&&!0===d.isBigNumber&&(d=d.toNumber());if(!b(c)||1>c)throw Error("Parameters in function eye must be positive integers");if(!b(d)||1>d)throw Error("Parameters in function eye must be positive integers");var h=f?new a.BigNumber(1):1,f=f?new f(0):0,g=[c,d];if(e)return a.Matrix.storage(e).diagonal(g, -h,0,f);e=u.resize([],g,f);c=cX)for(var ha=0,$=0;$c},"number, number":function(a,b){return a>b&&!u(a,b,c.epsilon)},"BigNumber, BigNumber":function(a,d){return a.gt(d)&&!b(a,d,c.epsilon)},"Fraction, Fraction":function(a,c){return 1===a.compare(c)},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers");},"Unit, Unit":function(a,c){if(!a.equalBase(c))throw Error("Cannot compare units with different base"); -return z(a.value,c.value)},"string, string":function(a,c){return a>c},"Matrix, Matrix":function(a,c){var b;switch(a.storage()){case "sparse":switch(c.storage()){case "sparse":b=h(a,c,z);break;default:b=g(c,a,z,!0)}break;default:switch(c.storage()){case "sparse":b=g(a,c,z,!1);break;default:b=x(a,c,z)}}return b},"Array, Array":function(a,c){return z(f(a),f(c)).valueOf()},"Array, Matrix":function(a,c){return z(f(a),c)},"Matrix, Array":function(a,c){return z(a,f(c))},"Matrix, any":function(a,c){var b; -switch(a.storage()){case "sparse":b=q(a,c,z,!1);break;default:b=n(a,c,z,!1)}return b},"any, Matrix":function(a,c){var b;switch(c.storage()){case "sparse":b=q(c,a,z,!0);break;default:b=n(c,a,z,!0)}return b},"Array, any":function(a,c){return n(f(a),c,z,!1).valueOf()},"any, Array":function(a,c){return n(f(c),a,z,!0).valueOf()}});z.toTex={2:"\\left(${args[0]}"+a.operators.larger+"${args[1]}\\right)"};return z}},function(r,m,k){var u=k(19);m.name="algorithm03";m.factory=function(b,a,c,d){var e=b.DenseMatrix; -return function(a,c,b,q){var x=a._data,n=a._size,z=a._datatype;a=c._values;var t=c._index,l=c._ptr,s=c._size,p=c._datatype;if(n.length!==s.length)throw new u(n.length,s.length);if(n[0]!==s[0]||n[1]!==s[1])throw new RangeError("Dimension mismatch. Matrix A ("+n+") must match Matrix B ("+s+")");if(!a)throw Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");c=n[0];var n=n[1],k,s=0,m=b;"string"===typeof z&&z===p&&(k=z,s=d.convert(0,k),m=d.find(b,[k,k]));b=[];for(z=0;zh)break}c=f}else throw new RangeError("Matrix must be square (size: "+b(f)+")");}return c},any:u});h.toTex={1:"\\mathrm{tr}\\left(${args[0]}\\right)"}; -return h}},function(r,m,k){var u=k(3).clone,b=k(16).format;m.name="transpose";m.factory=function(a,c,d,e){c=k(33);var f=d(k(31)),g=a.DenseMatrix,h=a.SparseMatrix,q=e("transpose",{Array:function(a){return q(f(a)).valueOf()},Matrix:function(a){var c=a.size(),d;switch(c.length){case 1:d=a.clone();break;case 2:var e=c[0],f=c[1];if(0===f)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+b(c)+")");switch(a.storage()){case "dense":c=a._data;d=[];for(var q,p=0;pX)for(var ia=0,aa=0;aac},"number, number":function(a,b){return a>b&&!x(a,b,c.epsilon)},"BigNumber, BigNumber":function(a,d){return a.gt(d)&&!b(a,d,c.epsilon)},"Fraction, Fraction":function(a,c){return 1===a.compare(c)},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers");},"Unit, Unit":function(a,c){if(!a.equalBase(c))throw Error("Cannot compare units with different base"); +return q(a.value,c.value)},"string, string":function(a,c){return a>c},"Matrix, Matrix":function(a,c){var b;switch(a.storage()){case "sparse":switch(c.storage()){case "sparse":b=h(a,c,q);break;default:b=g(c,a,q,!0)}break;default:switch(c.storage()){case "sparse":b=g(a,c,q,!1);break;default:b=u(a,c,q)}}return b},"Array, Array":function(a,c){return q(f(a),f(c)).valueOf()},"Array, Matrix":function(a,c){return q(f(a),c)},"Matrix, Array":function(a,c){return q(a,f(c))},"Matrix, any":function(a,c){var b; +switch(a.storage()){case "sparse":b=p(a,c,q,!1);break;default:b=r(a,c,q,!1)}return b},"any, Matrix":function(a,c){var b;switch(c.storage()){case "sparse":b=p(c,a,q,!0);break;default:b=r(c,a,q,!0)}return b},"Array, any":function(a,c){return r(f(a),c,q,!1).valueOf()},"any, Array":function(a,c){return r(f(c),a,q,!0).valueOf()}});q.toTex={2:"\\left(${args[0]}"+a.operators.larger+"${args[1]}\\right)"};return q}},function(t,m,k){var x=k(19);m.name="algorithm03";m.factory=function(b,a,c,d){var e=b.DenseMatrix; +return function(a,c,b,p){var u=a._data,r=a._size,q=a._datatype;a=c._values;var y=c._index,l=c._ptr,s=c._size,n=c._datatype;if(r.length!==s.length)throw new x(r.length,s.length);if(r[0]!==s[0]||r[1]!==s[1])throw new RangeError("Dimension mismatch. Matrix A ("+r+") must match Matrix B ("+s+")");if(!a)throw Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");c=r[0];var r=r[1],k,s=0,m=b;"string"===typeof q&&q===n&&(k=q,s=d.convert(0,k),m=d.find(b,[k,k]));b=[];for(q=0;qh)break}c=f}else throw new RangeError("Matrix must be square (size: "+b(f)+")");}return c},any:x});h.toTex={1:"\\mathrm{tr}\\left(${args[0]}\\right)"}; +return h}},function(t,m,k){var x=k(3).clone,b=k(16).format;m.name="transpose";m.factory=function(a,c,d,e){c=k(33);var f=d(k(31)),g=a.DenseMatrix,h=a.SparseMatrix,p=e("transpose",{Array:function(a){return p(f(a)).valueOf()},Matrix:function(a){var c=a.size(),d;switch(c.length){case 1:d=a.clone();break;case 2:var e=c[0],f=c[1];if(0===f)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+b(c)+")");switch(a.storage()){case "dense":c=a._data;d=[];for(var p,n=0;nthis.depCount&&!this.defined){if(b(h)){if(this.events.error&&this.map.isDefine||l.onError!==x)try{f=X.execCb(d,h,c,f)}catch(g){a=g}else f=X.execCb(d,h,c,f);this.map.isDefine&&void 0===f&&((c=this.module)?f=c.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",P(this.error=a)}else f=h;this.exports=f;if(this.map.isDefine&&!this.ignore&&(aa[d]=f,l.onResourceLoad))l.onResourceLoad(X,this.map,this.depMaps);B(d);this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else e(X.defQueueMap,d)||this.fetch()}},callPlugin:function(){var a=this.map,c=a.id,b=y(a.prefix);this.depMaps.push(b);r(b,"defined",q(this,function(b){var d, -h;h=f(ea,this.map.id);var x=this.map.name,n=this.map.parentMap?this.map.parentMap.name:null,k=X.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(b.normalize&&(x=b.normalize(x,function(a){return m(a,n,!0)})||""),b=y(a.prefix+"!"+x,this.map.parentMap),r(b,"defined",q(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),h=f(da,b.id)){this.depMaps.push(b);if(this.events.error)h.on("error",q(this,function(a){this.emit("error",a)}));h.enable()}}else h? -(this.map.url=X.nameToUrl(h),this.load()):(d=q(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),d.error=q(this,function(a){this.inited=!0;this.error=a;a.requireModules=[c];g(da,function(a){0===a.map.id.indexOf(c+"_unnormalized")&&B(a.map.id)});P(a)}),d.fromText=q(this,function(b,f){var h=a.name,g=y(h),q=M;f&&(b=f);q&&(M=!1);A(g);e($.config,c)&&($.config[h]=$.config[c]);try{l.exec(b)}catch(x){return P(z("fromtexteval","fromText eval for "+c+" failed: "+x,x,[c]))}q&&(M=!0);this.depMaps.push(g); -X.completeLoad(h);k([h],d)}),b.load(a.name,k,d,$))}));X.enable(b,this);this.pluginMaps[b.id]=b},enable:function(){ba[this.map.id]=this;this.enabling=this.enabled=!0;c(this.depMaps,q(this,function(a,c){var b,d;if("string"===typeof a){a=y(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[c]=a;if(b=f(Ga,a.id)){this.depExports[c]=b(this);return}this.depCount+=1;r(a,"defined",q(this,function(a){this.undefed||(this.defineDep(c,a),this.check())}));this.errback?r(a,"error",q(this, -this.errback)):this.events.error&&r(a,"error",q(this,function(a){this.emit("error",a)}))}b=a.id;d=da[b];!e(Ga,b)&&d&&!d.enabled&&X.enable(a,this)}));g(this.pluginMaps,q(this,function(a){var c=f(da,a.id);c&&!c.enabled&&X.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,c){var b=this.events[a];b||(b=this.events[a]=[]);b.push(c)},emit:function(a,b){c(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};X={config:$,contextName:k,registry:da,defined:aa,urlFetched:ma,defQueue:ka, -defQueueMap:{},Module:U,makeModuleMap:y,nextTick:l.nextTick,onError:P,configure:function(b){b.baseUrl&&"/"!==b.baseUrl.charAt(b.baseUrl.length-1)&&(b.baseUrl+="/");var d=$.shim,e={paths:!0,bundles:!0,config:!0,map:!0};g(b,function(a,c){e[c]?($[c]||($[c]={}),h($[c],a,!0,!0)):$[c]=a});b.bundles&&g(b.bundles,function(a,b){c(a,function(a){a!==b&&(ea[a]=b)})});b.shim&&(g(b.shim,function(c,b){a(c)&&(c={deps:c});!c.exports&&!c.init||c.exportsFn||(c.exportsFn=X.makeShimExports(c));d[b]=c}),$.shim=d);b.packages&& -c(b.packages,function(a){var c;a="string"===typeof a?{name:a}:a;c=a.name;a.location&&($.paths[c]=a.location);$.pkgs[c]=a.name+"/"+(a.main||"main").replace(Q,"").replace(E,"")});g(da,function(a,c){a.inited||a.map.unnormalized||(a.map=y(c,null,!0))});(b.deps||b.callback)&&X.require(b.deps||[],b.callback)},makeShimExports:function(a){return function(){var c;a.init&&(c=a.init.apply(u,arguments));return c||a.exports&&n(a.exports)}},makeRequire:function(a,c){function g(d,f,h){var q,x;c.enableBuildCallback&& -f&&b(f)&&(f.__requireJsBuild=!0);if("string"===typeof d){if(b(f))return P(z("requireargs","Invalid require call"),h);if(a&&e(Ga,d))return Ga[d](da[a.id]);if(l.get)return l.get(X,d,a,g);q=y(d,a,!1,!0);q=q.id;return e(aa,q)?aa[q]:P(z("notloaded",'Module name "'+q+'" has not been loaded yet for context: '+k+(a?"":". Use require([])")))}R();X.nextTick(function(){R();x=A(y(null,a));x.skipMap=c.skipMap;x.init(d,f,h,{enabled:!0});D()});return g}c=c||{};h(g,{isBrowser:J,toUrl:function(c){var b,d=c.lastIndexOf("."), -e=c.split("/")[0];-1!==d&&("."!==e&&".."!==e||1e.attachEvent.toString().indexOf("[native code")||L?(e.addEventListener("load",a.onScriptLoad,!1),e.addEventListener("error", -a.onScriptError,!1)):(M=!0,e.attachEvent("onreadystatechange",a.onScriptLoad));e.src=b;D=e;P?p.insertBefore(e,P):p.appendChild(e);D=null;return e}if(C)try{importScripts(b),a.completeLoad(c)}catch(f){a.onError(z("importscripts","importScripts failed for "+c+" at "+b,f,[c]))}};J&&!G.skipDataMain&&d(document.getElementsByTagName("script"),function(a){p||(p=a.parentNode);if(R=a.getAttribute("data-main"))return A=R,G.baseUrl||(y=A.split("/"),A=y.pop(),F=y.length?y.join("/")+"/":"./",G.baseUrl=F),A=A.replace(E, -""),l.jsExtRegExp.test(A)&&(A=R),G.deps=G.deps?G.deps.concat(A):[A],!0});k=function(c,e,f){var h,g;"string"!==typeof c&&(f=e,e=c,c=null);a(e)||(f=e,e=null);!e&&b(f)&&(e=[],f.length&&(f.toString().replace(B,"").replace(H,function(a,c){e.push(c)}),e=(1===f.length?["require"]:["require","exports","module"]).concat(e)));M&&((h=D)||(v&&"interactive"===v.readyState||d(document.getElementsByTagName("script"),function(a){if("interactive"===a.readyState)return v=a}),h=v),h&&(c||(c=h.getAttribute("data-requiremodule")), -g=U[h.getAttribute("data-requirecontext")]));g?(g.defQueue.push([c,e,f]),g.defQueueMap[c]=!0):I.push([c,e,f])};k.amd={jQuery:!0};l.exec=function(a){return eval(a)};l(G)}})(this)},function(ea,ba,Z){var r,m,k;(function(u,b){!(m=[ba],r=b,k="function"===typeof r?r.apply(ba,m):r,void 0!==k&&(ea.exports=k))})(this,function(m){var b={REVISION:"76"};!(r=b,k="function"===typeof r?r.call(m,Z,m,ea):r,void 0!==k&&(ea.exports=k));void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52));void 0===Math.sign&&(Math.sign= -function(a){return 0>a?-1:0>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},setRGB:function(a,c,b){this.r=a;this.g=c;this.b=b;return this},setHSL:function(){function a(a,b,e){0>e&&(e+=1);1e?b:e<2/3?a+6*(b-a)*(2/3-e):a}return function(c, -d,e){c=b.Math.euclideanModulo(c,1);d=b.Math.clamp(d,0,1);e=b.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,c+1/3),this.g=a(e,d,c),this.b=a(e,d,c-1/3));return this}}(),setStyle:function(a){function c(c){void 0!==c&&1>parseFloat(c)&&console.warn("THREE.Color: Alpha component of "+a+" will be ignored.")}var d;if(d=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(a)){var e=d[2];switch(d[1]){case "rgb":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,c(d[5]),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,c(d[5]),this;break;case "hsl":case "hsla":if(d=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(e)){var e=parseFloat(d[1])/ -360,f=parseInt(d[2],10)/100,g=parseInt(d[3],10)/100;c(d[5]);return this.setHSL(e,f,g)}}}else if(d=/^\#([A-Fa-f0-9]+)$/.exec(a)){d=d[1];e=d.length;if(3===e)return this.r=parseInt(d.charAt(0)+d.charAt(0),16)/255,this.g=parseInt(d.charAt(1)+d.charAt(1),16)/255,this.b=parseInt(d.charAt(2)+d.charAt(2),16)/255,this;if(6===e)return this.r=parseInt(d.charAt(0)+d.charAt(1),16)/255,this.g=parseInt(d.charAt(2)+d.charAt(3),16)/255,this.b=parseInt(d.charAt(4)+d.charAt(5),16)/255,this}a&&0=q?x/(f+g): -x/(2-f-g);switch(f){case c:h=(b-e)/x+(bg&&b>c?(b=2*Math.sqrt(1+b-g-c),this._w=(x-h)/b,this._x=.25*b,this._y=(a+f)/b,this._z=(e+q)/b):g>c?(b=2*Math.sqrt(1+g-b-c),this._w=(e-q)/b,this._x=(a+f)/b,this._y=.25*b,this._z=(h+x)/b):(b=2*Math.sqrt(1+c-b-g),this._w=(f-a)/b,this._x=(e+q)/b,this._y=(h+x)/b,this._z=.25*b);this.onChangeCallback();return this},setFromUnitVectors:function(){var a,c;return function(d,e){void 0===a&&(a=new b.Vector3);c=d.dot(e)+ -1;1E-6>c?(c=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=c;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,c){return void 0!==c?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(a,c)):this.multiplyQuaternions(this,a)}, -multiplyQuaternions:function(a,c){var b=a._x,e=a._y,f=a._z,g=a._w,h=c._x,q=c._y,x=c._z,n=c._w;this._x=b*n+g*h+e*x-f*q;this._y=e*n+g*q+f*h-b*x;this._z=f*n+g*x+b*q-e*h;this._w=g*n-b*h-e*q-f*x;this.onChangeCallback();return this},slerp:function(a,c){if(0===c)return this;if(1===c)return this.copy(a);var b=this._x,e=this._y,f=this._z,g=this._w,h=g*a._w+b*a._x+e*a._y+f*a._z;0>h?(this._w=-a._w,this._x=-a._x,this._y=-a._y,this._z=-a._z,h=-h):this.copy(a);if(1<=h)return this._w=g,this._x=b,this._y=e,this._z= -f,this;var q=Math.sqrt(1-h*h);if(.001>Math.abs(q))return this._w=.5*(g+this._w),this._x=.5*(b+this._x),this._y=.5*(e+this._y),this._z=.5*(f+this._z),this;var x=Math.atan2(q,h),h=Math.sin((1-c)*x)/q,q=Math.sin(c*x)/q;this._w=g*h+this._w*q;this._x=b*h+this._x*q;this._y=e*h+this._y*q;this._z=f*h+this._z*q;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,c){void 0===c&&(c=0);this._x=a[c];this._y=a[c+1]; -this._z=a[c+2];this._w=a[c+3];this.onChangeCallback();return this},toArray:function(a,c){void 0===a&&(a=[]);void 0===c&&(c=0);a[c]=this._x;a[c+1]=this._y;a[c+2]=this._z;a[c+3]=this._w;return a},onChange:function(a){this.onChangeCallback=a;return this},onChangeCallback:function(){}};Object.assign(b.Quaternion,{slerp:function(a,c,b,e){return b.copy(a).slerp(c,e)},slerpFlat:function(a,c,b,e,f,g,h){var q=b[e+0],x=b[e+1],n=b[e+2];b=b[e+3];e=f[g+0];var k=f[g+1],m=f[g+2];f=f[g+3];if(b!==f||q!==e||x!==k|| -n!==m){g=1-h;var l=q*e+x*k+n*m+b*f,s=0<=l?1:-1,p=1-l*l;p>Number.EPSILON&&(p=Math.sqrt(p),l=Math.atan2(p,l*s),g=Math.sin(g*l)/p,h=Math.sin(h*l)/p);s*=h;q=q*g+e*s;x=x*g+k*s;n=n*g+m*s;b=b*g+f*s;g===1-h&&(h=1/Math.sqrt(q*q+x*x+n*n+b*b),q*=h,x*=h,n*=h,b*=h)}a[c]=q;a[c+1]=x;a[c+2]=n;a[c+3]=b}});b.Vector2=function(a,c){this.x=a||0;this.y=c||0};b.Vector2.prototype={constructor:b.Vector2,get width(){return this.x},set width(a){this.x=a},get height(){return this.y},set height(a){this.y=a},set:function(a,c){this.x= -a;this.y=c;return this},setScalar:function(a){this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setComponent:function(a,c){switch(a){case 0:this.x=c;break;case 1:this.y=c;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,c){if(void 0!==c)return console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,c);this.x+=a.x;this.y+=a.y;return this},addScalar:function(a){this.x+=a;this.y+=a;return this},addVectors:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;return this},addScaledVector:function(a,c){this.x+=a.x*c;this.y+=a.y*c;return this},sub:function(a,c){if(void 0!==c)return console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), +c){var b=a.size(),d=c.size();if(b.length!==d.length)throw new x(b.length,d.length);switch(a.storage()){case "sparse":switch(c.storage()){case "sparse":b=u(a,c,l);break;default:b=p(c,a,l,!0)}break;default:switch(c.storage()){case "sparse":b=h(a,c,l,!1);break;default:b=q(a,c,l)}}return b},"Array, Array":function(a,c){return l(e(a),e(c)).valueOf()},"Array, Matrix":function(a,c){return l(e(a),c)},"Matrix, Array":function(a,c){return l(a,e(c))},"Matrix, any":function(a,c){var b;switch(a.storage()){case "sparse":b= +r(a,g(c),f);break;default:b=m(a,c,l)}return b},"any, Matrix":function(a,c){var b;switch(c.storage()){case "sparse":b=r(c,a,l,!0);break;default:b=m(c,a,l,!0)}return b},"Array, any":function(a,c){return m(e(a),c,l,!1).valueOf()},"any, Array":function(a,c){return m(e(c),a,l,!0).valueOf()}});l.toTex={2:"\\left(${args[0]}"+b.operators.subtract+"${args[1]}\\right)"};return l}},function(t,m,k){var x=k(19);m.name="algorithm05";m.factory=function(b,a,c,d){var e=c(k(36)),f=b.SparseMatrix;return function(a, +c,b){var u=a._values,r=a._index,k=a._ptr,m=a._size,l=a._datatype;a=c._values;var s=c._index,n=c._ptr,N=c._size,t=c._datatype;if(m.length!==N.length)throw new x(m.length,N.length);if(m[0]!==N[0]||m[1]!==N[1])throw new RangeError("Dimension mismatch. Matrix A ("+m+") must match Matrix B ("+N+")");var z=m[0],m=m[1],v;c=e;var N=0,B=b;"string"===typeof l&&l===t&&(v=l,c=d.find(e,[v,v]),N=d.convert(0,v),B=d.find(b,[v,v]));b=u&&a?[]:void 0;l=[];t=[];v=new f({values:b,index:l,ptr:t,size:[z,m],datatype:v}); +var z=b?[]:void 0,A=b?[]:void 0,L=[],F=[],G,E,M,K;for(E=0;Ethis.depCount&&!this.defined){if(b(h)){if(this.events.error&&this.map.isDefine||l.onError!==u)try{f=X.execCb(d,h,c,f)}catch(g){a=g}else f=X.execCb(d,h,c,f);this.map.isDefine&&void 0===f&&((c=this.module)?f=c.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",H(this.error=a)}else f=h;this.exports=f;if(this.map.isDefine&&!this.ignore&&(ba[d]=f,l.onResourceLoad))l.onResourceLoad(X,this.map,this.depMaps);B(d);this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else e(X.defQueueMap,d)||this.fetch()}},callPlugin:function(){var a=this.map,c=a.id,b=z(a.prefix);this.depMaps.push(b);N(b,"defined",p(this,function(b){var d, +h;h=f(da,this.map.id);var u=this.map.name,r=this.map.parentMap?this.map.parentMap.name:null,k=X.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(b.normalize&&(u=b.normalize(u,function(a){return m(a,r,!0)})||""),b=z(a.prefix+"!"+u,this.map.parentMap),N(b,"defined",p(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),h=f(fa,b.id)){this.depMaps.push(b);if(this.events.error)h.on("error",p(this,function(a){this.emit("error",a)}));h.enable()}}else h? +(this.map.url=X.nameToUrl(h),this.load()):(d=p(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),d.error=p(this,function(a){this.inited=!0;this.error=a;a.requireModules=[c];g(fa,function(a){0===a.map.id.indexOf(c+"_unnormalized")&&B(a.map.id)});H(a)}),d.fromText=p(this,function(b,f){var h=a.name,g=z(h),p=I;f&&(b=f);p&&(I=!1);A(g);e(aa.config,c)&&(aa.config[h]=aa.config[c]);try{l.exec(b)}catch(u){return H(q("fromtexteval","fromText eval for "+c+" failed: "+u,u,[c]))}p&&(I=!0); +this.depMaps.push(g);X.completeLoad(h);k([h],d)}),b.load(a.name,k,d,aa))}));X.enable(b,this);this.pluginMaps[b.id]=b},enable:function(){Z[this.map.id]=this;this.enabling=this.enabled=!0;c(this.depMaps,p(this,function(a,c){var b,d;if("string"===typeof a){a=z(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[c]=a;if(b=f(Ga,a.id)){this.depExports[c]=b(this);return}this.depCount+=1;N(a,"defined",p(this,function(a){this.undefed||(this.defineDep(c,a),this.check())}));this.errback? +N(a,"error",p(this,this.errback)):this.events.error&&N(a,"error",p(this,function(a){this.emit("error",a)}))}b=a.id;d=fa[b];!e(Ga,b)&&d&&!d.enabled&&X.enable(a,this)}));g(this.pluginMaps,p(this,function(a){var c=f(fa,a.id);c&&!c.enabled&&X.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,c){var b=this.events[a];b||(b=this.events[a]=[]);b.push(c)},emit:function(a,b){c(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};X={config:aa,contextName:k,registry:fa,defined:ba, +urlFetched:na,defQueue:ma,defQueueMap:{},Module:O,makeModuleMap:z,nextTick:l.nextTick,onError:H,configure:function(b){b.baseUrl&&"/"!==b.baseUrl.charAt(b.baseUrl.length-1)&&(b.baseUrl+="/");var d=aa.shim,e={paths:!0,bundles:!0,config:!0,map:!0};g(b,function(a,c){e[c]?(aa[c]||(aa[c]={}),h(aa[c],a,!0,!0)):aa[c]=a});b.bundles&&g(b.bundles,function(a,b){c(a,function(a){a!==b&&(da[a]=b)})});b.shim&&(g(b.shim,function(c,b){a(c)&&(c={deps:c});!c.exports&&!c.init||c.exportsFn||(c.exportsFn=X.makeShimExports(c)); +d[b]=c}),aa.shim=d);b.packages&&c(b.packages,function(a){var c;a="string"===typeof a?{name:a}:a;c=a.name;a.location&&(aa.paths[c]=a.location);aa.pkgs[c]=a.name+"/"+(a.main||"main").replace(M,"").replace(E,"")});g(fa,function(a,c){a.inited||a.map.unnormalized||(a.map=z(c,null,!0))});(b.deps||b.callback)&&X.require(b.deps||[],b.callback)},makeShimExports:function(a){return function(){var c;a.init&&(c=a.init.apply(x,arguments));return c||a.exports&&r(a.exports)}},makeRequire:function(a,c){function g(d, +f,h){var p,u;c.enableBuildCallback&&f&&b(f)&&(f.__requireJsBuild=!0);if("string"===typeof d){if(b(f))return H(q("requireargs","Invalid require call"),h);if(a&&e(Ga,d))return Ga[d](fa[a.id]);if(l.get)return l.get(X,d,a,g);p=z(d,a,!1,!0);p=p.id;return e(ba,p)?ba[p]:H(q("notloaded",'Module name "'+p+'" has not been loaded yet for context: '+k+(a?"":". Use require([])")))}W();X.nextTick(function(){W();u=A(z(null,a));u.skipMap=c.skipMap;u.init(d,f,h,{enabled:!0});L()});return g}c=c||{};h(g,{isBrowser:J, +toUrl:function(c){var b,d=c.lastIndexOf("."),e=c.split("/")[0];-1!==d&&("."!==e&&".."!==e||1e.attachEvent.toString().indexOf("[native code")||D?(e.addEventListener("load",a.onScriptLoad,!1),e.addEventListener("error",a.onScriptError,!1)):(I=!0,e.attachEvent("onreadystatechange",a.onScriptLoad));e.src=b;B=e;N?n.insertBefore(e,N):n.appendChild(e);B=null;return e}if(C)try{importScripts(b),a.completeLoad(c)}catch(f){a.onError(q("importscripts","importScripts failed for "+c+" at "+b,f,[c]))}};J&&!H.skipDataMain&&d(document.getElementsByTagName("script"),function(a){n||(n=a.parentNode);if(W= +a.getAttribute("data-main"))return A=W,H.baseUrl||(z=A.split("/"),A=z.pop(),L=z.length?z.join("/")+"/":"./",H.baseUrl=L),A=A.replace(E,""),l.jsExtRegExp.test(A)&&(A=W),H.deps=H.deps?H.deps.concat(A):[A],!0});k=function(c,e,f){var h,g;"string"!==typeof c&&(f=e,e=c,c=null);a(e)||(f=e,e=null);!e&&b(f)&&(e=[],f.length&&(f.toString().replace(F,"").replace(G,function(a,c){e.push(c)}),e=(1===f.length?["require"]:["require","exports","module"]).concat(e)));I&&((h=B)||(v&&"interactive"===v.readyState||d(document.getElementsByTagName("script"), +function(a){if("interactive"===a.readyState)return v=a}),h=v),h&&(c||(c=h.getAttribute("data-requiremodule")),g=O[h.getAttribute("data-requirecontext")]));g?(g.defQueue.push([c,e,f]),g.defQueueMap[c]=!0):Q.push([c,e,f])};k.amd={jQuery:!0};l.exec=function(a){return eval(a)};l(H)}})(this)},function(da,Z,$){var t,m,k;(function(x,b){!(m=[Z],t=b,k="function"===typeof t?t.apply(Z,m):t,void 0!==k&&(da.exports=k))})(this,function(m){var b={REVISION:"76"};!(t=b,k="function"===typeof t?t.call(m,$,m,da):t,void 0!== +k&&(da.exports=k));void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52));void 0===Math.sign&&(Math.sign=function(a){return 0>a?-1:0>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},setRGB:function(a,c,b){this.r=a;this.g=c;this.b=b;return this},setHSL:function(){function a(a, +b,e){0>e&&(e+=1);1e?b:e<2/3?a+6*(b-a)*(2/3-e):a}return function(c,d,e){c=b.Math.euclideanModulo(c,1);d=b.Math.clamp(d,0,1);e=b.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,c+1/3),this.g=a(e,d,c),this.b=a(e,d,c-1/3));return this}}(),setStyle:function(a){function c(c){void 0!==c&&1>parseFloat(c)&&console.warn("THREE.Color: Alpha component of "+a+" will be ignored.")}var d;if(d=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(a)){var e= +d[2];switch(d[1]){case "rgb":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,c(d[5]),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,c(d[5]),this;break; +case "hsl":case "hsla":if(d=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(e)){var e=parseFloat(d[1])/360,f=parseInt(d[2],10)/100,g=parseInt(d[3],10)/100;c(d[5]);return this.setHSL(e,f,g)}}}else if(d=/^\#([A-Fa-f0-9]+)$/.exec(a)){d=d[1];e=d.length;if(3===e)return this.r=parseInt(d.charAt(0)+d.charAt(0),16)/255,this.g=parseInt(d.charAt(1)+d.charAt(1),16)/255,this.b=parseInt(d.charAt(2)+d.charAt(2),16)/255,this;if(6===e)return this.r=parseInt(d.charAt(0)+d.charAt(1), +16)/255,this.g=parseInt(d.charAt(2)+d.charAt(3),16)/255,this.b=parseInt(d.charAt(4)+d.charAt(5),16)/255,this}a&&0=p?u/(f+g):u/(2-f-g);switch(f){case c:h=(b-e)/u+(bg&&b>c?(b=2*Math.sqrt(1+b-g-c),this._w=(u-h)/b,this._x=.25*b,this._y=(a+f)/b,this._z=(e+p)/b):g>c?(b=2*Math.sqrt(1+g-b-c),this._w=(e-p)/b,this._x=(a+f)/b,this._y=.25*b,this._z=(h+u)/b):(b=2*Math.sqrt(1+c-b-g),this._w=(f-a)/b,this._x=(e+p)/b,this._y= +(h+u)/b,this._z=.25*b);this.onChangeCallback();return this},setFromUnitVectors:function(){var a,c;return function(d,e){void 0===a&&(a=new b.Vector3);c=d.dot(e)+1;1E-6>c?(c=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=c;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,c){return void 0!==c?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."), +this.multiplyQuaternions(a,c)):this.multiplyQuaternions(this,a)},multiplyQuaternions:function(a,c){var b=a._x,e=a._y,f=a._z,g=a._w,h=c._x,p=c._y,u=c._z,r=c._w;this._x=b*r+g*h+e*u-f*p;this._y=e*r+g*p+f*h-b*u;this._z=f*r+g*u+b*p-e*h;this._w=g*r-b*h-e*p-f*u;this.onChangeCallback();return this},slerp:function(a,c){if(0===c)return this;if(1===c)return this.copy(a);var b=this._x,e=this._y,f=this._z,g=this._w,h=g*a._w+b*a._x+e*a._y+f*a._z;0>h?(this._w=-a._w,this._x=-a._x,this._y=-a._y,this._z=-a._z,h=-h): +this.copy(a);if(1<=h)return this._w=g,this._x=b,this._y=e,this._z=f,this;var p=Math.sqrt(1-h*h);if(.001>Math.abs(p))return this._w=.5*(g+this._w),this._x=.5*(b+this._x),this._y=.5*(e+this._y),this._z=.5*(f+this._z),this;var u=Math.atan2(p,h),h=Math.sin((1-c)*u)/p,p=Math.sin(c*u)/p;this._w=g*h+this._w*p;this._x=b*h+this._x*p;this._y=e*h+this._y*p;this._z=f*h+this._z*p;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, +c){void 0===c&&(c=0);this._x=a[c];this._y=a[c+1];this._z=a[c+2];this._w=a[c+3];this.onChangeCallback();return this},toArray:function(a,c){void 0===a&&(a=[]);void 0===c&&(c=0);a[c]=this._x;a[c+1]=this._y;a[c+2]=this._z;a[c+3]=this._w;return a},onChange:function(a){this.onChangeCallback=a;return this},onChangeCallback:function(){}};Object.assign(b.Quaternion,{slerp:function(a,c,b,e){return b.copy(a).slerp(c,e)},slerpFlat:function(a,c,b,e,f,g,h){var p=b[e+0],u=b[e+1],r=b[e+2];b=b[e+3];e=f[g+0];var k= +f[g+1],m=f[g+2];f=f[g+3];if(b!==f||p!==e||u!==k||r!==m){g=1-h;var l=p*e+u*k+r*m+b*f,s=0<=l?1:-1,n=1-l*l;n>Number.EPSILON&&(n=Math.sqrt(n),l=Math.atan2(n,l*s),g=Math.sin(g*l)/n,h=Math.sin(h*l)/n);s*=h;p=p*g+e*s;u=u*g+k*s;r=r*g+m*s;b=b*g+f*s;g===1-h&&(h=1/Math.sqrt(p*p+u*u+r*r+b*b),p*=h,u*=h,r*=h,b*=h)}a[c]=p;a[c+1]=u;a[c+2]=r;a[c+3]=b}});b.Vector2=function(a,c){this.x=a||0;this.y=c||0};b.Vector2.prototype={constructor:b.Vector2,get width(){return this.x},set width(a){this.x=a},get height(){return this.y}, +set height(a){this.y=a},set:function(a,c){this.x=a;this.y=c;return this},setScalar:function(a){this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setComponent:function(a,c){switch(a){case 0:this.x=c;break;case 1:this.y=c;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,c){if(void 0!==c)return console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,c);this.x+=a.x;this.y+=a.y;return this},addScalar:function(a){this.x+=a;this.y+=a;return this},addVectors:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;return this},addScaledVector:function(a,c){this.x+=a.x*c;this.y+=a.y*c;return this},sub:function(a,c){if(void 0!==c)return console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), this.subVectors(a,c);this.x-=a.x;this.y-=a.y;return this},subScalar:function(a){this.x-=a;this.y-=a;return this},subVectors:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;return this},multiply:function(a){this.x*=a.x;this.y*=a.y;return this},multiplyScalar:function(a){isFinite(a)?(this.x*=a,this.y*=a):this.y=this.x=0;return this},divide:function(a){this.x/=a.x;this.y/=a.y;return this},divideScalar:function(a){return this.multiplyScalar(1/a)},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y, a.y);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);return this},clamp:function(a,c){this.x=Math.max(a.x,Math.min(c.x,this.x));this.y=Math.max(a.y,Math.min(c.y,this.y));return this},clampScalar:function(){var a,c;return function(d,e){void 0===a&&(a=new b.Vector2,c=new b.Vector2);a.set(d,d);c.set(e,e);return this.clamp(a,c)}}(),clampLength:function(a,c){var b=this.length();this.multiplyScalar(Math.max(a,Math.min(c,b))/b);return this},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}, @@ -314,13 +314,13 @@ return this},subScalar:function(a){this.x-=a;this.y-=a;this.z-=a;return this},subVectors:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;return this},multiply:function(a,c){if(void 0!==c)return console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(a,c);this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){isFinite(a)?(this.x*=a,this.y*=a,this.z*=a):this.z=this.y=this.x=0;return this},multiplyVectors:function(a, c){this.x=a.x*c.x;this.y=a.y*c.y;this.z=a.z*c.z;return this},applyEuler:function(){var a;return function(c){!1===c instanceof b.Euler&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.");void 0===a&&(a=new b.Quaternion);this.applyQuaternion(a.setFromEuler(c));return this}}(),applyAxisAngle:function(){var a;return function(c,d){void 0===a&&(a=new b.Quaternion);this.applyQuaternion(a.setFromAxisAngle(c,d));return this}}(),applyMatrix3:function(a){var c= this.x,b=this.y,e=this.z;a=a.elements;this.x=a[0]*c+a[3]*b+a[6]*e;this.y=a[1]*c+a[4]*b+a[7]*e;this.z=a[2]*c+a[5]*b+a[8]*e;return this},applyMatrix4:function(a){var c=this.x,b=this.y,e=this.z;a=a.elements;this.x=a[0]*c+a[4]*b+a[8]*e+a[12];this.y=a[1]*c+a[5]*b+a[9]*e+a[13];this.z=a[2]*c+a[6]*b+a[10]*e+a[14];return this},applyProjection:function(a){var c=this.x,b=this.y,e=this.z;a=a.elements;var f=1/(a[3]*c+a[7]*b+a[11]*e+a[15]);this.x=(a[0]*c+a[4]*b+a[8]*e+a[12])*f;this.y=(a[1]*c+a[5]*b+a[9]*e+a[13])* -f;this.z=(a[2]*c+a[6]*b+a[10]*e+a[14])*f;return this},applyQuaternion:function(a){var c=this.x,b=this.y,e=this.z,f=a.x,g=a.y,h=a.z;a=a.w;var q=a*c+g*e-h*b,x=a*b+h*c-f*e,n=a*e+f*b-g*c,c=-f*c-g*b-h*e;this.x=q*a+c*-f+x*-h-n*-g;this.y=x*a+c*-g+n*-f-q*-h;this.z=n*a+c*-h+q*-g-x*-f;return this},project:function(){var a;return function(c){void 0===a&&(a=new b.Matrix4);a.multiplyMatrices(c.projectionMatrix,a.getInverse(c.matrixWorld));return this.applyProjection(a)}}(),unproject:function(){var a;return function(c){void 0=== +f;this.z=(a[2]*c+a[6]*b+a[10]*e+a[14])*f;return this},applyQuaternion:function(a){var c=this.x,b=this.y,e=this.z,f=a.x,g=a.y,h=a.z;a=a.w;var p=a*c+g*e-h*b,u=a*b+h*c-f*e,r=a*e+f*b-g*c,c=-f*c-g*b-h*e;this.x=p*a+c*-f+u*-h-r*-g;this.y=u*a+c*-g+r*-f-p*-h;this.z=r*a+c*-h+p*-g-u*-f;return this},project:function(){var a;return function(c){void 0===a&&(a=new b.Matrix4);a.multiplyMatrices(c.projectionMatrix,a.getInverse(c.matrixWorld));return this.applyProjection(a)}}(),unproject:function(){var a;return function(c){void 0=== a&&(a=new b.Matrix4);a.multiplyMatrices(c.matrixWorld,a.getInverse(c.projectionMatrix));return this.applyProjection(a)}}(),transformDirection:function(a){var c=this.x,b=this.y,e=this.z;a=a.elements;this.x=a[0]*c+a[4]*b+a[8]*e;this.y=a[1]*c+a[5]*b+a[9]*e;this.z=a[2]*c+a[6]*b+a[10]*e;this.normalize();return this},divide:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){return this.multiplyScalar(1/a)},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y, a.y);this.z=Math.min(this.z,a.z);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);this.z=Math.max(this.z,a.z);return this},clamp:function(a,c){this.x=Math.max(a.x,Math.min(c.x,this.x));this.y=Math.max(a.y,Math.min(c.y,this.y));this.z=Math.max(a.z,Math.min(c.z,this.z));return this},clampScalar:function(){var a,c;return function(d,e){void 0===a&&(a=new b.Vector3,c=new b.Vector3);a.set(d,d,d);c.set(e,e,e);return this.clamp(a,c)}}(),clampLength:function(a,c){var b= this.length();this.multiplyScalar(Math.max(a,Math.min(c,b))/b);return this},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){return this.multiplyScalar(a/this.length())},lerp:function(a,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;return this},lerpVectors:function(a,c,b){this.subVectors(c,a).multiplyScalar(b).add(a);return this},cross:function(a,c){if(void 0!==c)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(a,c);var b=this.x,e=this.y,f=this.z;this.x=e*a.z-f*a.y;this.y=f*a.x-b*a.z;this.z= -b*a.y-e*a.x;return this},crossVectors:function(a,c){var b=a.x,e=a.y,f=a.z,g=c.x,h=c.y,q=c.z;this.x=e*q-f*h;this.y=f*g-b*q;this.z=b*h-e*g;return this},projectOnVector:function(){var a,c;return function(d){void 0===a&&(a=new b.Vector3);a.copy(d).normalize();c=this.dot(a);return this.copy(a).multiplyScalar(c)}}(),projectOnPlane:function(){var a;return function(c){void 0===a&&(a=new b.Vector3);a.copy(this).projectOnVector(c);return this.sub(a)}}(),reflect:function(){var a;return function(c){void 0=== +b*a.y-e*a.x;return this},crossVectors:function(a,c){var b=a.x,e=a.y,f=a.z,g=c.x,h=c.y,p=c.z;this.x=e*p-f*h;this.y=f*g-b*p;this.z=b*h-e*g;return this},projectOnVector:function(){var a,c;return function(d){void 0===a&&(a=new b.Vector3);a.copy(d).normalize();c=this.dot(a);return this.copy(a).multiplyScalar(c)}}(),projectOnPlane:function(){var a;return function(c){void 0===a&&(a=new b.Vector3);a.copy(this).projectOnVector(c);return this.sub(a)}}(),reflect:function(){var a;return function(c){void 0=== a&&(a=new b.Vector3);return this.sub(a.copy(c).multiplyScalar(2*this.dot(c)))}}(),angleTo:function(a){a=this.dot(a)/Math.sqrt(this.lengthSq()*a.lengthSq());return Math.acos(b.Math.clamp(a,-1,1))},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var c=this.x-a.x,b=this.y-a.y;a=this.z-a.z;return c*c+b*b+a*a},setFromSpherical:function(a){var c=Math.sin(a.phi)*a.radius;this.x=c*Math.sin(a.theta);this.y=Math.cos(a.phi)*a.radius;this.z=c*Math.cos(a.theta); return this},setFromMatrixPosition:function(a){return this.setFromMatrixColumn(a,3)},setFromMatrixScale:function(a){var c=this.setFromMatrixColumn(a,0).length(),b=this.setFromMatrixColumn(a,1).length();a=this.setFromMatrixColumn(a,2).length();this.x=c;this.y=b;this.z=a;return this},setFromMatrixColumn:function(a,c){"number"===typeof a&&(console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index )."),c=a=c);return this.fromArray(a.elements,4*c)},equals:function(a){return a.x===this.x&& a.y===this.y&&a.z===this.z},fromArray:function(a,c){void 0===c&&(c=0);this.x=a[c];this.y=a[c+1];this.z=a[c+2];return this},toArray:function(a,c){void 0===a&&(a=[]);void 0===c&&(c=0);a[c]=this.x;a[c+1]=this.y;a[c+2]=this.z;return a},fromAttribute:function(a,c,b){void 0===b&&(b=0);c=c*a.itemSize+b;this.x=a.array[c];this.y=a.array[c+1];this.z=a.array[c+2];return this}};b.Vector4=function(a,c,b,e){this.x=a||0;this.y=c||0;this.z=b||0;this.w=void 0!==e?e:1};b.Vector4.prototype={constructor:b.Vector4,set:function(a, @@ -328,57 +328,57 @@ 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,c){if(void 0!==c)return console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,c);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,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.w;return this},addScaledVector:function(a,c){this.x+=a.x*c;this.y+=a.y*c;this.z+=a.z*c;this.w+=a.w*c;return this},sub:function(a,c){if(void 0!==c)return console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,c);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,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;this.w=a.w-c.w;return this},multiplyScalar:function(a){isFinite(a)?(this.x*=a,this.y*=a,this.z*=a,this.w*=a):this.w=this.z=this.y=this.x=0;return this},applyMatrix4:function(a){var c=this.x,b=this.y,e=this.z,f=this.w;a=a.elements;this.x=a[0]*c+a[4]*b+a[8]*e+a[12]*f;this.y=a[1]*c+a[5]*b+a[9]*e+a[13]*f;this.z=a[2]*c+a[6]*b+a[10]*e+a[14]*f;this.w=a[3]*c+a[7]*b+a[11]*e+a[15]*f;return this}, -divideScalar:function(a){return this.multiplyScalar(1/a)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var c=Math.sqrt(1-a.w*a.w);1E-4>c?(this.x=1,this.z=this.y=0):(this.x=a.x/c,this.y=a.y/c,this.z=a.z/c);return this},setAxisAngleFromRotationMatrix:function(a){var c,b,e;a=a.elements;var f=a[0];e=a[4];var g=a[8],h=a[1],q=a[5],x=a[9];b=a[2];c=a[6];var n=a[10];if(.01>Math.abs(e-h)&&.01>Math.abs(g-b)&&.01>Math.abs(x-c)){if(.1>Math.abs(e+h)&&.1>Math.abs(g+b)&&.1>Math.abs(x+c)&&.1>Math.abs(f+ -q+n-3))return this.set(1,0,0,0),this;a=Math.PI;f=(f+1)/2;q=(q+1)/2;n=(n+1)/2;e=(e+h)/4;g=(g+b)/4;x=(x+c)/4;f>q&&f>n?.01>f?(c=0,e=b=.707106781):(c=Math.sqrt(f),b=e/c,e=g/c):q>n?.01>q?(c=.707106781,b=0,e=.707106781):(b=Math.sqrt(q),c=e/b,e=x/b):.01>n?(b=c=.707106781,e=0):(e=Math.sqrt(n),c=g/e,b=x/e);this.set(c,b,e,a);return this}a=Math.sqrt((c-x)*(c-x)+(g-b)*(g-b)+(h-e)*(h-e));.001>Math.abs(a)&&(a=1);this.x=(c-x)/a;this.y=(g-b)/a;this.z=(h-e)/a;this.w=Math.acos((f+q+n-1)/2);return this},min:function(a){this.x= +divideScalar:function(a){return this.multiplyScalar(1/a)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var c=Math.sqrt(1-a.w*a.w);1E-4>c?(this.x=1,this.z=this.y=0):(this.x=a.x/c,this.y=a.y/c,this.z=a.z/c);return this},setAxisAngleFromRotationMatrix:function(a){var c,b,e;a=a.elements;var f=a[0];e=a[4];var g=a[8],h=a[1],p=a[5],u=a[9];b=a[2];c=a[6];var r=a[10];if(.01>Math.abs(e-h)&&.01>Math.abs(g-b)&&.01>Math.abs(u-c)){if(.1>Math.abs(e+h)&&.1>Math.abs(g+b)&&.1>Math.abs(u+c)&&.1>Math.abs(f+ +p+r-3))return this.set(1,0,0,0),this;a=Math.PI;f=(f+1)/2;p=(p+1)/2;r=(r+1)/2;e=(e+h)/4;g=(g+b)/4;u=(u+c)/4;f>p&&f>r?.01>f?(c=0,e=b=.707106781):(c=Math.sqrt(f),b=e/c,e=g/c):p>r?.01>p?(c=.707106781,b=0,e=.707106781):(b=Math.sqrt(p),c=e/b,e=u/b):.01>r?(b=c=.707106781,e=0):(e=Math.sqrt(r),c=g/e,b=u/e);this.set(c,b,e,a);return this}a=Math.sqrt((c-u)*(c-u)+(g-b)*(g-b)+(h-e)*(h-e));.001>Math.abs(a)&&(a=1);this.x=(c-u)/a;this.y=(g-b)/a;this.z=(h-e)/a;this.w=Math.acos((f+p+r-1)/2);return this},min:function(a){this.x= Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);this.z=Math.min(this.z,a.z);this.w=Math.min(this.w,a.w);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);this.z=Math.max(this.z,a.z);this.w=Math.max(this.w,a.w);return this},clamp:function(a,c){this.x=Math.max(a.x,Math.min(c.x,this.x));this.y=Math.max(a.y,Math.min(c.y,this.y));this.z=Math.max(a.z,Math.min(c.z,this.z));this.w=Math.max(a.w,Math.min(c.w,this.w));return this},clampScalar:function(){var a,c;return function(d, e){void 0===a&&(a=new b.Vector4,c=new b.Vector4);a.set(d,d,d,d);c.set(e,e,e,e);return this.clamp(a,c)}}(),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){return this.multiplyScalar(a/this.length())},lerp:function(a,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c;return this},lerpVectors:function(a,c,b){this.subVectors(c,a).multiplyScalar(b).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,c){void 0===c&&(c=0);this.x=a[c];this.y=a[c+1];this.z=a[c+2];this.w=a[c+3];return this},toArray:function(a,c){void 0===a&&(a=[]);void 0===c&&(c=0);a[c]=this.x;a[c+1]=this.y;a[c+2]=this.z;a[c+3]=this.w;return a},fromAttribute:function(a,c,b){void 0===b&&(b=0);c=c*a.itemSize+b;this.x=a.array[c];this.y=a.array[c+1];this.z=a.array[c+2];this.w=a.array[c+3];return this}};b.Euler=function(a,c,d,e){this._x=a||0;this._y=c||0;this._z=d|| 0;this._order=e||b.Euler.DefaultOrder};b.Euler.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" ");b.Euler.DefaultOrder="XYZ";b.Euler.prototype={constructor:b.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,c,b,e){this._x=a;this._y=c;this._z= -b;this._order=e||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,c,d){var e=b.Math.clamp,f=a.elements;a=f[0];var g=f[4],h=f[8],q=f[1],x=f[5],n=f[9],k=f[2],m=f[6],f=f[10];c=c||this._order;"XYZ"===c?(this._y=Math.asin(e(h,-1,1)),.99999>Math.abs(h)?(this._x=Math.atan2(-n,f), -this._z=Math.atan2(-g,a)):(this._x=Math.atan2(m,x),this._z=0)):"YXZ"===c?(this._x=Math.asin(-e(n,-1,1)),.99999>Math.abs(n)?(this._y=Math.atan2(h,f),this._z=Math.atan2(q,x)):(this._y=Math.atan2(-k,a),this._z=0)):"ZXY"===c?(this._x=Math.asin(e(m,-1,1)),.99999>Math.abs(m)?(this._y=Math.atan2(-k,f),this._z=Math.atan2(-g,x)):(this._y=0,this._z=Math.atan2(q,a))):"ZYX"===c?(this._y=Math.asin(-e(k,-1,1)),.99999>Math.abs(k)?(this._x=Math.atan2(m,f),this._z=Math.atan2(q,a)):(this._x=0,this._z=Math.atan2(-g, -x))):"YZX"===c?(this._z=Math.asin(e(q,-1,1)),.99999>Math.abs(q)?(this._x=Math.atan2(-n,x),this._y=Math.atan2(-k,a)):(this._x=0,this._y=Math.atan2(h,f))):"XZY"===c?(this._z=Math.asin(-e(g,-1,1)),.99999>Math.abs(g)?(this._x=Math.atan2(m,x),this._y=Math.atan2(h,a)):(this._x=Math.atan2(-n,f),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+c);this._order=c;if(!1!==d)this.onChangeCallback();return this},setFromQuaternion:function(){var a;return function(c,d,e){void 0=== +b;this._order=e||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,c,d){var e=b.Math.clamp,f=a.elements;a=f[0];var g=f[4],h=f[8],p=f[1],u=f[5],r=f[9],k=f[2],m=f[6],f=f[10];c=c||this._order;"XYZ"===c?(this._y=Math.asin(e(h,-1,1)),.99999>Math.abs(h)?(this._x=Math.atan2(-r,f), +this._z=Math.atan2(-g,a)):(this._x=Math.atan2(m,u),this._z=0)):"YXZ"===c?(this._x=Math.asin(-e(r,-1,1)),.99999>Math.abs(r)?(this._y=Math.atan2(h,f),this._z=Math.atan2(p,u)):(this._y=Math.atan2(-k,a),this._z=0)):"ZXY"===c?(this._x=Math.asin(e(m,-1,1)),.99999>Math.abs(m)?(this._y=Math.atan2(-k,f),this._z=Math.atan2(-g,u)):(this._y=0,this._z=Math.atan2(p,a))):"ZYX"===c?(this._y=Math.asin(-e(k,-1,1)),.99999>Math.abs(k)?(this._x=Math.atan2(m,f),this._z=Math.atan2(p,a)):(this._x=0,this._z=Math.atan2(-g, +u))):"YZX"===c?(this._z=Math.asin(e(p,-1,1)),.99999>Math.abs(p)?(this._x=Math.atan2(-r,u),this._y=Math.atan2(-k,a)):(this._x=0,this._y=Math.atan2(h,f))):"XZY"===c?(this._z=Math.asin(-e(g,-1,1)),.99999>Math.abs(g)?(this._x=Math.atan2(m,u),this._y=Math.atan2(h,a)):(this._x=Math.atan2(-r,f),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+c);this._order=c;if(!1!==d)this.onChangeCallback();return this},setFromQuaternion:function(){var a;return function(c,d,e){void 0=== a&&(a=new b.Matrix4);a.makeRotationFromQuaternion(c);this.setFromRotationMatrix(a,d,e);return this}}(),setFromVector3:function(a,c){return this.set(a.x,a.y,a.z,c||this._order)},reorder:function(){var a=new b.Quaternion;return function(c){a.setFromEuler(this);this.setFromQuaternion(a,c)}}(),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,c){void 0===a&&(a=[]);void 0===c&&(c=0);a[c]=this._x;a[c+1]=this._y;a[c+2]=this._z;a[c+3]=this._order;return a},toVector3:function(a){return a?a.set(this._x,this._y,this._z):new b.Vector3(this._x,this._y,this._z)},onChange:function(a){this.onChangeCallback=a;return this},onChangeCallback:function(){}};b.Matrix3=function(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]);0this.determinant()&&(h=-h);d.x=g[12]; -d.y=g[13];d.z=g[14];c.elements.set(this.elements);d=1/h;var g=1/q,n=1/k;c.elements[0]*=d;c.elements[1]*=d;c.elements[2]*=d;c.elements[4]*=g;c.elements[5]*=g;c.elements[6]*=g;c.elements[8]*=n;c.elements[9]*=n;c.elements[10]*=n;e.setFromRotationMatrix(c);f.x=h;f.y=q;f.z=k;return this}}(),makeFrustum:function(a,c,b,e,f,g){var h=this.elements;h[0]=2*f/(c-a);h[4]=0;h[8]=(c+a)/(c-a);h[12]=0;h[1]=0;h[5]=2*f/(e-b);h[9]=(e+b)/(e-b);h[13]=0;h[2]=0;h[6]=0;h[10]=-(g+f)/(g-f);h[14]=-2*g*f/(g-f);h[3]=0;h[7]=0; -h[11]=-1;h[15]=0;return this},makePerspective:function(a,c,d,e){a=d*Math.tan(b.Math.DEG2RAD*a*.5);var f=-a;return this.makeFrustum(f*c,a*c,f,a,d,e)},makeOrthographic:function(a,c,b,e,f,g){var h=this.elements,q=1/(c-a),k=1/(b-e),n=1/(g-f);h[0]=2*q;h[4]=0;h[8]=0;h[12]=-((c+a)*q);h[1]=0;h[5]=2*k;h[9]=0;h[13]=-((b+e)*k);h[2]=0;h[6]=0;h[10]=-2*n;h[14]=-((g+f)*n);h[3]=0;h[7]=0;h[11]=0;h[15]=1;return this},equals:function(a){var c=this.elements;a=a.elements;for(var b=0;16>b;b++)if(c[b]!==a[b])return!1;return!0}, +this.elements;c[12]=a.x;c[13]=a.y;c[14]=a.z;return this},getInverse:function(a,c){var b=this.elements,e=a.elements,f=e[0],g=e[1],h=e[2],p=e[3],k=e[4],m=e[5],q=e[6],y=e[7],l=e[8],s=e[9],n=e[10],t=e[11],x=e[12],z=e[13],v=e[14],e=e[15],B=s*v*y-z*n*y+z*q*t-m*v*t-s*q*e+m*n*e,A=x*n*y-l*v*y-x*q*t+k*v*t+l*q*e-k*n*e,L=l*z*y-x*s*y+x*m*t-k*z*t-l*m*e+k*s*e,F=x*s*q-l*z*q-x*m*n+k*z*n+l*m*v-k*s*v,G=f*B+g*A+h*L+p*F;if(0===G){if(c)throw Error("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0");console.warn("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0"); +return this.identity()}b[0]=B;b[1]=z*n*p-s*v*p-z*h*t+g*v*t+s*h*e-g*n*e;b[2]=m*v*p-z*q*p+z*h*y-g*v*y-m*h*e+g*q*e;b[3]=s*q*p-m*n*p-s*h*y+g*n*y+m*h*t-g*q*t;b[4]=A;b[5]=l*v*p-x*n*p+x*h*t-f*v*t-l*h*e+f*n*e;b[6]=x*q*p-k*v*p-x*h*y+f*v*y+k*h*e-f*q*e;b[7]=k*n*p-l*q*p+l*h*y-f*n*y-k*h*t+f*q*t;b[8]=L;b[9]=x*s*p-l*z*p-x*g*t+f*z*t+l*g*e-f*s*e;b[10]=k*z*p-x*m*p+x*g*y-f*z*y-k*g*e+f*m*e;b[11]=l*m*p-k*s*p-l*g*y+f*s*y+k*g*t-f*m*t;b[12]=F;b[13]=l*z*h-x*s*h+x*g*n-f*z*n-l*g*v+f*s*v;b[14]=x*m*h-k*z*h-x*g*q+f*z*q+k*g*v- +f*m*v;b[15]=k*s*h-l*m*h+l*g*q-f*s*q-k*g*n+f*m*n;return this.multiplyScalar(1/G)},scale:function(a){var c=this.elements,b=a.x,e=a.y;a=a.z;c[0]*=b;c[4]*=e;c[8]*=a;c[1]*=b;c[5]*=e;c[9]*=a;c[2]*=b;c[6]*=e;c[10]*=a;c[3]*=b;c[7]*=e;c[11]*=a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10]))},makeTranslation:function(a,c,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this}, +makeRotationX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},makeRotationY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},makeRotationZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,c){var b=Math.cos(c),e=Math.sin(c),f=1-b,g=a.x,h=a.y,p=a.z,k=f*g,m=f*h;this.set(k*g+b,k*h-e*p,k*p+e*h,0,k*h+e*p,m*h+b,m*p-e*g,0,k*p- +e*h,m*p+e*g,f*p*p+b,0,0,0,0,1);return this},makeScale:function(a,c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},compose:function(a,c,b){this.makeRotationFromQuaternion(c);this.scale(b);this.setPosition(a);return this},decompose:function(){var a,c;return function(d,e,f){void 0===a&&(a=new b.Vector3);void 0===c&&(c=new b.Matrix4);var g=this.elements,h=a.set(g[0],g[1],g[2]).length(),p=a.set(g[4],g[5],g[6]).length(),k=a.set(g[8],g[9],g[10]).length();0>this.determinant()&&(h=-h);d.x=g[12]; +d.y=g[13];d.z=g[14];c.elements.set(this.elements);d=1/h;var g=1/p,m=1/k;c.elements[0]*=d;c.elements[1]*=d;c.elements[2]*=d;c.elements[4]*=g;c.elements[5]*=g;c.elements[6]*=g;c.elements[8]*=m;c.elements[9]*=m;c.elements[10]*=m;e.setFromRotationMatrix(c);f.x=h;f.y=p;f.z=k;return this}}(),makeFrustum:function(a,c,b,e,f,g){var h=this.elements;h[0]=2*f/(c-a);h[4]=0;h[8]=(c+a)/(c-a);h[12]=0;h[1]=0;h[5]=2*f/(e-b);h[9]=(e+b)/(e-b);h[13]=0;h[2]=0;h[6]=0;h[10]=-(g+f)/(g-f);h[14]=-2*g*f/(g-f);h[3]=0;h[7]=0; +h[11]=-1;h[15]=0;return this},makePerspective:function(a,c,d,e){a=d*Math.tan(b.Math.DEG2RAD*a*.5);var f=-a;return this.makeFrustum(f*c,a*c,f,a,d,e)},makeOrthographic:function(a,c,b,e,f,g){var h=this.elements,p=1/(c-a),k=1/(b-e),m=1/(g-f);h[0]=2*p;h[4]=0;h[8]=0;h[12]=-((c+a)*p);h[1]=0;h[5]=2*k;h[9]=0;h[13]=-((b+e)*k);h[2]=0;h[6]=0;h[10]=-2*m;h[14]=-((g+f)*m);h[3]=0;h[7]=0;h[11]=0;h[15]=1;return this},equals:function(a){var c=this.elements;a=a.elements;for(var b=0;16>b;b++)if(c[b]!==a[b])return!1;return!0}, fromArray:function(a){this.elements.set(a);return this},toArray:function(a,c){void 0===a&&(a=[]);void 0===c&&(c=0);var b=this.elements;a[c]=b[0];a[c+1]=b[1];a[c+2]=b[2];a[c+3]=b[3];a[c+4]=b[4];a[c+5]=b[5];a[c+6]=b[6];a[c+7]=b[7];a[c+8]=b[8];a[c+9]=b[9];a[c+10]=b[10];a[c+11]=b[11];a[c+12]=b[12];a[c+13]=b[13];a[c+14]=b[14];a[c+15]=b[15];return a}};b.Ray=function(a,c){this.origin=void 0!==a?a:new b.Vector3;this.direction=void 0!==c?c:new b.Vector3};b.Ray.prototype={constructor:b.Ray,set:function(a,c){this.origin.copy(a); this.direction.copy(c);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,c){return(c||new b.Vector3).copy(this.direction).multiplyScalar(a).add(this.origin)},lookAt:function(a){this.direction.copy(a).sub(this.origin).normalize()},recast:function(){var a=new b.Vector3;return function(c){this.origin.copy(this.at(c,a));return this}}(),closestPointToPoint:function(a,c){var d=c|| new b.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 b.Vector3;return function(c){var b=a.subVectors(c,this.origin).dot(this.direction);if(0>b)return this.origin.distanceToSquared(c);a.copy(this.direction).multiplyScalar(b).add(this.origin);return a.distanceToSquared(c)}}(),distanceSqToSegment:function(){var a= -new b.Vector3,c=new b.Vector3,d=new b.Vector3;return function(b,f,g,h){a.copy(b).add(f).multiplyScalar(.5);c.copy(f).sub(b).normalize();d.copy(this.origin).sub(a);var q=.5*b.distanceTo(f),k=-this.direction.dot(c),n=d.dot(this.direction),m=-d.dot(c),t=d.lengthSq(),l=Math.abs(1-k*k),s;0=-s?f<=s?(q=1/l,b*=q,f*=q,k=b*(b+k*f+2*n)+f*(k*b+f+2*m)+t):(f=q,b=Math.max(0,-(k*f+n)),k=-b*b+f*(f+2*m)+t):(f=-q,b=Math.max(0,-(k*f+n)),k=-b*b+f*(f+2*m)+t):f<=-s?(b=Math.max(0,-(-k*q+ -n)),f=0=-s?f<=s?(p=1/l,b*=p,f*=p,k=b*(b+k*f+2*m)+f*(k*b+f+2*q)+y):(f=p,b=Math.max(0,-(k*f+m)),k=-b*b+f*(f+2*q)+y):(f=-p,b=Math.max(0,-(k*f+m)),k=-b*b+f*(f+2*q)+y):f<=-s?(b=Math.max(0,-(-k*p+ +m)),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,d):this.at(f,d)}}(),intersectsSphere:function(a){return this.distanceToPoint(a.center)<=a.radius},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 d=this.distanceToPlane(a);return null===d?null:this.at(d,b)},intersectsPlane:function(a){var b= -a.distanceToPoint(this.origin);return 0===b||0>a.normal.dot(this.direction)*b?!0:!1},intersectBox:function(a,b){var d,e,f,g,h;e=1/this.direction.x;g=1/this.direction.y;h=1/this.direction.z;var q=this.origin;0<=e?(d=(a.min.x-q.x)*e,e*=a.max.x-q.x):(d=(a.max.x-q.x)*e,e*=a.min.x-q.x);0<=g?(f=(a.min.y-q.y)*g,g*=a.max.y-q.y):(f=(a.max.y-q.y)*g,g*=a.min.y-q.y);if(d>g||f>e)return null;if(f>d||d!==d)d=f;if(gh||f> -e)return null;if(f>d||d!==d)d=f;if(he?null:this.at(0<=d?d:e,b)},intersectsBox:function(){var a=new b.Vector3;return function(b){return null!==this.intersectBox(b,a)}}(),intersectTriangle:function(){var a=new b.Vector3,c=new b.Vector3,d=new b.Vector3,e=new b.Vector3;return function(b,g,h,q,k){c.subVectors(g,b);d.subVectors(h,b);e.crossVectors(c,d);g=this.direction.dot(e);if(0g)q=-1,g=-g;else return null;a.subVectors(this.origin,b);b=q*this.direction.dot(d.crossVectors(a, -d));if(0>b)return null;h=q*this.direction.dot(c.cross(a));if(0>h||b+h>g)return null;b=-q*a.dot(e);return 0>b?null:this.at(b/g,k)}}(),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)}};b.Box2=function(a,c){this.min=void 0!==a?a:new b.Vector2(Infinity,Infinity);this.max=void 0!==c?c:new b.Vector2(-Infinity, +a.distanceToPoint(this.origin);return 0===b||0>a.normal.dot(this.direction)*b?!0:!1},intersectBox:function(a,b){var d,e,f,g,h;e=1/this.direction.x;g=1/this.direction.y;h=1/this.direction.z;var p=this.origin;0<=e?(d=(a.min.x-p.x)*e,e*=a.max.x-p.x):(d=(a.max.x-p.x)*e,e*=a.min.x-p.x);0<=g?(f=(a.min.y-p.y)*g,g*=a.max.y-p.y):(f=(a.max.y-p.y)*g,g*=a.min.y-p.y);if(d>g||f>e)return null;if(f>d||d!==d)d=f;if(gh||f> +e)return null;if(f>d||d!==d)d=f;if(he?null:this.at(0<=d?d:e,b)},intersectsBox:function(){var a=new b.Vector3;return function(b){return null!==this.intersectBox(b,a)}}(),intersectTriangle:function(){var a=new b.Vector3,c=new b.Vector3,d=new b.Vector3,e=new b.Vector3;return function(b,g,h,p,k){c.subVectors(g,b);d.subVectors(h,b);e.crossVectors(c,d);g=this.direction.dot(e);if(0g)p=-1,g=-g;else return null;a.subVectors(this.origin,b);b=p*this.direction.dot(d.crossVectors(a, +d));if(0>b)return null;h=p*this.direction.dot(c.cross(a));if(0>h||b+h>g)return null;b=-p*a.dot(e);return 0>b?null:this.at(b/g,k)}}(),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)}};b.Box2=function(a,c){this.min=void 0!==a?a:new b.Vector2(Infinity,Infinity);this.max=void 0!==c?c:new b.Vector2(-Infinity, -Infinity)};b.Box2.prototype={constructor:b.Box2,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setFromPoints:function(a){this.makeEmpty();for(var b=0,d=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,c){return(c||new b.Vector2).set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y? !1:!0},clampPoint:function(a,c){return(c||new b.Vector2).copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new b.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)}}; -b.Box3=function(a,c){this.min=void 0!==a?a:new b.Vector3(Infinity,Infinity,Infinity);this.max=void 0!==c?c:new b.Vector3(-Infinity,-Infinity,-Infinity)};b.Box3.prototype={constructor:b.Box3,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setFromArray:function(a){for(var b=Infinity,d=Infinity,e=Infinity,f=-Infinity,g=-Infinity,h=-Infinity,q=0,k=a.length;qf&&(f=n);m>g&&(g=m);t>h&&(h=t)}this.min.set(b,d,e);this.max.set(f, +b.Box3=function(a,c){this.min=void 0!==a?a:new b.Vector3(Infinity,Infinity,Infinity);this.max=void 0!==c?c:new b.Vector3(-Infinity,-Infinity,-Infinity)};b.Box3.prototype={constructor:b.Box3,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setFromArray:function(a){for(var b=Infinity,d=Infinity,e=Infinity,f=-Infinity,g=-Infinity,h=-Infinity,p=0,k=a.length;pf&&(f=m);q>g&&(g=q);y>h&&(h=y)}this.min.set(b,d,e);this.max.set(f, g,h)},setFromPoints:function(a){this.makeEmpty();for(var b=0,d=a.length;bg||1b&&0a&&0d;d++)b[d].copy(a.planes[d]);return this},setFromMatrix:function(a){var b=this.planes,d=a.elements;a=d[0];var e=d[1],f=d[2],g=d[3],h=d[4],q=d[5], -k=d[6],n=d[7],m=d[8],t=d[9],l=d[10],s=d[11],p=d[12],r=d[13],u=d[14],d=d[15];b[0].setComponents(g-a,n-h,s-m,d-p).normalize();b[1].setComponents(g+a,n+h,s+m,d+p).normalize();b[2].setComponents(g+e,n+q,s+t,d+r).normalize();b[3].setComponents(g-e,n-q,s-t,d-r).normalize();b[4].setComponents(g-f,n-k,s-l,d-u).normalize();b[5].setComponents(g+f,n+k,s+l,d+u).normalize();return this},intersectsObject:function(){var a=new b.Sphere;return function(b){var d=b.geometry;null===d.boundingSphere&&d.computeBoundingSphere(); +void 0!==e?e:new b.Plane,void 0!==f?f:new b.Plane,void 0!==g?g:new b.Plane]};b.Frustum.prototype={constructor:b.Frustum,set:function(a,b,d,e,f,g){var h=this.planes;h[0].copy(a);h[1].copy(b);h[2].copy(d);h[3].copy(e);h[4].copy(f);h[5].copy(g);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){for(var b=this.planes,d=0;6>d;d++)b[d].copy(a.planes[d]);return this},setFromMatrix:function(a){var b=this.planes,d=a.elements;a=d[0];var e=d[1],f=d[2],g=d[3],h=d[4],p=d[5], +k=d[6],m=d[7],q=d[8],y=d[9],l=d[10],s=d[11],n=d[12],t=d[13],x=d[14],d=d[15];b[0].setComponents(g-a,m-h,s-q,d-n).normalize();b[1].setComponents(g+a,m+h,s+q,d+n).normalize();b[2].setComponents(g+e,m+p,s+y,d+t).normalize();b[3].setComponents(g-e,m-p,s-y,d-t).normalize();b[4].setComponents(g-f,m-k,s-l,d-x).normalize();b[5].setComponents(g+f,m+k,s+l,d+x).normalize();return this},intersectsObject:function(){var a=new b.Sphere;return function(b){var d=b.geometry;null===d.boundingSphere&&d.computeBoundingSphere(); a.copy(d.boundingSphere);a.applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(),intersectsSphere:function(a){var b=this.planes,d=a.center;a=-a.radius;for(var e=0;6>e;e++)if(b[e].distanceToPoint(d)f;f++){var g=e[f];a.x=0h&&0>g)return!1}return!0}}(),containsPoint:function(a){for(var b=this.planes,d=0;6>d;d++)if(0>b[d].distanceToPoint(a))return!1;return!0}};b.Math={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),b=Array(36),d=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>=d&&(d=33554432+16777216*Math.random()|0),e=d&15,d>>=4,b[f]=a[19===f?e&3|8:e]);return b.join("")}}(),clamp:function(a,b,d){return Math.max(b,Math.min(d,a))},euclideanModulo:function(a,b){return(a%b+b)%b},mapLinear:function(a,b,d,e,f){return e+(a-b)*(f-e)/(d-b)},smoothstep:function(a,b,d){if(a<=b)return 0;if(a>=d)return 1;a=(a-b)/(d-b);return a*a*(3-2*a)},smootherstep:function(a,b,d){if(a<=b)return 0;if(a>=d)return 1;a=(a-b)/(d-b);return a*a*a*(a*(6*a-15)+10)},random16:function(){console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."); return Math.random()},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(a){return a*b.Math.DEG2RAD},radToDeg:function(a){return a*b.Math.RAD2DEG},isPowerOfTwo:function(a){return 0===(a&a-1)&&0!==a},nearestPowerOfTwo:function(a){return Math.pow(2,Math.round(Math.log(a)/Math.LN2))},nextPowerOfTwo:function(a){a--;a|=a>>1;a|=a>>2;a|=a>>4;a|=a>>8;a|=a>>16;a++; -return a}};b.Triangle=function(a,c,d){this.a=void 0!==a?a:new b.Vector3;this.b=void 0!==c?c:new b.Vector3;this.c=void 0!==d?d:new b.Vector3};b.Triangle.normal=function(){var a=new b.Vector3;return function(c,d,e,f){f=f||new b.Vector3;f.subVectors(e,d);a.subVectors(c,d);f.cross(a);c=f.lengthSq();return 0=c.x+c.y}}();b.Triangle.prototype={constructor:b.Triangle,set:function(a,b,d){this.a.copy(a);this.b.copy(b);this.c.copy(d);return this},setFromPointsAndIndices:function(a, +return a}};b.Triangle=function(a,c,d){this.a=void 0!==a?a:new b.Vector3;this.b=void 0!==c?c:new b.Vector3;this.c=void 0!==d?d:new b.Vector3};b.Triangle.normal=function(){var a=new b.Vector3;return function(c,d,e,f){f=f||new b.Vector3;f.subVectors(e,d);a.subVectors(c,d);f.cross(a);c=f.lengthSq();return 0=c.x+c.y}}();b.Triangle.prototype={constructor:b.Triangle,set:function(a,b,d){this.a.copy(a);this.b.copy(b);this.c.copy(d);return this},setFromPointsAndIndices:function(a, b,d,e){this.a.copy(a[b]);this.b.copy(a[d]);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 b.Vector3,c=new b.Vector3;return function(){a.subVectors(this.c,this.b);c.subVectors(this.a,this.b);return.5*a.cross(c).length()}}(),midpoint:function(a){return(a||new b.Vector3).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(a){return b.Triangle.normal(this.a, -this.b,this.c,a)},plane:function(a){return(a||new b.Plane).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(a,c){return b.Triangle.barycoordFromPoint(a,this.a,this.b,this.c,c)},containsPoint:function(a){return b.Triangle.containsPoint(a,this.a,this.b,this.c)},closestPointToPoint:function(){var a,c,d,e;return function(f,g){void 0===a&&(a=new b.Plane,c=[new b.Line3,new b.Line3,new b.Line3],d=new b.Vector3,e=new b.Vector3);var h=g||new b.Vector3,q=Infinity;a.setFromCoplanarPoints(this.a, -this.b,this.c);a.projectPoint(f,d);if(!0===this.containsPoint(d))h.copy(d);else{c[0].set(this.a,this.b);c[1].set(this.b,this.c);c[2].set(this.c,this.a);for(var k=0;ke;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),d=0, -h=this.faceVertexUvs.length;da.x||1a.x?0:1;break;case b.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 b.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)}}};b.EventDispatcher.prototype.apply(b.Texture.prototype);b.TextureIdCount=0;b.DepthTexture=function(a,c,d,e,f,g,h,k,m){b.Texture.call(this,null,e,f,g,h,k,b.DepthFormat,d,m);this.image={width:a, -height:c};this.type=void 0!==d?d:b.UnsignedShortType;this.magFilter=void 0!==h?h:b.NearestFilter;this.minFilter=void 0!==k?k:b.NearestFilter;this.generateMipmaps=this.flipY=!1};b.DepthTexture.prototype=Object.create(b.Texture.prototype);b.DepthTexture.prototype.constructor=b.DepthTexture;b.CompressedTexture=function(a,c,d,e,f,g,h,k,m,n,z,t){b.Texture.call(this,null,g,h,k,m,n,e,f,z,t);this.image={width:c,height:d};this.mipmaps=a;this.generateMipmaps=this.flipY=!1};b.CompressedTexture.prototype=Object.create(b.Texture.prototype); -b.CompressedTexture.prototype.constructor=b.CompressedTexture;b.DataTexture=function(a,c,d,e,f,g,h,k,m,n,z,t){b.Texture.call(this,null,g,h,k,m,n,e,f,z,t);this.image={data:a,width:c,height:d};this.magFilter=void 0!==m?m:b.NearestFilter;this.minFilter=void 0!==n?n:b.NearestFilter;this.generateMipmaps=this.flipY=!1};b.DataTexture.prototype=Object.create(b.Texture.prototype);b.DataTexture.prototype.constructor=b.DataTexture;b.Line=function(a,c,d){if(1===d)return console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."), +height:c};this.type=void 0!==d?d:b.UnsignedShortType;this.magFilter=void 0!==h?h:b.NearestFilter;this.minFilter=void 0!==k?k:b.NearestFilter;this.generateMipmaps=this.flipY=!1};b.DepthTexture.prototype=Object.create(b.Texture.prototype);b.DepthTexture.prototype.constructor=b.DepthTexture;b.CompressedTexture=function(a,c,d,e,f,g,h,k,m,r,q,y){b.Texture.call(this,null,g,h,k,m,r,e,f,q,y);this.image={width:c,height:d};this.mipmaps=a;this.generateMipmaps=this.flipY=!1};b.CompressedTexture.prototype=Object.create(b.Texture.prototype); +b.CompressedTexture.prototype.constructor=b.CompressedTexture;b.DataTexture=function(a,c,d,e,f,g,h,k,m,r,q,y){b.Texture.call(this,null,g,h,k,m,r,e,f,q,y);this.image={data:a,width:c,height:d};this.magFilter=void 0!==m?m:b.NearestFilter;this.minFilter=void 0!==r?r:b.NearestFilter;this.generateMipmaps=this.flipY=!1};b.DataTexture.prototype=Object.create(b.Texture.prototype);b.DataTexture.prototype.constructor=b.DataTexture;b.Line=function(a,c,d){if(1===d)return console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."), new b.LineSegments(a,c);b.Object3D.call(this);this.type="Line";this.geometry=void 0!==a?a:new b.Geometry;this.material=void 0!==c?c:new b.LineBasicMaterial({color:16777215*Math.random()})};b.Line.prototype=Object.create(b.Object3D.prototype);b.Line.prototype.constructor=b.Line;b.Line.prototype.raycast=function(){var a=new b.Matrix4,c=new b.Ray,d=new b.Sphere;return function(e,f){var g=e.linePrecision,g=g*g,h=this.geometry,k=this.matrixWorld;null===h.boundingSphere&&h.computeBoundingSphere();d.copy(h.boundingSphere); -d.applyMatrix4(k);if(!1!==e.ray.intersectsSphere(d)){a.getInverse(k);c.copy(e.ray).applyMatrix4(a);var m=new b.Vector3,n=new b.Vector3,k=new b.Vector3,z=new b.Vector3,t=this instanceof b.LineSegments?2:1;if(h instanceof b.BufferGeometry){var l=h.index,s=h.attributes.position.array;if(null!==l)for(var l=l.array,h=0,p=l.length-1;hg||(z.applyMatrix4(this.matrixWorld),r=e.ray.origin.distanceTo(z),re.far||f.push({distance:r,point:k.clone().applyMatrix4(this.matrixWorld),index:h,face:null,faceIndex:null,object:this}))}else for(h=0,p=s.length/3-1;hg||(z.applyMatrix4(this.matrixWorld),r=e.ray.origin.distanceTo(z),re.far||f.push({distance:r,point:k.clone().applyMatrix4(this.matrixWorld),index:h,face:null,faceIndex:null,object:this}))}else if(h instanceof b.Geometry)for(m=h.vertices,n=m.length,h=0;hg||(z.applyMatrix4(this.matrixWorld),r=e.ray.origin.distanceTo(z),re.far||f.push({distance:r,point:k.clone().applyMatrix4(this.matrixWorld),index:h,face:null,faceIndex:null,object:this}))}}}();b.Line.prototype.clone=function(){return(new this.constructor(this.geometry,this.material)).copy(this)};b.LineStrip=0;b.LinePieces=1;b.Points=function(a,c){b.Object3D.call(this);this.type="Points";this.geometry=void 0!==a?a:new b.Geometry;this.material= -void 0!==c?c:new b.PointsMaterial({color:16777215*Math.random()})};b.Points.prototype=Object.create(b.Object3D.prototype);b.Points.prototype.constructor=b.Points;b.Points.prototype.raycast=function(){var a=new b.Matrix4,c=new b.Ray,d=new b.Sphere;return function(e,f){function g(a,b){var d=c.distanceSqToPoint(a);if(de.far||f.push({distance:l,distanceToRay:Math.sqrt(d),point:g.clone(),index:b,face:null, -object:h})}}var h=this,k=this.geometry,m=this.matrixWorld,n=e.params.Points.threshold;null===k.boundingSphere&&k.computeBoundingSphere();d.copy(k.boundingSphere);d.applyMatrix4(m);if(!1!==e.ray.intersectsSphere(d)){a.getInverse(m);c.copy(e.ray).applyMatrix4(a);var n=n/((this.scale.x+this.scale.y+this.scale.z)/3),r=n*n,n=new b.Vector3;if(k instanceof b.BufferGeometry){var t=k.index,k=k.attributes.position.array;if(null!==t)for(var l=t.array,t=0,s=l.length;tg||(q.applyMatrix4(this.matrixWorld),t=e.ray.origin.distanceTo(q),te.far||f.push({distance:t,point:k.clone().applyMatrix4(this.matrixWorld),index:h,face:null,faceIndex:null,object:this}))}else for(h=0,n=s.length/3-1;hg||(q.applyMatrix4(this.matrixWorld),t=e.ray.origin.distanceTo(q),te.far||f.push({distance:t,point:k.clone().applyMatrix4(this.matrixWorld),index:h,face:null,faceIndex:null,object:this}))}else if(h instanceof b.Geometry)for(m=h.vertices,r=m.length,h=0;hg||(q.applyMatrix4(this.matrixWorld),t=e.ray.origin.distanceTo(q),te.far||f.push({distance:t,point:k.clone().applyMatrix4(this.matrixWorld),index:h,face:null,faceIndex:null,object:this}))}}}();b.Line.prototype.clone=function(){return(new this.constructor(this.geometry,this.material)).copy(this)};b.LineStrip=0;b.LinePieces=1;b.Points=function(a,c){b.Object3D.call(this);this.type="Points";this.geometry=void 0!==a?a:new b.Geometry;this.material= +void 0!==c?c:new b.PointsMaterial({color:16777215*Math.random()})};b.Points.prototype=Object.create(b.Object3D.prototype);b.Points.prototype.constructor=b.Points;b.Points.prototype.raycast=function(){var a=new b.Matrix4,c=new b.Ray,d=new b.Sphere;return function(e,f){function g(a,b){var d=c.distanceSqToPoint(a);if(de.far||f.push({distance:k,distanceToRay:Math.sqrt(d),point:g.clone(),index:b,face:null, +object:h})}}var h=this,k=this.geometry,m=this.matrixWorld,r=e.params.Points.threshold;null===k.boundingSphere&&k.computeBoundingSphere();d.copy(k.boundingSphere);d.applyMatrix4(m);if(!1!==e.ray.intersectsSphere(d)){a.getInverse(m);c.copy(e.ray).applyMatrix4(a);var r=r/((this.scale.x+this.scale.y+this.scale.z)/3),q=r*r,r=new b.Vector3;if(k instanceof b.BufferGeometry){var y=k.index,k=k.attributes.position.array;if(null!==y)for(var l=y.array,y=0,s=l.length;yc.far?null:{distance:d,point:y.clone(),object:a}}function d(d,e,f,g,n,t,r,z){h.fromArray(g,3*t);k.fromArray(g,3*r);m.fromArray(g,3*z);if(d= -c(d,e,f,h,k,m,R))n&&(l.fromArray(n,2*t),s.fromArray(n,2*r),p.fromArray(n,2*z),d.uv=a(R,h,k,m,l,s,p)),d.face=new b.Face3(t,r,z,b.Triangle.normal(h,k,m)),d.faceIndex=t;return d}var e=new b.Matrix4,f=new b.Ray,g=new b.Sphere,h=new b.Vector3,k=new b.Vector3,m=new b.Vector3,n=new b.Vector3,r=new b.Vector3,t=new b.Vector3,l=new b.Vector2,s=new b.Vector2,p=new b.Vector2,u=new b.Vector3,R=new b.Vector3,y=new b.Vector3;return function(v,u){var y=this.geometry,P=this.material,B=this.matrixWorld;if(void 0!== -P&&(null===y.boundingSphere&&y.computeBoundingSphere(),g.copy(y.boundingSphere),g.applyMatrix4(B),!1!==v.ray.intersectsSphere(g)&&(e.getInverse(B),f.copy(v.ray).applyMatrix4(e),null===y.boundingBox||!1!==f.intersectsBox(y.boundingBox)))){var H,E;if(y instanceof b.BufferGeometry){var Q,K,P=y.index,B=y.attributes,y=B.position.array;void 0!==B.uv&&(H=B.uv.array);if(null!==P)for(var B=P.array,O=0,J=B.length;Oc.far?null:{distance:d,point:z.clone(),object:a}}function d(d,e,f,g,r,q,y,t){h.fromArray(g,3*q);k.fromArray(g,3*y);m.fromArray(g,3*t);if(d= +c(d,e,f,h,k,m,x))r&&(l.fromArray(r,2*q),s.fromArray(r,2*y),n.fromArray(r,2*t),d.uv=a(x,h,k,m,l,s,n)),d.face=new b.Face3(q,y,t,b.Triangle.normal(h,k,m)),d.faceIndex=q;return d}var e=new b.Matrix4,f=new b.Ray,g=new b.Sphere,h=new b.Vector3,k=new b.Vector3,m=new b.Vector3,r=new b.Vector3,q=new b.Vector3,y=new b.Vector3,l=new b.Vector2,s=new b.Vector2,n=new b.Vector2,t=new b.Vector3,x=new b.Vector3,z=new b.Vector3;return function(v,t){var z=this.geometry,N=this.material,F=this.matrixWorld;if(void 0!== +N&&(null===z.boundingSphere&&z.computeBoundingSphere(),g.copy(z.boundingSphere),g.applyMatrix4(F),!1!==v.ray.intersectsSphere(g)&&(e.getInverse(F),f.copy(v.ray).applyMatrix4(e),null===z.boundingBox||!1!==f.intersectsBox(z.boundingBox)))){var G,E;if(z instanceof b.BufferGeometry){var M,K,N=z.index,F=z.attributes,z=F.position.array;void 0!==F.uv&&(G=F.uv.array);if(null!==N)for(var F=N.array,P=0,J=F.length;Pd;d++)w.deleteFramebuffer(c.__webglFramebuffer[d]),c.__webglDepthbuffer&&w.deleteRenderbuffer(c.__webglDepthbuffer[d]);else w.deleteFramebuffer(c.__webglFramebuffer),c.__webglDepthbuffer&&w.deleteRenderbuffer(c.__webglDepthbuffer);ga.delete(a.texture);ga.delete(a)}Ha.textures--}function k(a){a=a.target;a.removeEventListener("dispose",k);m(a);ga.delete(a)}function m(a){var b=ga.get(a).program;a.program=void 0; -void 0!==b&&Fa.releaseProgram(b)}function n(a,b){return Math.abs(b[0])-Math.abs(a[0])}function r(a,b){return a.object.renderOrder!==b.object.renderOrder?a.object.renderOrder-b.object.renderOrder:a.material.id!==b.material.id?a.material.id-b.material.id:a.z!==b.z?a.z-b.z:a.id-b.id}function t(a,b){return a.object.renderOrder!==b.object.renderOrder?a.object.renderOrder-b.object.renderOrder:a.z!==b.z?b.z-a.z:a.id-b.id}function l(a,b,c,d,e){var f;c.transparent?(d=ca,f=++ta):(d=ra,f=++Na);f=d[f];void 0!== -f?(f.id=a.id,f.object=a,f.geometry=b,f.material=c,f.z=qa.z,f.group=e):(f={id:a.id,object:a,geometry:b,material:c,z:qa.z,group:e},d.push(f))}function s(a){var b=a.geometry;null===b.boundingSphere&&b.computeBoundingSphere();var c=ab.copy(b.boundingSphere).applyMatrix4(a.matrixWorld);if(!Z.intersectsSphere(c))return!1;if(0===Aa)return!0;a=ia.clippingPlanes;var b=c.center,c=-c.radius,d=0;do if(a[d].distanceToPoint(b)d;d++)w.deleteFramebuffer(c.__webglFramebuffer[d]),c.__webglDepthbuffer&&w.deleteRenderbuffer(c.__webglDepthbuffer[d]);else w.deleteFramebuffer(c.__webglFramebuffer),c.__webglDepthbuffer&&w.deleteRenderbuffer(c.__webglDepthbuffer);ha.delete(a.texture);ha.delete(a)}Ha.textures--}function k(a){a=a.target;a.removeEventListener("dispose",k);m(a);ha.delete(a)}function m(a){var b=ha.get(a).program;a.program=void 0; +void 0!==b&&Fa.releaseProgram(b)}function r(a,b){return Math.abs(b[0])-Math.abs(a[0])}function q(a,b){return a.object.renderOrder!==b.object.renderOrder?a.object.renderOrder-b.object.renderOrder:a.material.id!==b.material.id?a.material.id-b.material.id:a.z!==b.z?a.z-b.z:a.id-b.id}function y(a,b){return a.object.renderOrder!==b.object.renderOrder?a.object.renderOrder-b.object.renderOrder:a.z!==b.z?b.z-a.z:a.id-b.id}function l(a,b,c,d,e){var f;c.transparent?(d=ca,f=++ua):(d=sa,f=++Na);f=d[f];void 0!== +f?(f.id=a.id,f.object=a,f.geometry=b,f.material=c,f.z=ra.z,f.group=e):(f={id:a.id,object:a,geometry:b,material:c,z:ra.z,group:e},d.push(f))}function s(a){var b=a.geometry;null===b.boundingSphere&&b.computeBoundingSphere();var c=ab.copy(b.boundingSphere).applyMatrix4(a.matrixWorld);if(!$.intersectsSphere(c))return!1;if(0===Aa)return!0;a=ja.clippingPlanes;var b=c.center,c=-c.radius,d=0;do if(a[d].distanceToPoint(b)b||a.height>b){var c=b/Math.max(a.width,a.height),d=document.createElement("canvas"); -d.width=Math.floor(a.width*c);d.height=Math.floor(a.height*c);d.getContext("2d").drawImage(a,0,0,a.width,a.height,0,0,d.width,d.height);console.warn("THREE.WebGLRenderer: image is too big ("+a.width+"x"+a.height+"). Resized to "+d.width+"x"+d.height,a);return d}return a}function E(a){return b.Math.isPowerOfTwo(a.width)&&b.Math.isPowerOfTwo(a.height)}function Q(a,b,c,d){var e=J(b.texture.format),f=J(b.texture.type);V.texImage2D(d,0,e,b.width,b.height,0,e,f,null);w.bindFramebuffer(w.FRAMEBUFFER,a); -w.framebufferTexture2D(w.FRAMEBUFFER,c,d,ga.get(b.texture).__webglTexture,0);w.bindFramebuffer(w.FRAMEBUFFER,null)}function K(a,b){w.bindRenderbuffer(w.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(w.renderbufferStorage(w.RENDERBUFFER,w.DEPTH_COMPONENT16,b.width,b.height),w.framebufferRenderbuffer(w.FRAMEBUFFER,w.DEPTH_ATTACHMENT,w.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(w.renderbufferStorage(w.RENDERBUFFER,w.DEPTH_STENCIL,b.width,b.height),w.framebufferRenderbuffer(w.FRAMEBUFFER,w.DEPTH_STENCIL_ATTACHMENT, -w.RENDERBUFFER,a)):w.renderbufferStorage(w.RENDERBUFFER,w.RGBA4,b.width,b.height);w.bindRenderbuffer(w.RENDERBUFFER,null)}function O(a){return a===b.NearestFilter||a===b.NearestMipMapNearestFilter||a===b.NearestMipMapLinearFilter?w.NEAREST:w.LINEAR}function J(a){var c;if(a===b.RepeatWrapping)return w.REPEAT;if(a===b.ClampToEdgeWrapping)return w.CLAMP_TO_EDGE;if(a===b.MirroredRepeatWrapping)return w.MIRRORED_REPEAT;if(a===b.NearestFilter)return w.NEAREST;if(a===b.NearestMipMapNearestFilter)return w.NEAREST_MIPMAP_NEAREST; +n.displacementScale.value=d.displacementScale,n.displacementBias.value=d.displacementBias)):d instanceof b.MeshPhysicalMaterial?v(n,d):d instanceof b.MeshStandardMaterial?v(n,d):d instanceof b.MeshDepthMaterial?d.displacementMap&&(n.displacementMap.value=d.displacementMap,n.displacementScale.value=d.displacementScale,n.displacementBias.value=d.displacementBias):d instanceof b.MeshNormalMaterial&&(n.opacity.value=d.opacity);b.WebGLUniforms.upload(w,f.uniformsList,n,ja)}r.set(w,e,"modelViewMatrix"); +r.set(w,e,"normalMatrix");r.setValue(w,"modelMatrix",e.matrixWorld);f=f.dynamicUniforms;null!==f&&(b.WebGLUniforms.evalDynamic(f,n,e,a),b.WebGLUniforms.upload(w,f,n,ja));return l}function v(a,b){a.roughness.value=b.roughness;a.metalness.value=b.metalness;b.roughnessMap&&(a.roughnessMap.value=b.roughnessMap);b.metalnessMap&&(a.metalnessMap.value=b.metalnessMap);b.lightMap&&(a.lightMap.value=b.lightMap,a.lightMapIntensity.value=b.lightMapIntensity);b.emissiveMap&&(a.emissiveMap.value=b.emissiveMap); +b.bumpMap&&(a.bumpMap.value=b.bumpMap,a.bumpScale.value=b.bumpScale);b.normalMap&&(a.normalMap.value=b.normalMap,a.normalScale.value.copy(b.normalScale));b.displacementMap&&(a.displacementMap.value=b.displacementMap,a.displacementScale.value=b.displacementScale,a.displacementBias.value=b.displacementBias);b.envMap&&(a.envMapIntensity.value=b.envMapIntensity)}function B(a,b,c,d){var e=null!==a?a.length:0,f=null;if(0!==e){f=oa.value;if(!0!==d||null===f){var h=c+4*e;b=b.matrixWorldInverse;d=eb.getNormalMatrix(b); +if(null===f||f.lengthb||a.height>b){var c=b/Math.max(a.width,a.height),d=document.createElement("canvas"); +d.width=Math.floor(a.width*c);d.height=Math.floor(a.height*c);d.getContext("2d").drawImage(a,0,0,a.width,a.height,0,0,d.width,d.height);console.warn("THREE.WebGLRenderer: image is too big ("+a.width+"x"+a.height+"). Resized to "+d.width+"x"+d.height,a);return d}return a}function E(a){return b.Math.isPowerOfTwo(a.width)&&b.Math.isPowerOfTwo(a.height)}function M(a,b,c,d){var e=J(b.texture.format),f=J(b.texture.type);T.texImage2D(d,0,e,b.width,b.height,0,e,f,null);w.bindFramebuffer(w.FRAMEBUFFER,a); +w.framebufferTexture2D(w.FRAMEBUFFER,c,d,ha.get(b.texture).__webglTexture,0);w.bindFramebuffer(w.FRAMEBUFFER,null)}function K(a,b){w.bindRenderbuffer(w.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(w.renderbufferStorage(w.RENDERBUFFER,w.DEPTH_COMPONENT16,b.width,b.height),w.framebufferRenderbuffer(w.FRAMEBUFFER,w.DEPTH_ATTACHMENT,w.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(w.renderbufferStorage(w.RENDERBUFFER,w.DEPTH_STENCIL,b.width,b.height),w.framebufferRenderbuffer(w.FRAMEBUFFER,w.DEPTH_STENCIL_ATTACHMENT, +w.RENDERBUFFER,a)):w.renderbufferStorage(w.RENDERBUFFER,w.RGBA4,b.width,b.height);w.bindRenderbuffer(w.RENDERBUFFER,null)}function P(a){return a===b.NearestFilter||a===b.NearestMipMapNearestFilter||a===b.NearestMipMapLinearFilter?w.NEAREST:w.LINEAR}function J(a){var c;if(a===b.RepeatWrapping)return w.REPEAT;if(a===b.ClampToEdgeWrapping)return w.CLAMP_TO_EDGE;if(a===b.MirroredRepeatWrapping)return w.MIRRORED_REPEAT;if(a===b.NearestFilter)return w.NEAREST;if(a===b.NearestMipMapNearestFilter)return w.NEAREST_MIPMAP_NEAREST; if(a===b.NearestMipMapLinearFilter)return w.NEAREST_MIPMAP_LINEAR;if(a===b.LinearFilter)return w.LINEAR;if(a===b.LinearMipMapNearestFilter)return w.LINEAR_MIPMAP_NEAREST;if(a===b.LinearMipMapLinearFilter)return w.LINEAR_MIPMAP_LINEAR;if(a===b.UnsignedByteType)return w.UNSIGNED_BYTE;if(a===b.UnsignedShort4444Type)return w.UNSIGNED_SHORT_4_4_4_4;if(a===b.UnsignedShort5551Type)return w.UNSIGNED_SHORT_5_5_5_1;if(a===b.UnsignedShort565Type)return w.UNSIGNED_SHORT_5_6_5;if(a===b.ByteType)return w.BYTE; -if(a===b.ShortType)return w.SHORT;if(a===b.UnsignedShortType)return w.UNSIGNED_SHORT;if(a===b.IntType)return w.INT;if(a===b.UnsignedIntType)return w.UNSIGNED_INT;if(a===b.FloatType)return w.FLOAT;c=ja.get("OES_texture_half_float");if(null!==c&&a===b.HalfFloatType)return c.HALF_FLOAT_OES;if(a===b.AlphaFormat)return w.ALPHA;if(a===b.RGBFormat)return w.RGB;if(a===b.RGBAFormat)return w.RGBA;if(a===b.LuminanceFormat)return w.LUMINANCE;if(a===b.LuminanceAlphaFormat)return w.LUMINANCE_ALPHA;if(a===b.DepthFormat)return w.DEPTH_COMPONENT; +if(a===b.ShortType)return w.SHORT;if(a===b.UnsignedShortType)return w.UNSIGNED_SHORT;if(a===b.IntType)return w.INT;if(a===b.UnsignedIntType)return w.UNSIGNED_INT;if(a===b.FloatType)return w.FLOAT;c=ka.get("OES_texture_half_float");if(null!==c&&a===b.HalfFloatType)return c.HALF_FLOAT_OES;if(a===b.AlphaFormat)return w.ALPHA;if(a===b.RGBFormat)return w.RGB;if(a===b.RGBAFormat)return w.RGBA;if(a===b.LuminanceFormat)return w.LUMINANCE;if(a===b.LuminanceAlphaFormat)return w.LUMINANCE_ALPHA;if(a===b.DepthFormat)return w.DEPTH_COMPONENT; if(a===b.AddEquation)return w.FUNC_ADD;if(a===b.SubtractEquation)return w.FUNC_SUBTRACT;if(a===b.ReverseSubtractEquation)return w.FUNC_REVERSE_SUBTRACT;if(a===b.ZeroFactor)return w.ZERO;if(a===b.OneFactor)return w.ONE;if(a===b.SrcColorFactor)return w.SRC_COLOR;if(a===b.OneMinusSrcColorFactor)return w.ONE_MINUS_SRC_COLOR;if(a===b.SrcAlphaFactor)return w.SRC_ALPHA;if(a===b.OneMinusSrcAlphaFactor)return w.ONE_MINUS_SRC_ALPHA;if(a===b.DstAlphaFactor)return w.DST_ALPHA;if(a===b.OneMinusDstAlphaFactor)return w.ONE_MINUS_DST_ALPHA; -if(a===b.DstColorFactor)return w.DST_COLOR;if(a===b.OneMinusDstColorFactor)return w.ONE_MINUS_DST_COLOR;if(a===b.SrcAlphaSaturateFactor)return w.SRC_ALPHA_SATURATE;c=ja.get("WEBGL_compressed_texture_s3tc");if(null!==c){if(a===b.RGB_S3TC_DXT1_Format)return c.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===b.RGBA_S3TC_DXT1_Format)return c.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===b.RGBA_S3TC_DXT3_Format)return c.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===b.RGBA_S3TC_DXT5_Format)return c.COMPRESSED_RGBA_S3TC_DXT5_EXT}c=ja.get("WEBGL_compressed_texture_pvrtc"); -if(null!==c){if(a===b.RGB_PVRTC_4BPPV1_Format)return c.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(a===b.RGB_PVRTC_2BPPV1_Format)return c.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(a===b.RGBA_PVRTC_4BPPV1_Format)return c.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(a===b.RGBA_PVRTC_2BPPV1_Format)return c.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}c=ja.get("WEBGL_compressed_texture_etc1");if(null!==c&&a===b.RGB_ETC1_Format)return c.COMPRESSED_RGB_ETC1_WEBGL;c=ja.get("EXT_blend_minmax");if(null!==c){if(a===b.MinEquation)return c.MIN_EXT; -if(a===b.MaxEquation)return c.MAX_EXT}return 0}console.log("THREE.WebGLRenderer",b.REVISION);a=a||{};var C=void 0!==a.canvas?a.canvas:document.createElement("canvas"),N=void 0!==a.context?a.context:null,L=void 0!==a.alpha?a.alpha:!1,U=void 0!==a.depth?a.depth:!0,G=void 0!==a.stencil?a.stencil:!0,I=void 0!==a.antialias?a.antialias:!1,M=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,Y=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,W=[],ra=[],Na=-1,ca=[],ta=-1,la=new Float32Array(8), -sa=[],oa=[];this.domElement=C;this.context=null;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.clippingPlanes=[];this.localClippingEnabled=!1;this.gammaFactor=2;this.physicallyCorrectLights=this.gammaOutput=this.gammaInput=!1;this.toneMapping=b.LinearToneMapping;this.toneMappingWhitePoint=this.toneMappingExposure=1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;var ia=this,pa=null,Ca=null,Da=null,T=-1,wa="",xa=null,Ka= -new b.Vector4,ya=null,X=new b.Vector4,ba=0,ha=new b.Color(0),$=0,da=C.width,ea=C.height,fa=1,ka=new b.Vector4(0,0,da,ea),aa=!1,ma=new b.Vector4(0,0,da,ea),Z=new b.Frustum,Qa=!1,La=!1,Ea=!1,Aa=0,na={type:"4fv",value:null,needsUpdate:!1},Ba=null,ua=0,eb=new b.Matrix3,ab=new b.Sphere,fb=new b.Plane,Ra=new b.Matrix4,qa=new b.Vector3,S={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],point:[],pointShadowMap:[],pointShadowMatrix:[], -hemi:[],shadows:[]},Ha={geometries:0,textures:0},Oa={calls:0,vertices:0,faces:0,points:0};this.info={render:Oa,memory:Ha,programs:null};var w;try{L={alpha:L,depth:U,stencil:G,antialias:I,premultipliedAlpha:M,preserveDrawingBuffer:Y};w=N||C.getContext("webgl",L)||C.getContext("experimental-webgl",L);if(null===w){if(null!==C.getContext("webgl"))throw"Error creating WebGL context with your selected attributes.";throw"Error creating WebGL context.";}void 0===w.getShaderPrecisionFormat&&(w.getShaderPrecisionFormat= -function(){return{rangeMin:1,rangeMax:1,precision:1}});C.addEventListener("webglcontextlost",f,!1)}catch(gb){console.error("THREE.WebGLRenderer: "+gb)}var Pa="undefined"!==typeof WebGL2RenderingContext&&w instanceof WebGL2RenderingContext,ja=new b.WebGLExtensions(w);ja.get("WEBGL_depth_texture");ja.get("OES_texture_float");ja.get("OES_texture_float_linear");ja.get("OES_texture_half_float");ja.get("OES_texture_half_float_linear");ja.get("OES_standard_derivatives");ja.get("ANGLE_instanced_arrays"); -ja.get("OES_element_index_uint")&&(b.BufferGeometry.MaxIndex=4294967296);var va=new b.WebGLCapabilities(w,ja,a),V=new b.WebGLState(w,ja,J),ga=new b.WebGLProperties,Ia=new b.WebGLObjects(w,ga,this.info),Fa=new b.WebGLPrograms(this,va),Ua=new b.WebGLLights;this.info.programs=Fa.programs;var Va=new b.WebGLBufferRenderer(w,ja,Oa),bb=new b.WebGLIndexedBufferRenderer(w,ja,Oa);d();this.context=w;this.capabilities=va;this.extensions=ja;this.properties=ga;this.state=V;var cb=new b.WebGLShadowMap(this,S,Ia); -this.shadowMap=cb;var Wa=new b.SpritePlugin(this,sa),Xa=new b.LensFlarePlugin(this,oa);this.getContext=function(){return w};this.getContextAttributes=function(){return w.getContextAttributes()};this.forceContextLoss=function(){ja.get("WEBGL_lose_context").loseContext()};this.getMaxAnisotropy=function(){var a;return function(){if(void 0!==a)return a;var b=ja.get("EXT_texture_filter_anisotropic");return a=null!==b?w.getParameter(b.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}}();this.getPrecision=function(){return va.precision}; -this.getPixelRatio=function(){return fa};this.setPixelRatio=function(a){void 0!==a&&(fa=a,this.setSize(ma.z,ma.w,!1))};this.getSize=function(){return{width:da,height:ea}};this.setSize=function(a,b,c){da=a;ea=b;C.width=a*fa;C.height=b*fa;!1!==c&&(C.style.width=a+"px",C.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){V.viewport(ma.set(a,b,c,d))};this.setScissor=function(a,b,c,d){V.scissor(ka.set(a,b,c,d))};this.setScissorTest=function(a){V.setScissorTest(aa=a)};this.getClearColor= -function(){return ha};this.setClearColor=function(a,b){ha.set(a);$=void 0!==b?b:1;c(ha.r,ha.g,ha.b,$)};this.getClearAlpha=function(){return $};this.setClearAlpha=function(a){$=a;c(ha.r,ha.g,ha.b,$)};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=w.COLOR_BUFFER_BIT;if(void 0===b||b)d|=w.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=w.STENCIL_BUFFER_BIT;w.clear(d)};this.clearColor=function(){this.clear(!0,!1,!1)};this.clearDepth=function(){this.clear(!1,!0,!1)};this.clearStencil=function(){this.clear(!1, -!1,!0)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.resetGLState=e;this.dispose=function(){C.removeEventListener("webglcontextlost",f,!1)};this.renderBufferImmediate=function(a,c,d){V.initAttributes();var e=ga.get(a);a.hasPositions&&!e.position&&(e.position=w.createBuffer());a.hasNormals&&!e.normal&&(e.normal=w.createBuffer());a.hasUvs&&!e.uv&&(e.uv=w.createBuffer());a.hasColors&&!e.color&&(e.color=w.createBuffer());c=c.getAttributes();a.hasPositions&&(w.bindBuffer(w.ARRAY_BUFFER, -e.position),w.bufferData(w.ARRAY_BUFFER,a.positionArray,w.DYNAMIC_DRAW),V.enableAttribute(c.position),w.vertexAttribPointer(c.position,3,w.FLOAT,!1,0,0));if(a.hasNormals){w.bindBuffer(w.ARRAY_BUFFER,e.normal);if("MeshPhongMaterial"!==d.type&&"MeshStandardMaterial"!==d.type&&"MeshPhysicalMaterial"!==d.type&&d.shading===b.FlatShading)for(var f=0,h=3*a.count;f=va.maxTextures&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+va.maxTextures);ba+=1;return a};this.setTexture2D=B;this.setTextureCube=function(a,c){if(a instanceof b.CubeTexture||Array.isArray(a.image)&&6===a.image.length){var d=ga.get(a); -if(6===a.image.length)if(0l;l++)h[l]=!ia.autoScaleCubemaps||e||f?f?a.image[l].image:a.image[l]:H(a.image[l],va.maxCubemapSize); -var k=E(h[0]),m=J(a.format),n=J(a.type);F(w.TEXTURE_CUBE_MAP,a,k);for(l=0;6>l;l++)if(e)for(var q,p=h[l].mipmaps,x=0,s=p.length;xg;g++)c.__webglFramebuffer[g]=w.createFramebuffer()}else c.__webglFramebuffer=w.createFramebuffer();if(e){V.bindTexture(w.TEXTURE_CUBE_MAP, -d.__webglTexture);F(w.TEXTURE_CUBE_MAP,a.texture,f);for(g=0;6>g;g++)Q(c.__webglFramebuffer[g],a,w.COLOR_ATTACHMENT0,w.TEXTURE_CUBE_MAP_POSITIVE_X+g);a.texture.generateMipmaps&&f&&w.generateMipmap(w.TEXTURE_CUBE_MAP);V.bindTexture(w.TEXTURE_CUBE_MAP,null)}else V.bindTexture(w.TEXTURE_2D,d.__webglTexture),F(w.TEXTURE_2D,a.texture,f),Q(c.__webglFramebuffer,a,w.COLOR_ATTACHMENT0,w.TEXTURE_2D),a.texture.generateMipmaps&&f&&w.generateMipmap(w.TEXTURE_2D),V.bindTexture(w.TEXTURE_2D,null);if(a.depthBuffer){c= -ga.get(a);d=a instanceof b.WebGLRenderTargetCube;if(a.depthTexture){if(d)throw Error("target.depthTexture not supported in Cube render targets");if(a instanceof b.WebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported!");w.bindFramebuffer(w.FRAMEBUFFER,c.__webglFramebuffer);if(!(a.depthTexture instanceof b.DepthTexture))throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");ga.get(a.depthTexture).__webglTexture&&a.depthTexture.image.width=== -a.width&&a.depthTexture.image.height===a.height||(a.depthTexture.image.width=a.width,a.depthTexture.image.height=a.height,a.depthTexture.needsUpdate=!0);ia.setTexture(a.depthTexture,0);c=ga.get(a.depthTexture).__webglTexture;w.framebufferTexture2D(w.FRAMEBUFFER,w.DEPTH_ATTACHMENT,w.TEXTURE_2D,c,0)}else if(d)for(c.__webglDepthbuffer=[],d=0;6>d;d++)w.bindFramebuffer(w.FRAMEBUFFER,c.__webglFramebuffer[d]),c.__webglDepthbuffer[d]=w.createRenderbuffer(),K(c.__webglDepthbuffer[d],a);else w.bindFramebuffer(w.FRAMEBUFFER, -c.__webglFramebuffer),c.__webglDepthbuffer=w.createRenderbuffer(),K(c.__webglDepthbuffer,a);w.bindFramebuffer(w.FRAMEBUFFER,null)}}c=a instanceof b.WebGLRenderTargetCube;a?(d=ga.get(a),d=c?d.__webglFramebuffer[a.activeCubeFace]:d.__webglFramebuffer,Ka.copy(a.scissor),ya=a.scissorTest,X.copy(a.viewport)):(d=null,Ka.copy(ka).multiplyScalar(fa),ya=aa,X.copy(ma).multiplyScalar(fa));Da!==d&&(w.bindFramebuffer(w.FRAMEBUFFER,d),Da=d);V.scissor(Ka);V.setScissorTest(ya);V.viewport(X);c&&(c=ga.get(a.texture), -w.framebufferTexture2D(w.FRAMEBUFFER,w.COLOR_ATTACHMENT0,w.TEXTURE_CUBE_MAP_POSITIVE_X+a.activeCubeFace,c.__webglTexture,a.activeMipMapLevel))};this.readRenderTargetPixels=function(a,c,d,e,f,h){if(!1===a instanceof b.WebGLRenderTarget)console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");else{var g=ga.get(a).__webglFramebuffer;if(g){var l=!1;g!==Da&&(w.bindFramebuffer(w.FRAMEBUFFER,g),l=!0);try{var k=a.texture;k.format!==b.RGBAFormat&&J(k.format)!== -w.getParameter(w.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):k.type===b.UnsignedByteType||J(k.type)===w.getParameter(w.IMPLEMENTATION_COLOR_READ_TYPE)||k.type===b.FloatType&&ja.get("WEBGL_color_buffer_float")||k.type===b.HalfFloatType&&ja.get("EXT_color_buffer_half_float")?w.checkFramebufferStatus(w.FRAMEBUFFER)===w.FRAMEBUFFER_COMPLETE?0=wa.maxTextures&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+wa.maxTextures);Z+=1;return a};this.setTexture2D=F;this.setTextureCube=function(a,c){if(a instanceof b.CubeTexture||Array.isArray(a.image)&&6===a.image.length){var d=ha.get(a); +if(6===a.image.length)if(0l;l++)h[l]=!ja.autoScaleCubemaps||e||f?f?a.image[l].image:a.image[l]:G(a.image[l],wa.maxCubemapSize); +var k=E(h[0]),m=J(a.format),p=J(a.type);L(w.TEXTURE_CUBE_MAP,a,k);for(l=0;6>l;l++)if(e)for(var n,r=h[l].mipmaps,s=0,u=r.length;sg;g++)c.__webglFramebuffer[g]=w.createFramebuffer()}else c.__webglFramebuffer=w.createFramebuffer();if(e){T.bindTexture(w.TEXTURE_CUBE_MAP, +d.__webglTexture);L(w.TEXTURE_CUBE_MAP,a.texture,f);for(g=0;6>g;g++)M(c.__webglFramebuffer[g],a,w.COLOR_ATTACHMENT0,w.TEXTURE_CUBE_MAP_POSITIVE_X+g);a.texture.generateMipmaps&&f&&w.generateMipmap(w.TEXTURE_CUBE_MAP);T.bindTexture(w.TEXTURE_CUBE_MAP,null)}else T.bindTexture(w.TEXTURE_2D,d.__webglTexture),L(w.TEXTURE_2D,a.texture,f),M(c.__webglFramebuffer,a,w.COLOR_ATTACHMENT0,w.TEXTURE_2D),a.texture.generateMipmaps&&f&&w.generateMipmap(w.TEXTURE_2D),T.bindTexture(w.TEXTURE_2D,null);if(a.depthBuffer){c= +ha.get(a);d=a instanceof b.WebGLRenderTargetCube;if(a.depthTexture){if(d)throw Error("target.depthTexture not supported in Cube render targets");if(a instanceof b.WebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported!");w.bindFramebuffer(w.FRAMEBUFFER,c.__webglFramebuffer);if(!(a.depthTexture instanceof b.DepthTexture))throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");ha.get(a.depthTexture).__webglTexture&&a.depthTexture.image.width=== +a.width&&a.depthTexture.image.height===a.height||(a.depthTexture.image.width=a.width,a.depthTexture.image.height=a.height,a.depthTexture.needsUpdate=!0);ja.setTexture(a.depthTexture,0);c=ha.get(a.depthTexture).__webglTexture;w.framebufferTexture2D(w.FRAMEBUFFER,w.DEPTH_ATTACHMENT,w.TEXTURE_2D,c,0)}else if(d)for(c.__webglDepthbuffer=[],d=0;6>d;d++)w.bindFramebuffer(w.FRAMEBUFFER,c.__webglFramebuffer[d]),c.__webglDepthbuffer[d]=w.createRenderbuffer(),K(c.__webglDepthbuffer[d],a);else w.bindFramebuffer(w.FRAMEBUFFER, +c.__webglFramebuffer),c.__webglDepthbuffer=w.createRenderbuffer(),K(c.__webglDepthbuffer,a);w.bindFramebuffer(w.FRAMEBUFFER,null)}}c=a instanceof b.WebGLRenderTargetCube;a?(d=ha.get(a),d=c?d.__webglFramebuffer[a.activeCubeFace]:d.__webglFramebuffer,Ka.copy(a.scissor),la=a.scissorTest,X.copy(a.viewport)):(d=null,Ka.copy(ma).multiplyScalar(ga),la=ba,X.copy(na).multiplyScalar(ga));Da!==d&&(w.bindFramebuffer(w.FRAMEBUFFER,d),Da=d);T.scissor(Ka);T.setScissorTest(la);T.viewport(X);c&&(c=ha.get(a.texture), +w.framebufferTexture2D(w.FRAMEBUFFER,w.COLOR_ATTACHMENT0,w.TEXTURE_CUBE_MAP_POSITIVE_X+a.activeCubeFace,c.__webglTexture,a.activeMipMapLevel))};this.readRenderTargetPixels=function(a,c,d,e,f,h){if(!1===a instanceof b.WebGLRenderTarget)console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");else{var g=ha.get(a).__webglFramebuffer;if(g){var l=!1;g!==Da&&(w.bindFramebuffer(w.FRAMEBUFFER,g),l=!0);try{var k=a.texture;k.format!==b.RGBAFormat&&J(k.format)!== +w.getParameter(w.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):k.type===b.UnsignedByteType||J(k.type)===w.getParameter(w.IMPLEMENTATION_COLOR_READ_TYPE)||k.type===b.FloatType&&ka.get("WEBGL_color_buffer_float")||k.type===b.HalfFloatType&&ka.get("EXT_color_buffer_half_float")?w.checkFramebufferStatus(w.FRAMEBUFFER)===w.FRAMEBUFFER_COMPLETE?0c){var d=b;b=c;c=d}d=a[b];return void 0===d?(a[b]=[c],!0):-1===d.indexOf(c)?(d.push(c),!0):!1}var g=new b.WebGLGeometries(a,c,d);this.getAttributeBuffer=function(a){return a instanceof b.InterleavedBufferAttribute?c.get(a.data).__webglBuffer:c.get(a).__webglBuffer};this.getWireframeAttribute= -function(d){var g=c.get(d);if(void 0!==g.wireframe)return g.wireframe;var k=[],m=d.index,r=d.attributes;d=r.position;if(null!==m)for(var r={},m=m.array,t=0,l=m.length;t/g,function(a,c){var d=b.ShaderChunk[c];if(void 0===d)throw Error("Can not resolve #include <"+c+">");return m(d)})}function n(a){return a.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(a,b,c,d){a="";for(b=parseInt(b);b/g,function(a,c){var d=b.ShaderChunk[c];if(void 0===d)throw Error("Can not resolve #include <"+c+">");return m(d)})}function r(a){return a.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(a,b,c,d){a="";for(b=parseInt(b);b=e||0 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n")); -A.compileShader(U);A.compileShader(G);A.attachShader(L,U);A.attachShader(L,G);A.linkProgram(L);E=L;y=A.getAttribLocation(E,"position");v=A.getAttribLocation(E,"uv");d=A.getUniformLocation(E,"uvOffset");e=A.getUniformLocation(E,"uvScale");f=A.getUniformLocation(E,"rotation");g=A.getUniformLocation(E,"scale");h=A.getUniformLocation(E,"color");k=A.getUniformLocation(E,"map");m=A.getUniformLocation(E,"opacity");n=A.getUniformLocation(E,"modelViewMatrix");r=A.getUniformLocation(E,"projectionMatrix");t= -A.getUniformLocation(E,"fogType");l=A.getUniformLocation(E,"fogDensity");s=A.getUniformLocation(E,"fogNear");p=A.getUniformLocation(E,"fogFar");u=A.getUniformLocation(E,"fogColor");R=A.getUniformLocation(E,"alphaTest");L=document.createElement("canvas");L.width=8;L.height=8;U=L.getContext("2d");U.fillStyle="white";U.fillRect(0,0,8,8);Q=new b.Texture(L);Q.needsUpdate=!0}A.useProgram(E);F.initAttributes();F.enableAttribute(y);F.enableAttribute(v);F.disableUnusedAttributes();F.disable(A.CULL_FACE);F.enable(A.BLEND); -A.bindBuffer(A.ARRAY_BUFFER,B);A.vertexAttribPointer(y,2,A.FLOAT,!1,16,0);A.vertexAttribPointer(v,2,A.FLOAT,!1,16,8);A.bindBuffer(A.ELEMENT_ARRAY_BUFFER,H);A.uniformMatrix4fv(r,!1,N.projectionMatrix.elements);F.activeTexture(A.TEXTURE0);A.uniform1i(k,0);U=L=0;(G=C.fog)?(A.uniform3f(u,G.color.r,G.color.g,G.color.b),G instanceof b.Fog?(A.uniform1f(s,G.near),A.uniform1f(p,G.far),A.uniform1i(t,1),U=L=1):G instanceof b.FogExp2&&(A.uniform1f(l,G.density),A.uniform1i(t,2),U=L=2)):(A.uniform1i(t,0),U=L=0); -for(var G=0,I=c.length;G 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n")); +A.compileShader(O);A.compileShader(H);A.attachShader(D,O);A.attachShader(D,H);A.linkProgram(D);E=D;z=A.getAttribLocation(E,"position");v=A.getAttribLocation(E,"uv");d=A.getUniformLocation(E,"uvOffset");e=A.getUniformLocation(E,"uvScale");f=A.getUniformLocation(E,"rotation");g=A.getUniformLocation(E,"scale");h=A.getUniformLocation(E,"color");k=A.getUniformLocation(E,"map");m=A.getUniformLocation(E,"opacity");r=A.getUniformLocation(E,"modelViewMatrix");q=A.getUniformLocation(E,"projectionMatrix");t= +A.getUniformLocation(E,"fogType");l=A.getUniformLocation(E,"fogDensity");s=A.getUniformLocation(E,"fogNear");n=A.getUniformLocation(E,"fogFar");x=A.getUniformLocation(E,"fogColor");W=A.getUniformLocation(E,"alphaTest");D=document.createElement("canvas");D.width=8;D.height=8;O=D.getContext("2d");O.fillStyle="white";O.fillRect(0,0,8,8);M=new b.Texture(D);M.needsUpdate=!0}A.useProgram(E);L.initAttributes();L.enableAttribute(z);L.enableAttribute(v);L.disableUnusedAttributes();L.disable(A.CULL_FACE);L.enable(A.BLEND); +A.bindBuffer(A.ARRAY_BUFFER,F);A.vertexAttribPointer(z,2,A.FLOAT,!1,16,0);A.vertexAttribPointer(v,2,A.FLOAT,!1,16,8);A.bindBuffer(A.ELEMENT_ARRAY_BUFFER,G);A.uniformMatrix4fv(q,!1,S.projectionMatrix.elements);L.activeTexture(A.TEXTURE0);A.uniform1i(k,0);O=D=0;(H=C.fog)?(A.uniform3f(x,H.color.r,H.color.g,H.color.b),H instanceof b.Fog?(A.uniform1f(s,H.near),A.uniform1f(n,H.far),A.uniform1i(t,1),O=D=1):H instanceof b.FogExp2&&(A.uniform1f(l,H.density),A.uniform1i(t,2),O=D=2)):(A.uniform1i(t,0),O=D=0); +for(var H=0,Q=c.length;He&&0>f||0>g&&0>h)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-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d=c.x&&-1<=c.y&&1>=c.y&&-1<=c.z&&1>=c.z}function f(a,b,c){if(!0===a.visible||!0===b.visible||!0===c.visible)return!0;L[0]=a.positionScreen;L[1]=b.positionScreen;L[2]=c.positionScreen;return C.intersectsBox(N.setFromPoints(L))}function g(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)}var h=[],k=[],m=null,n=null,q=new b.Matrix3;return{setObject:function(a){m=a;n=m.material;q.getNormalMatrix(m.matrixWorld);h.length=0;k.length=0},projectVertex:e,checkTriangleVisibility:f,checkBackfaceCulling:g,pushVertex:function(b,c,d){r=a();r.position.set(b,c,d);e(r)},pushNormal:function(a,b,c){h.push(a,b,c)},pushUv:function(a,b){k.push(a,b)},pushLine:function(a,b){var c=l[a],e=l[b];v=d();v.id=m.id;v.v1.copy(c);v.v2.copy(e);v.z=(c.positionScreen.z+e.positionScreen.z)/ -2;v.renderOrder=m.renderOrder;v.material=m.material;K.elements.push(v)},pushTriangle:function(a,d,e){var r=l[a],s=l[d],t=l[e];if(!1!==f(r,s,t)&&(n.side===b.DoubleSide||!0===g(r,s,t))){p=c();p.id=m.id;p.v1.copy(r);p.v2.copy(s);p.v3.copy(t);p.z=(r.positionScreen.z+s.positionScreen.z+t.positionScreen.z)/3;p.renderOrder=m.renderOrder;p.normalModel.fromArray(h,3*a);p.normalModel.applyMatrix3(q).normalize();for(r=0;3>r;r++)s=p.vertexNormalsModel[r],s.fromArray(h,3*arguments[r]),s.applyMatrix3(q).normalize(), -p.uvs[r].fromArray(k,2*arguments[r]);p.vertexNormalsLength=3;p.material=m.material;K.elements.push(p)}}}};this.projectScene=function(r,s,y,z){H=D=u=0;K.elements.length=0;!0===r.autoUpdate&&r.updateMatrixWorld();null===s.parent&&s.updateMatrixWorld();U.copy(s.matrixWorldInverse.getInverse(s.matrixWorld));G.multiplyMatrices(s.projectionMatrix,U);W.setFromMatrix(G);k=0;K.objects.length=0;K.lights.length=0;r.traverseVisible(function(a){if(a instanceof b.Light)K.lights.push(a);else if((a instanceof b.Mesh|| -a instanceof b.Line||a instanceof b.Sprite)&&!1!==a.material.visible&&(!1===a.frustumCulled||!0===W.intersectsObject(a))){if(k===n){var c=new b.RenderableObject;m.push(c);n++;k++;h=c}else h=m[k++];h.id=a.id;h.object=a;O.setFromMatrixPosition(a.matrixWorld);O.applyProjection(G);h.z=O.z;h.renderOrder=a.renderOrder;K.objects.push(h)}});!0===y&&K.objects.sort(f);r=0;for(y=K.objects.length;rda;da++)p.uvs[da].copy($[da]);p.color=X.color;p.material=F;p.z=(E.positionScreen.z+Z.positionScreen.z+ha.positionScreen.z)/3;p.renderOrder=A.renderOrder;K.elements.push(p)}}}else if(A instanceof -b.Line)if(E instanceof b.BufferGeometry){if(C=E.attributes,void 0!==C.position){F=C.position.array;T=0;for(Q=F.length;T=J.z&&(B=e(),B.id=A.id,B.x=J.x*T,B.y=J.y*T,B.z=J.z,B.renderOrder=A.renderOrder,B.object=A,B.rotation=A.rotation,B.scale.x=A.scale.x*Math.abs(B.x-(J.x+s.projectionMatrix.elements[0])/(J.w+s.projectionMatrix.elements[12])),B.scale.y=A.scale.y*Math.abs(B.y-(J.y+s.projectionMatrix.elements[5])/(J.w+s.projectionMatrix.elements[13])),B.material=A.material, -K.elements.push(B)))}!0===z&&K.elements.sort(f);return K}};b.SpriteCanvasMaterial=function(a){b.Material.call(this);this.type="SpriteCanvasMaterial";this.color=new b.Color(16777215);this.program=function(a,b){};this.setValues(a)};b.SpriteCanvasMaterial.prototype=Object.create(b.Material.prototype);b.SpriteCanvasMaterial.prototype.constructor=b.SpriteCanvasMaterial;b.SpriteCanvasMaterial.prototype.clone=function(){var a=new b.SpriteCanvasMaterial;a.copy(this);a.color.copy(this.color);a.program=this.program; -return a};b.CanvasRenderer=function(a){function c(a,b,c,d){m(b);n(c);r(d);t(a.getStyle());C.stroke();ma.expandByScalar(2*b)}function d(a){l(a.getStyle());C.fill()}function e(a){if(0===a.version||a instanceof b.CompressedTexture||a instanceof b.DataTexture)return{canvas:void 0,version:a.version};var c=a.image;if(!1===c.complete)return{canvas:void 0,version:0};var d=document.createElement("canvas");d.width=c.width;d.height=c.height;var e=d.getContext("2d");e.setTransform(1,0,0,-1,0,c.height);e.drawImage(c, -0,0);var c=a.wrapS===b.RepeatWrapping,e=a.wrapT===b.RepeatWrapping,f="no-repeat";!0===c&&!0===e?f="repeat":!0===c?f="repeat-x":!0===e&&(f="repeat-y");d=C.createPattern(d,f);if(a.onUpdate)a.onUpdate(a);return{canvas:d,version:a.version}}function f(a,b,c,d,f,g,h,k,m,n,q,p,r){var s=ya[r.id];if(void 0===s||s.version!==r.version)s=e(r),ya[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,v=r.image.width*r.repeat.x;r=r.image.height*r.repeat.y;h=(h+s)*v;k=(k+t)* -r;c-=a;d-=b;f-=a;g-=b;m=(m+s)*v-h;n=(n+t)*r-k;q=(q+s)*v-h;p=(p+t)*r-k;r=m*p-q*n;0!==r&&(s=1/r,r=(p*c-n*f)*s,n=(p*d-n*g)*s,c=(m*f-q*c)*s,d=(m*g-q*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){U!==a&&(U=C.globalAlpha=a)}function k(a){G!==a&&(a===b.NormalBlending?C.globalCompositeOperation="source-over": -a===b.AdditiveBlending?C.globalCompositeOperation="lighter":a===b.SubtractiveBlending&&(C.globalCompositeOperation="darker"),G=a)}function m(a){Y!==a&&(Y=C.lineWidth=a)}function n(a){W!==a&&(W=C.lineCap=a)}function r(a){ba!==a&&(ba=C.lineJoin=a)}function t(a){I!==a&&(I=C.strokeStyle=a)}function l(a){M!==a&&(M=C.fillStyle=a)}function s(a){ea.length!==a.length&&(C.setLineDash(a),ea=a)}console.log("THREE.CanvasRenderer",b.REVISION);a=a||{};var p=this,u,R,y,v=new b.Projector,D=void 0!==a.canvas?a.canvas: -document.createElement("canvas"),A=D.width,F=D.height,B=Math.floor(A/2),H=Math.floor(F/2),E=0,Q=0,K=A,O=F,J=1,C=D.getContext("2d",{alpha:!0===a.alpha}),N=new b.Color(0),L=!0===a.alpha?0:1,U=1,G=0,I=null,M=null,Y=null,W=null,ba=null,ea=[],ca,Z,la;new b.RenderableVertex;new b.RenderableVertex;var sa,oa,ia,pa,Ca,Da,T=new b.Color;new b.Color;new b.Color;new b.Color;new b.Color;var wa=new b.Color,xa=new b.Color,Ka=new b.Color,ya={},X,Ga,ha,$,da,za,fa,ka=new b.Box2,aa=new b.Box2,ma=new b.Box2,pb=new b.Color, -Qa=new b.Color,La=new b.Color,Ea=new b.Vector3,Aa=new b.Vector3,na=new b.Vector3,Ba=new b.Matrix3;void 0===C.setLineDash&&(C.setLineDash=function(){});this.domElement=D;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 J};this.setPixelRatio= -function(a){void 0!==a&&(J=a)};this.setSize=function(a,b,c){A=a*J;F=b*J;D.width=A;D.height=F;B=Math.floor(A/2);H=Math.floor(F/2);!1!==c&&(D.style.width=a+"px",D.style.height=b+"px");ka.min.set(-B,-H);ka.max.set(B,H);aa.min.set(-B,-H);aa.max.set(B,H);U=1;G=0;ba=W=Y=M=I=null;this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){E=a*J;Q=b*J;K=c*J;O=d*J};this.setScissor=function(){};this.setScissorTest=function(){};this.setClearColor=function(a,b){N.set(a);L=void 0!==b?b:1;aa.min.set(-B,-H);aa.max.set(B, -H)};this.setClearColorHex=function(a,b){console.warn("THREE.CanvasRenderer: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getClearColor=function(){return N};this.getClearAlpha=function(){return L};this.getMaxAnisotropy=function(){return 0};this.clear=function(){!1===aa.isEmpty()&&(aa.intersect(ka),aa.expandByScalar(2),aa.min.x+=B,aa.min.y=-aa.min.y+H,aa.max.x+=B,aa.max.y=-aa.max.y+H,1>L&&C.clearRect(aa.min.x|0,aa.max.y|0,aa.max.x-aa.min.x|0,aa.min.y- -aa.max.y|0),0ca.positionScreen.z||1Z.positionScreen.z||1la.positionScreen.z||1=W||(W*=Y.intensity,N.add(Ka.multiplyScalar(W)))):Y instanceof b.PointLight&&(U=Ea.setFromMatrixPosition(Y.matrixWorld),W=w.dot(Ea.subVectors(U,M).normalize()), -0>=W||(W*=0==Y.distance?1:1-Math.min(M.distanceTo(U)/Y.distance,1),0!=W&&(W*=Y.intensity,N.add(Ka.multiplyScalar(W)))));T.multiply(wa).add(xa);!0===I.wireframe?c(T,I.wireframeLinewidth,I.wireframeLinecap,I.wireframeLinejoin):d(T)}else I instanceof b.MeshBasicMaterial||I instanceof b.MeshLambertMaterial||I instanceof b.MeshPhongMaterial?null!==I.map?I.map.mapping===b.UVMapping&&(X=S.uvs,f(sa,oa,ia,pa,Ca,Da,X[0].x,X[0].y,X[1].x,X[1].y,X[2].x,X[2].y,I.map)):null!==I.envMap?I.envMap.mapping===b.SphericalReflectionMapping&& -(na.copy(S.vertexNormalsModel[0]).applyMatrix3(Ba),Ga=.5*na.x+.5,ha=.5*na.y+.5,na.copy(S.vertexNormalsModel[1]).applyMatrix3(Ba),$=.5*na.x+.5,da=.5*na.y+.5,na.copy(S.vertexNormalsModel[2]).applyMatrix3(Ba),za=.5*na.x+.5,fa=.5*na.y+.5,f(sa,oa,ia,pa,Ca,Da,Ga,ha,$,da,za,fa,I.envMap)):(T.copy(I.color),I.vertexColors===b.FaceColors&&T.multiply(S.color),!0===I.wireframe?c(T,I.wireframeLinewidth,I.wireframeLinecap,I.wireframeLinejoin):d(T)):(I instanceof b.MeshNormalMaterial?(na.copy(S.normalModel).applyMatrix3(Ba), -T.setRGB(na.x,na.y,na.z).multiplyScalar(.5).addScalar(.5)):T.setRGB(1,1,1),!0===I.wireframe?c(T,I.wireframeLinewidth,I.wireframeLinecap,I.wireframeLinejoin):d(T))}}aa.union(ma)}}C.setTransform(1,0,0,1,0,0)}}};b.TrackballControls=function(a,c){function d(a){!1!==l.enabled&&(window.removeEventListener("keydown",d),R=u,u===s.NONE)&&(a.keyCode!==l.keys[s.ROTATE]||l.noRotate?a.keyCode!==l.keys[s.ZOOM]||l.noZoom?a.keyCode!==l.keys[s.PAN]||l.noPan||(u=s.PAN):u=s.ZOOM:u=s.ROTATE)}function e(a){!1!==l.enabled&& -(u=R,window.addEventListener("keydown",d,!1))}function f(a){!1!==l.enabled&&(a.preventDefault(),a.stopPropagation(),u===s.NONE&&(u=a.button),u!==s.ROTATE||l.noRotate?u!==s.ZOOM||l.noZoom?u!==s.PAN||l.noPan||(K.copy(L(a.pageX,a.pageY)),O.copy(K)):(B.copy(L(a.pageX,a.pageY)),H.copy(B)):(D.copy(U(a.pageX,a.pageY)),v.copy(D)),document.addEventListener("mousemove",g,!1),document.addEventListener("mouseup",h,!1),l.dispatchEvent(C))}function g(a){!1!==l.enabled&&(a.preventDefault(),a.stopPropagation(),u!== -s.ROTATE||l.noRotate?u!==s.ZOOM||l.noZoom?u!==s.PAN||l.noPan||O.copy(L(a.pageX,a.pageY)):H.copy(L(a.pageX,a.pageY)):(v.copy(D),D.copy(U(a.pageX,a.pageY))))}function h(a){!1!==l.enabled&&(a.preventDefault(),a.stopPropagation(),u=s.NONE,document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",h),l.dispatchEvent(N))}function k(a){if(!1!==l.enabled){a.preventDefault();a.stopPropagation();var b=0;a.wheelDelta?b=a.wheelDelta/40:a.detail&&(b=-a.detail/3);B.y+=.01*b;l.dispatchEvent(C); -l.dispatchEvent(N)}}function m(a){if(!1!==l.enabled){switch(a.touches.length){case 1:u=s.TOUCH_ROTATE;D.copy(U(a.touches[0].pageX,a.touches[0].pageY));v.copy(D);break;default:u=s.TOUCH_ZOOM_PAN;var b=a.touches[0].pageX-a.touches[1].pageX,c=a.touches[0].pageY-a.touches[1].pageY;Q=E=Math.sqrt(b*b+c*c);K.copy(L((a.touches[0].pageX+a.touches[1].pageX)/2,(a.touches[0].pageY+a.touches[1].pageY)/2));O.copy(K)}l.dispatchEvent(C)}}function n(a){if(!1!==l.enabled)switch(a.preventDefault(),a.stopPropagation(), -a.touches.length){case 1:v.copy(D);D.copy(U(a.touches[0].pageX,a.touches[0].pageY));break;default:var b=a.touches[0].pageX-a.touches[1].pageX,c=a.touches[0].pageY-a.touches[1].pageY;Q=Math.sqrt(b*b+c*c);O.copy(L((a.touches[0].pageX+a.touches[1].pageX)/2,(a.touches[0].pageY+a.touches[1].pageY)/2))}}function r(a){if(!1!==l.enabled){switch(a.touches.length){case 0:u=s.NONE;break;case 1:u=s.TOUCH_ROTATE,D.copy(U(a.touches[0].pageX,a.touches[0].pageY)),v.copy(D)}l.dispatchEvent(N)}}function t(a){a.preventDefault()} -var l=this,s={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4};this.object=a;this.domElement=void 0!==c?c: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 b.Vector3;var p=new b.Vector3,u=s.NONE,R=s.NONE,y=new b.Vector3,v=new b.Vector2,D=new b.Vector2, -A=new b.Vector3,F=0,B=new b.Vector2,H=new b.Vector2,E=0,Q=0,K=new b.Vector2,O=new b.Vector2;this.target0=this.target.clone();this.position0=this.object.position.clone();this.up0=this.object.up.clone();var J={type:"change"},C={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.handleEvent=function(a){if("function"==typeof this[a.type])this[a.type](a)};var L=function(){var a=new b.Vector2;return function(b,c){a.set((b-l.screen.left)/l.screen.width,(c-l.screen.top)/l.screen.height);return a}}(),U=function(){var a=new b.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 b.Vector3,c=new b.Quaternion,d=new b.Vector3,e=new b.Vector3,f=new b.Vector3,g=new b.Vector3,h;return function(){g.set(D.x-v.x,D.y-v.y,0);(h=g.length())?(y.copy(l.object.position).sub(l.target),d.copy(y).normalize(),e.copy(l.object.up).normalize(),f.crossVectors(e,d).normalize(),e.setLength(D.y-v.y),f.setLength(D.x-v.x),g.copy(e.add(f)),a.crossVectors(g,y).normalize(),h*=l.rotateSpeed,c.setFromAxisAngle(a, -h),y.applyQuaternion(c),l.object.up.applyQuaternion(c),A.copy(a),F=h):!l.staticMoving&&F&&(F*=Math.sqrt(1-l.dynamicDampingFactor),y.copy(l.object.position).sub(l.target),c.setFromAxisAngle(A,F),y.applyQuaternion(c),l.object.up.applyQuaternion(c));v.copy(D)}}();this.zoomCamera=function(){var a;u===s.TOUCH_ZOOM_PAN?(a=E/Q,E=Q,y.multiplyScalar(a)):(a=1+(H.y-B.y)*l.zoomSpeed,1!==a&&0l.maxDistance*l.maxDistance&&(l.object.position.addVectors(l.target,y.setLength(l.maxDistance)), -B.copy(H)),y.lengthSq()e&&0>f||0>g&&0>h)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-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d=c.x&&-1<=c.y&&1>=c.y&&-1<=c.z&&1>=c.z}function f(a,b,c){if(!0===a.visible||!0===b.visible||!0===c.visible)return!0;D[0]=a.positionScreen;D[1]=b.positionScreen;D[2]=c.positionScreen;return C.intersectsBox(S.setFromPoints(D))}function g(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)}var h=[],k=[],m=null,p=null,s=new b.Matrix3;return{setObject:function(a){m=a;p=m.material;s.getNormalMatrix(m.matrixWorld);h.length=0;k.length=0},projectVertex:e,checkTriangleVisibility:f,checkBackfaceCulling:g,pushVertex:function(b,c,d){q=a();q.position.set(b,c,d);e(q)},pushNormal:function(a,b,c){h.push(a,b,c)},pushUv:function(a,b){k.push(a,b)},pushLine:function(a,b){var c=l[a],e=l[b];v=d();v.id=m.id;v.v1.copy(c);v.v2.copy(e);v.z=(c.positionScreen.z+e.positionScreen.z)/ +2;v.renderOrder=m.renderOrder;v.material=m.material;K.elements.push(v)},pushTriangle:function(a,d,e){var r=l[a],q=l[d],t=l[e];if(!1!==f(r,q,t)&&(p.side===b.DoubleSide||!0===g(r,q,t))){n=c();n.id=m.id;n.v1.copy(r);n.v2.copy(q);n.v3.copy(t);n.z=(r.positionScreen.z+q.positionScreen.z+t.positionScreen.z)/3;n.renderOrder=m.renderOrder;n.normalModel.fromArray(h,3*a);n.normalModel.applyMatrix3(s).normalize();for(r=0;3>r;r++)q=n.vertexNormalsModel[r],q.fromArray(h,3*arguments[r]),q.applyMatrix3(s).normalize(), +n.uvs[r].fromArray(k,2*arguments[r]);n.vertexNormalsLength=3;n.material=m.material;K.elements.push(n)}}}};this.projectScene=function(s,q,z,A){G=B=x=0;K.elements.length=0;!0===s.autoUpdate&&s.updateMatrixWorld();null===q.parent&&q.updateMatrixWorld();O.copy(q.matrixWorldInverse.getInverse(q.matrixWorld));H.multiplyMatrices(q.projectionMatrix,O);U.setFromMatrix(H);k=0;K.objects.length=0;K.lights.length=0;s.traverseVisible(function(a){if(a instanceof b.Light)K.lights.push(a);else if((a instanceof b.Mesh|| +a instanceof b.Line||a instanceof b.Sprite)&&!1!==a.material.visible&&(!1===a.frustumCulled||!0===U.intersectsObject(a))){if(k===r){var c=new b.RenderableObject;m.push(c);r++;k++;h=c}else h=m[k++];h.id=a.id;h.object=a;P.setFromMatrixPosition(a.matrixWorld);P.applyProjection(H);h.z=P.z;h.renderOrder=a.renderOrder;K.objects.push(h)}});!0===z&&K.objects.sort(f);s=0;for(z=K.objects.length;sfa;fa++)n.uvs[fa].copy(aa[fa]);n.color=X.color;n.material=M;n.z=(C.positionScreen.z+$.positionScreen.z+ia.positionScreen.z)/3;n.renderOrder=E.renderOrder; +K.elements.push(n)}}}else if(E instanceof b.Line)if(C instanceof b.BufferGeometry){if(L=C.attributes,void 0!==L.position){M=L.position.array;R=0;for(D=M.length;R=J.z&&(F=e(),F.id=E.id,F.x=J.x*R,F.y=J.y*R,F.z=J.z,F.renderOrder=E.renderOrder,F.object=E,F.rotation=E.rotation,F.scale.x=E.scale.x*Math.abs(F.x-(J.x+q.projectionMatrix.elements[0])/(J.w+q.projectionMatrix.elements[12])),F.scale.y=E.scale.y*Math.abs(F.y-(J.y+q.projectionMatrix.elements[5])/(J.w+q.projectionMatrix.elements[13])),F.material=E.material, +K.elements.push(F)))}!0===A&&K.elements.sort(f);return K}};b.SpriteCanvasMaterial=function(a){b.Material.call(this);this.type="SpriteCanvasMaterial";this.color=new b.Color(16777215);this.program=function(a,b){};this.setValues(a)};b.SpriteCanvasMaterial.prototype=Object.create(b.Material.prototype);b.SpriteCanvasMaterial.prototype.constructor=b.SpriteCanvasMaterial;b.SpriteCanvasMaterial.prototype.clone=function(){var a=new b.SpriteCanvasMaterial;a.copy(this);a.color.copy(this.color);a.program=this.program; +return a};b.CanvasRenderer=function(a){function c(a,b,c,d){m(b);r(c);q(d);t(a.getStyle());C.stroke();na.expandByScalar(2*b)}function d(a){l(a.getStyle());C.fill()}function e(a){if(0===a.version||a instanceof b.CompressedTexture||a instanceof b.DataTexture)return{canvas:void 0,version:a.version};var c=a.image;if(!1===c.complete)return{canvas:void 0,version:0};var d=document.createElement("canvas");d.width=c.width;d.height=c.height;var e=d.getContext("2d");e.setTransform(1,0,0,-1,0,c.height);e.drawImage(c, +0,0);var c=a.wrapS===b.RepeatWrapping,e=a.wrapT===b.RepeatWrapping,f="no-repeat";!0===c&&!0===e?f="repeat":!0===c?f="repeat-x":!0===e&&(f="repeat-y");d=C.createPattern(d,f);if(a.onUpdate)a.onUpdate(a);return{canvas:d,version:a.version}}function f(a,b,c,d,f,g,h,k,m,n,p,s,r){var q=la[r.id];if(void 0===q||q.version!==r.version)q=e(r),la[r.id]=q;if(void 0!==q.canvas){l(q.canvas);var q=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+q)*u;k=(k+t)* +r;c-=a;d-=b;f-=a;g-=b;m=(m+q)*u-h;n=(n+t)*r-k;p=(p+q)*u-h;s=(s+t)*r-k;r=m*s-p*n;0!==r&&(q=1/r,r=(s*c-n*f)*q,n=(s*d-n*g)*q,c=(m*f-p*c)*q,d=(m*g-p*d)*q,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){O!==a&&(O=C.globalAlpha=a)}function k(a){H!==a&&(a===b.NormalBlending?C.globalCompositeOperation="source-over": +a===b.AdditiveBlending?C.globalCompositeOperation="lighter":a===b.SubtractiveBlending&&(C.globalCompositeOperation="darker"),H=a)}function m(a){V!==a&&(V=C.lineWidth=a)}function r(a){U!==a&&(U=C.lineCap=a)}function q(a){Z!==a&&(Z=C.lineJoin=a)}function t(a){Q!==a&&(Q=C.strokeStyle=a)}function l(a){I!==a&&(I=C.fillStyle=a)}function s(a){da.length!==a.length&&(C.setLineDash(a),da=a)}console.log("THREE.CanvasRenderer",b.REVISION);a=a||{};var n=this,x,W,z,v=new b.Projector,B=void 0!==a.canvas?a.canvas: +document.createElement("canvas"),A=B.width,L=B.height,F=Math.floor(A/2),G=Math.floor(L/2),E=0,M=0,K=A,P=L,J=1,C=B.getContext("2d",{alpha:!0===a.alpha}),S=new b.Color(0),D=!0===a.alpha?0:1,O=1,H=0,Q=null,I=null,V=null,U=null,Z=null,da=[],ca,$,Y;new b.RenderableVertex;new b.RenderableVertex;var ta,pa,ja,qa,Ca,Da,R=new b.Color;new b.Color;new b.Color;new b.Color;new b.Color;var xa=new b.Color,ya=new b.Color,Ka=new b.Color,la={},X,Ga,ia,aa,fa,za,ga,ma=new b.Box2,ba=new b.Box2,na=new b.Box2,pb=new b.Color, +Qa=new b.Color,La=new b.Color,Ea=new b.Vector3,Aa=new b.Vector3,oa=new b.Vector3,Ba=new b.Matrix3;void 0===C.setLineDash&&(C.setLineDash=function(){});this.domElement=B;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 J};this.setPixelRatio= +function(a){void 0!==a&&(J=a)};this.setSize=function(a,b,c){A=a*J;L=b*J;B.width=A;B.height=L;F=Math.floor(A/2);G=Math.floor(L/2);!1!==c&&(B.style.width=a+"px",B.style.height=b+"px");ma.min.set(-F,-G);ma.max.set(F,G);ba.min.set(-F,-G);ba.max.set(F,G);O=1;H=0;Z=U=V=I=Q=null;this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){E=a*J;M=b*J;K=c*J;P=d*J};this.setScissor=function(){};this.setScissorTest=function(){};this.setClearColor=function(a,b){S.set(a);D=void 0!==b?b:1;ba.min.set(-F,-G);ba.max.set(F, +G)};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 D};this.getMaxAnisotropy=function(){return 0};this.clear=function(){!1===ba.isEmpty()&&(ba.intersect(ma),ba.expandByScalar(2),ba.min.x+=F,ba.min.y=-ba.min.y+G,ba.max.x+=F,ba.max.y=-ba.max.y+G,1>D&&C.clearRect(ba.min.x|0,ba.max.y|0,ba.max.x-ba.min.x|0,ba.min.y- +ba.max.y|0),0ca.positionScreen.z||1$.positionScreen.z||1<$.positionScreen.z)continue;if(-1>Y.positionScreen.z||1=V||(V*=Z.intensity,O.add(Ka.multiplyScalar(V)))):Z instanceof b.PointLight&&(U=Ea.setFromMatrixPosition(Z.matrixWorld),V=w.dot(Ea.subVectors(U,Q).normalize()), +0>=V||(V*=0==Z.distance?1:1-Math.min(Q.distanceTo(U)/Z.distance,1),0!=V&&(V*=Z.intensity,O.add(Ka.multiplyScalar(V)))));R.multiply(xa).add(ya);!0===D.wireframe?c(R,D.wireframeLinewidth,D.wireframeLinecap,D.wireframeLinejoin):d(R)}else D instanceof b.MeshBasicMaterial||D instanceof b.MeshLambertMaterial||D instanceof b.MeshPhongMaterial?null!==D.map?D.map.mapping===b.UVMapping&&(X=I.uvs,f(ta,pa,ja,qa,Ca,Da,X[0].x,X[0].y,X[1].x,X[1].y,X[2].x,X[2].y,D.map)):null!==D.envMap?D.envMap.mapping===b.SphericalReflectionMapping&& +(oa.copy(I.vertexNormalsModel[0]).applyMatrix3(Ba),Ga=.5*oa.x+.5,ia=.5*oa.y+.5,oa.copy(I.vertexNormalsModel[1]).applyMatrix3(Ba),aa=.5*oa.x+.5,fa=.5*oa.y+.5,oa.copy(I.vertexNormalsModel[2]).applyMatrix3(Ba),za=.5*oa.x+.5,ga=.5*oa.y+.5,f(ta,pa,ja,qa,Ca,Da,Ga,ia,aa,fa,za,ga,D.envMap)):(R.copy(D.color),D.vertexColors===b.FaceColors&&R.multiply(I.color),!0===D.wireframe?c(R,D.wireframeLinewidth,D.wireframeLinecap,D.wireframeLinejoin):d(R)):(D instanceof b.MeshNormalMaterial?(oa.copy(I.normalModel).applyMatrix3(Ba), +R.setRGB(oa.x,oa.y,oa.z).multiplyScalar(.5).addScalar(.5)):R.setRGB(1,1,1),!0===D.wireframe?c(R,D.wireframeLinewidth,D.wireframeLinecap,D.wireframeLinejoin):d(R))}}ba.union(na)}}C.setTransform(1,0,0,1,0,0)}}};b.TrackballControls=function(a,c){function d(a){!1!==l.enabled&&(window.removeEventListener("keydown",d),W=x,x===s.NONE)&&(a.keyCode!==l.keys[s.ROTATE]||l.noRotate?a.keyCode!==l.keys[s.ZOOM]||l.noZoom?a.keyCode!==l.keys[s.PAN]||l.noPan||(x=s.PAN):x=s.ZOOM:x=s.ROTATE)}function e(a){!1!==l.enabled&& +(x=W,window.addEventListener("keydown",d,!1))}function f(a){!1!==l.enabled&&(a.preventDefault(),a.stopPropagation(),x===s.NONE&&(x=a.button),x!==s.ROTATE||l.noRotate?x!==s.ZOOM||l.noZoom?x!==s.PAN||l.noPan||(K.copy(D(a.pageX,a.pageY)),P.copy(K)):(F.copy(D(a.pageX,a.pageY)),G.copy(F)):(B.copy(O(a.pageX,a.pageY)),v.copy(B)),document.addEventListener("mousemove",g,!1),document.addEventListener("mouseup",h,!1),l.dispatchEvent(C))}function g(a){!1!==l.enabled&&(a.preventDefault(),a.stopPropagation(),x!== +s.ROTATE||l.noRotate?x!==s.ZOOM||l.noZoom?x!==s.PAN||l.noPan||P.copy(D(a.pageX,a.pageY)):G.copy(D(a.pageX,a.pageY)):(v.copy(B),B.copy(O(a.pageX,a.pageY))))}function h(a){!1!==l.enabled&&(a.preventDefault(),a.stopPropagation(),x=s.NONE,document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",h),l.dispatchEvent(S))}function k(a){if(!1!==l.enabled){a.preventDefault();a.stopPropagation();var b=0;a.wheelDelta?b=a.wheelDelta/40:a.detail&&(b=-a.detail/3);F.y+=.01*b;l.dispatchEvent(C); +l.dispatchEvent(S)}}function m(a){if(!1!==l.enabled){switch(a.touches.length){case 1:x=s.TOUCH_ROTATE;B.copy(O(a.touches[0].pageX,a.touches[0].pageY));v.copy(B);break;default:x=s.TOUCH_ZOOM_PAN;var b=a.touches[0].pageX-a.touches[1].pageX,c=a.touches[0].pageY-a.touches[1].pageY;M=E=Math.sqrt(b*b+c*c);K.copy(D((a.touches[0].pageX+a.touches[1].pageX)/2,(a.touches[0].pageY+a.touches[1].pageY)/2));P.copy(K)}l.dispatchEvent(C)}}function r(a){if(!1!==l.enabled)switch(a.preventDefault(),a.stopPropagation(), +a.touches.length){case 1:v.copy(B);B.copy(O(a.touches[0].pageX,a.touches[0].pageY));break;default:var b=a.touches[0].pageX-a.touches[1].pageX,c=a.touches[0].pageY-a.touches[1].pageY;M=Math.sqrt(b*b+c*c);P.copy(D((a.touches[0].pageX+a.touches[1].pageX)/2,(a.touches[0].pageY+a.touches[1].pageY)/2))}}function q(a){if(!1!==l.enabled){switch(a.touches.length){case 0:x=s.NONE;break;case 1:x=s.TOUCH_ROTATE,B.copy(O(a.touches[0].pageX,a.touches[0].pageY)),v.copy(B)}l.dispatchEvent(S)}}function t(a){a.preventDefault()} +var l=this,s={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4};this.object=a;this.domElement=void 0!==c?c: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 b.Vector3;var n=new b.Vector3,x=s.NONE,W=s.NONE,z=new b.Vector3,v=new b.Vector2,B=new b.Vector2, +A=new b.Vector3,L=0,F=new b.Vector2,G=new b.Vector2,E=0,M=0,K=new b.Vector2,P=new b.Vector2;this.target0=this.target.clone();this.position0=this.object.position.clone();this.up0=this.object.up.clone();var J={type:"change"},C={type:"start"},S={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 D=function(){var a=new b.Vector2;return function(b,c){a.set((b-l.screen.left)/l.screen.width,(c-l.screen.top)/l.screen.height);return a}}(),O=function(){var a=new b.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 b.Vector3,c=new b.Quaternion,d=new b.Vector3,e=new b.Vector3,f=new b.Vector3,g=new b.Vector3,h;return function(){g.set(B.x-v.x,B.y-v.y,0);(h=g.length())?(z.copy(l.object.position).sub(l.target),d.copy(z).normalize(),e.copy(l.object.up).normalize(),f.crossVectors(e,d).normalize(),e.setLength(B.y-v.y),f.setLength(B.x-v.x),g.copy(e.add(f)),a.crossVectors(g,z).normalize(),h*=l.rotateSpeed,c.setFromAxisAngle(a, +h),z.applyQuaternion(c),l.object.up.applyQuaternion(c),A.copy(a),L=h):!l.staticMoving&&L&&(L*=Math.sqrt(1-l.dynamicDampingFactor),z.copy(l.object.position).sub(l.target),c.setFromAxisAngle(A,L),z.applyQuaternion(c),l.object.up.applyQuaternion(c));v.copy(B)}}();this.zoomCamera=function(){var a;x===s.TOUCH_ZOOM_PAN?(a=E/M,E=M,z.multiplyScalar(a)):(a=1+(G.y-F.y)*l.zoomSpeed,1!==a&&0l.maxDistance*l.maxDistance&&(l.object.position.addVectors(l.target,z.setLength(l.maxDistance)), +F.copy(G)),z.lengthSq()b.y?this.quaternion.set(1, 0,0,0):(a.set(b.z,0,-b.x).normalize(),c=Math.acos(b.y),this.quaternion.setFromAxisAngle(a,c))}}();b.ArrowHelper.prototype.setLength=function(a,b,d){void 0===b&&(b=.2*a);void 0===d&&(d=.2*b);this.line.scale.set(1,Math.max(0,a-b),1);this.line.updateMatrix();this.cone.scale.set(d,b,d);this.cone.position.y=a;this.cone.updateMatrix()};b.ArrowHelper.prototype.setColor=function(a){this.line.material.color.set(a);this.cone.material.color.set(a)};m.THREE=b})}]); diff --git a/src/js/app/main.js b/src/js/app/main.js index db637b7..8ea2904 100755 --- a/src/js/app/main.js +++ b/src/js/app/main.js @@ -29,7 +29,7 @@ return false; } })(); player.colorset = 'W'; -player.sample = "data_global\n_cell_length_a 24\n_cell_length_b 5.91\n_cell_length_c 5.85\n_cell_angle_alpha 90\n_cell_angle_beta 90\n_cell_angle_gamma 90\n_symmetry_space_group_name_H-M 'P1'\nloop_\n_symmetry_equiv_pos_as_xyz\nx,y,z\nloop_\n_atom_site_label\n_atom_site_type_symbol\n_atom_site_fract_x\n_atom_site_fract_y\n_atom_site_fract_z\n_atom_site_charge\nO1 O 0.425 0.262 0.009 -2.0\nO2 O -0.425 0.262 0.009 -2.0\nH3 H 0.444 0.258 0.154 1.0\nH4 H -0.444 0.258 0.154 1.0\nH5 H 0.396 0.124 0.012 1.0\nH6 H -0.396 0.124 0.012 1.0\nO7 O 0.425 0.236 0.510 -2.0\nO8 O -0.425 0.236 0.510 -2.0\nH9 H 0.444 0.239 0.656 1.0\nH10 H -0.444 0.239 0.656 1.0\nH11 H 0.396 0.374 0.512 1.0\nH12 H -0.396 0.374 0.512 1.0\nSr13 Sr 0.342 0.964 0.467 2.0\nSr14 Sr -0.342 0.964 0.467 2.0\nSr15 Sr 0.342 0.535 0.967 2.0\nSr16 Sr -0.342 0.535 0.967 2.0\nO17 O 0.348 0.971 0.019 -2.0\nO18 O -0.348 0.971 0.019 -2.0\nO19 O 0.348 0.528 0.519 -2.0\nO20 O -0.348 0.528 0.519 -2.0\nO21 O 0.263 0.803 0.701 -2.0\nO22 O -0.263 0.803 0.701 -2.0\nO23 O 0.264 0.695 0.200 -2.0\nO24 O -0.264 0.695 0.200 -2.0\nZr25 Zr 0.261 0.000 0.998 4.0\nZr26 Zr -0.261 0.000 0.998 4.0\nZr27 Zr 0.261 0.499 0.498 4.0\nZr28 Zr -0.261 0.499 0.498 4.0\nO29 O 0.257 0.304 0.806 -2.0\nO30 O -0.257 0.304 0.806 -2.0\nO31 O 0.257 0.195 0.306 -2.0\nO32 O -0.257 0.195 0.306 -2.0\nSr33 Sr 0.173 0.993 0.524 2.0\nSr34 Sr -0.173 0.993 0.524 2.0\nSr35 Sr 0.173 0.506 0.024 2.0\nSr36 Sr -0.173 0.506 0.024 2.0\nO37 O 0.173 0.947 0.986 -2.0\nO38 O -0.173 0.947 0.986 -2.0\nO39 O 0.173 0.551 0.486 -2.0\nO40 O -0.173 0.551 0.486 -2.0\nO41 O 0.098 0.204 0.295 -2.0\nO42 O -0.098 0.204 0.295 -2.0\nO43 O 0.098 0.295 0.795 -2.0\nO44 O -0.098 0.295 0.795 -2.0\nZr45 Zr 0.086 0.004 0.998 4.0\nZr46 Zr -0.086 0.004 0.998 4.0\nZr47 Zr 0.086 0.495 0.498 4.0\nZr48 Zr -0.086 0.495 0.498 4.0\nO49 O 0.074 0.709 0.211 -2.0\nO50 O -0.074 0.709 0.211 -2.0\nO51 O 0.074 0.790 0.711 -2.0\nO52 O -0.074 0.790 0.711 -2.0\nSr53 Sr 0 0.991 0.467 2.0\nSr54 Sr 0 0.508 0.967 2.0\nO55 O 0 0.076 0.020 -2.0\nO56 O 0 0.423 0.520 -2.0"; +player.sample = "data_example\n_cell_length_a 24\n_cell_length_b 5.91\n_cell_length_c 5.85\n_cell_angle_alpha 90\n_cell_angle_beta 90\n_cell_angle_gamma 90\n_symmetry_space_group_name_H-M 'P1'\nloop_\n_symmetry_equiv_pos_as_xyz\nx,y,z\nloop_\n_atom_site_label\n_atom_site_type_symbol\n_atom_site_fract_x\n_atom_site_fract_y\n_atom_site_fract_z\n_atom_site_charge\nO1 O 0.425 0.262 0.009 -2.0\nO2 O -0.425 0.262 0.009 -2.0\nH3 H 0.444 0.258 0.154 1.0\nH4 H -0.444 0.258 0.154 1.0\nH5 H 0.396 0.124 0.012 1.0\nH6 H -0.396 0.124 0.012 1.0\nO7 O 0.425 0.236 0.510 -2.0\nO8 O -0.425 0.236 0.510 -2.0\nH9 H 0.444 0.239 0.656 1.0\nH10 H -0.444 0.239 0.656 1.0\nH11 H 0.396 0.374 0.512 1.0\nH12 H -0.396 0.374 0.512 1.0\nSr13 Sr 0.342 0.964 0.467 2.0\nSr14 Sr -0.342 0.964 0.467 2.0\nSr15 Sr 0.342 0.535 0.967 2.0\nSr16 Sr -0.342 0.535 0.967 2.0\nO17 O 0.348 0.971 0.019 -2.0\nO18 O -0.348 0.971 0.019 -2.0\nO19 O 0.348 0.528 0.519 -2.0\nO20 O -0.348 0.528 0.519 -2.0\nO21 O 0.263 0.803 0.701 -2.0\nO22 O -0.263 0.803 0.701 -2.0\nO23 O 0.264 0.695 0.200 -2.0\nO24 O -0.264 0.695 0.200 -2.0\nZr25 Zr 0.261 0.000 0.998 4.0\nZr26 Zr -0.261 0.000 0.998 4.0\nZr27 Zr 0.261 0.499 0.498 4.0\nZr28 Zr -0.261 0.499 0.498 4.0\nO29 O 0.257 0.304 0.806 -2.0\nO30 O -0.257 0.304 0.806 -2.0\nO31 O 0.257 0.195 0.306 -2.0\nO32 O -0.257 0.195 0.306 -2.0\nSr33 Sr 0.173 0.993 0.524 2.0\nSr34 Sr -0.173 0.993 0.524 2.0\nSr35 Sr 0.173 0.506 0.024 2.0\nSr36 Sr -0.173 0.506 0.024 2.0\nO37 O 0.173 0.947 0.986 -2.0\nO38 O -0.173 0.947 0.986 -2.0\nO39 O 0.173 0.551 0.486 -2.0\nO40 O -0.173 0.551 0.486 -2.0\nO41 O 0.098 0.204 0.295 -2.0\nO42 O -0.098 0.204 0.295 -2.0\nO43 O 0.098 0.295 0.795 -2.0\nO44 O -0.098 0.295 0.795 -2.0\nZr45 Zr 0.086 0.004 0.998 4.0\nZr46 Zr -0.086 0.004 0.998 4.0\nZr47 Zr 0.086 0.495 0.498 4.0\nZr48 Zr -0.086 0.495 0.498 4.0\nO49 O 0.074 0.709 0.211 -2.0\nO50 O -0.074 0.709 0.211 -2.0\nO51 O 0.074 0.790 0.711 -2.0\nO52 O -0.074 0.790 0.711 -2.0\nSr53 Sr 0 0.991 0.467 2.0\nSr54 Sr 0 0.508 0.967 2.0\nO55 O 0 0.076 0.020 -2.0\nO56 O 0 0.423 0.520 -2.0"; var THREE = th.THREE || th; @@ -373,6 +373,7 @@ function accept_data(str, allow_download){ } else dpanel_ready.style.display = 'block'; }*/ player.loaded ? render() : init(); + if (player.obj3d.info) document.title = player.obj3d.info; } else if (!player.loaded) display_landing(); } diff --git a/src/js/libs/matinfio.js b/src/js/libs/matinfio.js index a834d6e..0f25b2a 100755 --- a/src/js/libs/matinfio.js +++ b/src/js/libs/matinfio.js @@ -112,7 +112,7 @@ function jsobj2player(crystal){ descr = crystal.cell; } else cell = crystal.cell; // for POSCAR - var player_output = {"atoms": [], "cell": cell, "descr": descr, "overlayed": {}}; + var player_output = {"atoms": [], "cell": cell, "descr": descr, "overlayed": {}, "info": crystal.info}; var color, radius, oprop, optionpanel = {}; var i = 0, len = crystal.atoms.length, hashes = {}; for (i; i < len; i++){ @@ -194,7 +194,7 @@ function jsobj2flatten(crystal){ function cif2jsobj(str){ var structures = [], symops = [], atprop_seq = [], lines = str.toString().replace(/(\r\n|\r)/gm, "\n").split("\n"), cur_structure = {'cell': {}, 'atoms': []}; var loop_active = false, new_structure = false, symops_active = false; - var cur_line = "", line_data = [], symmetry_seq = []; + var data_info, cur_line = "", line_data = [], symmetry_seq = []; var cell_props = ['a', 'b', 'c', 'alpha', 'beta', 'gamma']; var loop_vals = ['_atom_site_label', '_atom_site_type_symbol', '_atom_site_fract_x', '_atom_site_fract_y', '_atom_site_fract_z']; @@ -216,9 +216,10 @@ function cif2jsobj(str){ } new_structure = false; - if (cur_line.startswith('data_')) + if (cur_line.startswith('data_')){ new_structure = true, loop_active = false, atprop_seq = [], symops_active = false; - else if (cur_line.startswith('_cell_')){ + data_info = cur_line.substr(5); + } else if (cur_line.startswith('_cell_')){ loop_active = false; line_data = cur_line.split(" "); var cell_data = line_data[0].split("_"); @@ -283,12 +284,14 @@ function cif2jsobj(str){ } if (new_structure && cur_structure.atoms.length){ + cur_structure.info = data_info; if (symops.length > 1) cur_structure.symops = symops; structures.push(cur_structure); cur_structure = {'cell': {}, 'atoms': []}, symops = []; } } if (cur_structure.atoms.length){ + cur_structure.info = data_info; if (symops.length > 1) cur_structure.symops = symops; structures.push(cur_structure); }