PK YM)0 0
lib/CGF.jsCGFversion="0.21";CGFdate=" (20181025)";console.log("WebCGF - Library for Computer Graphics @ FEUP (WebGL) - v"+CGFversion+CGFdate);var Detector={canvas:!!window.CanvasRenderingContext2D,webgl:(function(){try{var a=document.createElement('canvas');return !!(window.WebGLRenderingContext&&(a.getContext('webgl')||a.getContext('experimental-webgl')));}catch(b){return false;}})(),workers:!!window.Worker,fileapi:window.File&&window.FileReader&&window.FileList&&window.Blob,getWebGLErrorMessage:function(){var a=document.createElement('div');a.id='webgl-error-message';a.style.fontFamily='monospace';a.style.fontSize='13px';a.style.fontWeight='normal';a.style.textAlign='center';a.style.background='#fff';a.style.color='#000';a.style.padding='1.5em';a.style.width='400px';a.style.margin='5em auto 0';if(!this.webgl)a.innerHTML=window.WebGLRenderingContext?['Your graphics card does not seem to support WebGL. ','Find out how to get it here.'].join('\n'):['Your browser does not seem to support WebGL. ','Find out how to get it here.'].join('\n');return a;},addGetWebGLMessage:function(a){var b,c,d;a=a||{};b=a.parent!==undefined?a.parent:document.body;c=a.id!==undefined?a.id:'oldie';d=Detector.getWebGLErrorMessage();d.id=c;b.appendChild(d);}};if(typeof module==='object')module.exports=Detector;(function(){"use strict";var a={};if(typeof exports==='undefined')if(typeof define=='function'&&typeof define.amd=='object'&&define.amd){a.exports={};define(function(){return a.exports;});}else a.exports=window;else a.exports=exports;(function(a){if(!b)var b=0.000001;if(!c)var c=(typeof Float32Array!=='undefined')?Float32Array:Array;var d={};d.setMatrixArrayType=function(a){c=a;};if(typeof a!=='undefined')a.glMatrix=d;;var e={};e.create=function(){var a=new c(2);a[0]=0;a[1]=0;return a;};e.clone=function(a){var b=new c(2);b[0]=a[0];b[1]=a[1];return b;};e.fromValues=function(a,b){var d=new c(2);d[0]=a;d[1]=b;return d;};e.copy=function(a,b){a[0]=b[0];a[1]=b[1];return a;};e.set=function(a,b,c){a[0]=b;a[1]=c;return a;};e.add=function(a,b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];return a;};e.subtract=function(a,b,c){a[0]=b[0]-c[0];a[1]=b[1]-c[1];return a;};e.sub=e.subtract;e.multiply=function(a,b,c){a[0]=b[0]*c[0];a[1]=b[1]*c[1];return a;};e.mul=e.multiply;e.divide=function(a,b,c){a[0]=b[0]/c[0];a[1]=b[1]/c[1];return a;};e.div=e.divide;e.min=function(a,b,c){a[0]=Math.min(b[0],c[0]);a[1]=Math.min(b[1],c[1]);return a;};e.max=function(a,b,c){a[0]=Math.max(b[0],c[0]);a[1]=Math.max(b[1],c[1]);return a;};e.scale=function(a,b,c){a[0]=b[0]*c;a[1]=b[1]*c;return a;};e.distance=function(a,b){var c=b[0]-a[0],d=b[1]-a[1];return Math.sqrt(c*c+d*d);};e.dist=e.distance;e.squaredDistance=function(a,b){var c=b[0]-a[0],d=b[1]-a[1];return c*c+d*d;};e.sqrDist=e.squaredDistance;e.length=function(a){var b=a[0],c=a[1];return Math.sqrt(b*b+c*c);};e.len=e.length;e.squaredLength=function(a){var b=a[0],c=a[1];return b*b+c*c;};e.sqrLen=e.squaredLength;e.negate=function(a,b){a[0]=-b[0];a[1]=-b[1];return a;};e.normalize=function(a,b){var c=b[0],d=b[1];var e=c*c+d*d;if(e>0){e=1/Math.sqrt(e);a[0]=b[0]*e;a[1]=b[1]*e;}return a;};e.dot=function(a,b){return a[0]*b[0]+a[1]*b[1];};e.cross=function(a,b,c){var d=b[0]*c[1]-b[1]*c[0];a[0]=a[1]=0;a[2]=d;return a;};e.lerp=function(a,b,c,d){var e=b[0],f=b[1];a[0]=e+d*(c[0]-e);a[1]=f+d*(c[1]-f);return a;};e.transformMat2=function(a,b,c){var d=b[0],e=b[1];a[0]=c[0]*d+c[2]*e;a[1]=c[1]*d+c[3]*e;return a;};e.transformMat2d=function(a,b,c){var d=b[0],e=b[1];a[0]=c[0]*d+c[2]*e+c[4];a[1]=c[1]*d+c[3]*e+c[5];return a;};e.transformMat3=function(a,b,c){var d=b[0],e=b[1];a[0]=c[0]*d+c[3]*e+c[6];a[1]=c[1]*d+c[4]*e+c[7];return a;};e.transformMat4=function(a,b,c){var d=b[0],e=b[1];a[0]=c[0]*d+c[4]*e+c[12];a[1]=c[1]*d+c[5]*e+c[13];return a;};e.forEach=(function(){var a=e.create();return function(b,c,d,e,f,g){var h,i;if(!c)c=2;if(!d)d=0;if(e)i=Math.min((e*c)+d,b.length);else i=b.length;for(h=d;h0){f=1/Math.sqrt(f);a[0]=b[0]*f;a[1]=b[1]*f;a[2]=b[2]*f;}return a;};f.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2];};f.cross=function(a,b,c){var d=b[0],e=b[1],f=b[2],g=c[0],h=c[1],i=c[2];a[0]=e*i-f*h;a[1]=f*g-d*i;a[2]=d*h-e*g;return a;};f.lerp=function(a,b,c,d){var e=b[0],f=b[1],g=b[2];a[0]=e+d*(c[0]-e);a[1]=f+d*(c[1]-f);a[2]=g+d*(c[2]-g);return a;};f.transformMat4=function(a,b,c){var d=b[0],e=b[1],f=b[2];a[0]=c[0]*d+c[4]*e+c[8]*f+c[12];a[1]=c[1]*d+c[5]*e+c[9]*f+c[13];a[2]=c[2]*d+c[6]*e+c[10]*f+c[14];return a;};f.transformQuat=function(a,b,c){var d=b[0],e=b[1],f=b[2],g=c[0],h=c[1],i=c[2],j=c[3],k=j*d+h*f-i*e,l=j*e+i*d-g*f,m=j*f+g*e-h*d,n=-g*d-h*e-i*f;a[0]=k*j+n*-g+l*-i-m*-h;a[1]=l*j+n*-h+m*-g-k*-i;a[2]=m*j+n*-i+k*-h-l*-g;return a;};f.forEach=(function(){var a=f.create();return function(b,c,d,e,f,g){var h,i;if(!c)c=3;if(!d)d=0;if(e)i=Math.min((e*c)+d,b.length);else i=b.length;for(h=d;h0){g=1/Math.sqrt(g);a[0]=b[0]*g;a[1]=b[1]*g;a[2]=b[2]*g;a[3]=b[3]*g;}return a;};g.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3];};g.lerp=function(a,b,c,d){var e=b[0],f=b[1],g=b[2],h=b[3];a[0]=e+d*(c[0]-e);a[1]=f+d*(c[1]-f);a[2]=g+d*(c[2]-g);a[3]=h+d*(c[3]-h);return a;};g.transformMat4=function(a,b,c){var d=b[0],e=b[1],f=b[2],g=b[3];a[0]=c[0]*d+c[4]*e+c[8]*f+c[12]*g;a[1]=c[1]*d+c[5]*e+c[9]*f+c[13]*g;a[2]=c[2]*d+c[6]*e+c[10]*f+c[14]*g;a[3]=c[3]*d+c[7]*e+c[11]*f+c[15]*g;return a;};g.transformQuat=function(a,b,c){var d=b[0],e=b[1],f=b[2],g=c[0],h=c[1],i=c[2],j=c[3],k=j*d+h*f-i*e,l=j*e+i*d-g*f,m=j*f+g*e-h*d,n=-g*d-h*e-i*f;a[0]=k*j+n*-g+l*-i-m*-h;a[1]=l*j+n*-h+m*-g-k*-i;a[2]=m*j+n*-i+k*-h-l*-g;return a;};g.forEach=(function(){var a=g.create();return function(b,c,d,e,f,g){var h,i;if(!c)c=4;if(!d)d=0;if(e)i=Math.min((e*c)+d,b.length);else i=b.length;for(h=d;h=1.0){if(a!==b){a[0]=e;a[1]=f;a[2]=g;a[3]=h;}return a;}n=Math.acos(m);o=Math.sqrt(1.0-m*m);if(Math.abs(o)<0.001){a[0]=(e*0.5+i*0.5);a[1]=(f*0.5+j*0.5);a[2]=(g*0.5+k*0.5);a[3]=(h*0.5+l*0.5);return a;}p=Math.sin((1-d)*n)/o;q=Math.sin(d*n)/o;a[0]=(e*p+i*q);a[1]=(f*p+j*q);a[2]=(g*p+k*q);a[3]=(h*p+l*q);return a;};p.invert=function(a,b){var c=b[0],d=b[1],e=b[2],f=b[3],g=c*c+d*d+e*e+f*f,h=g?1.0/g:0;a[0]=-c*h;a[1]=-d*h;a[2]=-e*h;a[3]=f*h;return a;};p.conjugate=function(a,b){a[0]=-b[0];a[1]=-b[1];a[2]=-b[2];a[3]=b[3];return a;};p.length=g.length;p.len=p.length;p.squaredLength=g.squaredLength;p.sqrLen=p.squaredLength;p.normalize=g.normalize;p.fromMat3=(function(){var a=[1,2,0];return function(b,c){var d=c[0]+c[4]+c[8];var e;if(d>0.0){e=Math.sqrt(d+1.0);b[3]=0.5*e;e=0.5/e;b[0]=(c[7]-c[5])*e;b[1]=(c[2]-c[6])*e;b[2]=(c[3]-c[1])*e;}else{var f=0;if(c[4]>c[0])f=1;if(c[8]>c[f*3+f])f=2;var g=a[f];var h=a[g];e=Math.sqrt(c[f*3+f]-c[g*3+g]-c[h*3+h]+1.0);b[f]=0.5*e;e=0.5/e;b[3]=(c[h*3+g]-c[g*3+h])*e;b[g]=(c[g*3+f]+c[f*3+g])*e;b[h]=(c[h*3+f]+c[f*3+h])*e;}return b;};})();p.str=function(a){return 'quat('+a[0]+', '+a[1]+', '+a[2]+', '+a[3]+')';};if(typeof a!=='undefined')a.quat=p;;})(a.exports);})();var dat=dat||{};dat.gui=dat.gui||{};dat.utils=dat.utils||{};dat.controllers=dat.controllers||{};dat.dom=dat.dom||{};dat.color=dat.color||{};dat.utils.css=function(){return{load:function(a,b){b=b||document;var c=b.createElement("link");c.type="text/css";c.rel="stylesheet";c.href=a;b.getElementsByTagName("head")[0].appendChild(c);},inject:function(a,b){b=b||document;var c=document.createElement("style");c.type="text/css";c.innerHTML=a;b.getElementsByTagName("head")[0].appendChild(c);}};}();dat.utils.common=function(){var a=Array.prototype.forEach,b=Array.prototype.slice;return{BREAK:{},extend:function(a){this.each(b.call(arguments,1),function(b){for(var c in b)this.isUndefined(b[c])||(a[c]=b[c]);},this);return a;},defaults:function(a){this.each(b.call(arguments,1),function(b){for(var c in b)this.isUndefined(a[c])&&(a[c]=b[c]);},this);return a;},compose:function(){var a=b.call(arguments);return function(){for(var c=b.call(arguments),d=a.length-1;0<=d;d--)c=[a[d].apply(this,c)];return c[0];};},each:function(b,c,d){if(b)if(a&&b.forEach&&b.forEach===a)b.forEach(c,d);else if(b.length===b.length+0)for(var e=0,f=b.length;ethis.__max&&(a=this.__max);void 0!==this.__step&&0!=a%this.__step&&(a=Math.round(a/this.__step)*this.__step);return d.superclass.prototype.setValue.call(this,a);},min:function(a){this.__min=a;return this;},max:function(a){this.__max=a;return this;},step:function(a){this.__impliedStep=this.__step=a;this.__precision=c(a);return this;}});return d;}(dat.controllers.Controller,dat.utils.common);dat.controllers.NumberControllerBox=function(a,b,c){var d=function(a,e,f){function g(){var a=parseFloat(j.__input.value);c.isNaN(a)||j.setValue(a);}function h(a){var b=k-a.clientY;j.setValue(j.getValue()+b*j.__impliedStep);k=a.clientY;}function i(){b.unbind(window,"mousemove",h);b.unbind(window,"mouseup",i);}this.__truncationSuspended=!1;d.superclass.call(this,a,e,f);var j=this,k;this.__input=document.createElement("input");this.__input.setAttribute("type","text");b.bind(this.__input,"change",g);b.bind(this.__input,"blur",function(){g();j.__onFinishChange&&j.__onFinishChange.call(j,j.getValue());});b.bind(this.__input,"mousedown",function(a){b.bind(window,"mousemove",h);b.bind(window,"mouseup",i);k=a.clientY;});b.bind(this.__input,"keydown",function(a){13===a.keyCode&&(j.__truncationSuspended=!0,this.blur(),j.__truncationSuspended=!1);});this.updateDisplay();this.domElement.appendChild(this.__input);};d.superclass=a;c.extend(d.prototype,a.prototype,{updateDisplay:function(){var a=this.__input,b;if(this.__truncationSuspended)b=this.getValue();else{b=this.getValue();var c=Math.pow(10,this.__precision);b=Math.round(b*c)/c;}a.value=b;return d.superclass.prototype.updateDisplay.call(this);}});return d;}(dat.controllers.NumberController,dat.dom.dom,dat.utils.common);dat.controllers.NumberControllerSlider=function(a,b,c,d,e){function f(a,b,c,d,e){return d+(a-b)/(c-b)*(e-d);}var g=function(a,c,d,e,h){function i(a){a.preventDefault();var c=b.getOffset(k.__background),d=b.getWidth(k.__background);k.setValue(f(a.clientX,c.left,c.left+d,k.__min,k.__max));return !1;}function j(){b.unbind(window,"mousemove",i);b.unbind(window,"mouseup",j);k.__onFinishChange&&k.__onFinishChange.call(k,k.getValue());}g.superclass.call(this,a,c,{min:d,max:e,step:h});var k=this;this.__background=document.createElement("div");this.__foreground=document.createElement("div");b.bind(this.__background,"mousedown",function(a){b.bind(window,"mousemove",i);b.bind(window,"mouseup",j);i(a);});b.addClass(this.__background,"slider");b.addClass(this.__foreground,"slider-fg");this.updateDisplay();this.__background.appendChild(this.__foreground);this.domElement.appendChild(this.__background);};g.superclass=a;g.useDefaultStyles=function(){c.inject(e);};d.extend(g.prototype,a.prototype,{updateDisplay:function(){var a=(this.getValue()-this.__min)/(this.__max-this.__min);this.__foreground.style.width=100*a+"%";return g.superclass.prototype.updateDisplay.call(this);}});return g;}(dat.controllers.NumberController,dat.dom.dom,dat.utils.css,dat.utils.common,"/**\n * dat-gui JavaScript Controller Library\n * http://code.google.com/p/dat-gui\n *\n * Copyright 2011 Data Arts Team, Google Creative Lab\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n */\n\n.slider {\n box-shadow: inset 0 2px 4px rgba(0,0,0,0.15);\n height: 1em;\n border-radius: 1em;\n background-color: #eee;\n padding: 0 0.5em;\n overflow: hidden;\n}\n\n.slider-fg {\n padding: 1px 0 2px 0;\n background-color: #aaa;\n height: 1em;\n margin-left: -0.5em;\n padding-right: 0.5em;\n border-radius: 1em 0 0 1em;\n}\n\n.slider-fg:after {\n display: inline-block;\n border-radius: 1em;\n background-color: #fff;\n border: 1px solid #aaa;\n content: '';\n float: right;\n margin-right: -1em;\n margin-top: -1px;\n height: 0.9em;\n width: 0.9em;\n}");dat.controllers.FunctionController=function(a,b,c){var d=function(a,c,e){d.superclass.call(this,a,c);var f=this;this.__button=document.createElement("div");this.__button.innerHTML=void 0===e?"Fire":e;b.bind(this.__button,"click",function(a){a.preventDefault();f.fire();return !1;});b.addClass(this.__button,"button");this.domElement.appendChild(this.__button);};d.superclass=a;c.extend(d.prototype,a.prototype,{fire:function(){this.__onChange&&this.__onChange.call(this);this.getValue().call(this.object);this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue());}});return d;}(dat.controllers.Controller,dat.dom.dom,dat.utils.common);dat.controllers.BooleanController=function(a,b,c){var d=function(a,c){d.superclass.call(this,a,c);var e=this;this.__prev=this.getValue();this.__checkbox=document.createElement("input");this.__checkbox.setAttribute("type","checkbox");b.bind(this.__checkbox,"change",function(){e.setValue(!e.__prev);},!1);this.domElement.appendChild(this.__checkbox);this.updateDisplay();};d.superclass=a;c.extend(d.prototype,a.prototype,{setValue:function(a){a=d.superclass.prototype.setValue.call(this,a);this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue());this.__prev=this.getValue();return a;},updateDisplay:function(){!0===this.getValue()?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=!0):this.__checkbox.checked=!1;return d.superclass.prototype.updateDisplay.call(this);}});return d;}(dat.controllers.Controller,dat.dom.dom,dat.utils.common);dat.color.toString=function(a){return function(b){if(1==b.a||a.isUndefined(b.a)){for(b=b.hex.toString(16);6>b.length;)b="0"+b;return "#"+b;}return "rgba("+Math.round(b.r)+","+Math.round(b.g)+","+Math.round(b.b)+","+b.a+")";};}(dat.utils.common);dat.color.interpret=function(a,b){var c,d,e=[{litmus:b.isString,conversions:{THREE_CHAR_HEX:{read:function(a){a=a.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return null===a?!1:{space:"HEX",hex:parseInt("0x"+a[1].toString()+a[1].toString()+a[2].toString()+a[2].toString()+a[3].toString()+a[3].toString())};},write:a},SIX_CHAR_HEX:{read:function(a){a=a.match(/^#([A-F0-9]{6})$/i);return null===a?!1:{space:"HEX",hex:parseInt("0x"+a[1].toString())};},write:a},CSS_RGB:{read:function(a){a=a.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null===a?!1:{space:"RGB",r:parseFloat(a[1]),g:parseFloat(a[2]),b:parseFloat(a[3])};},write:a},CSS_RGBA:{read:function(a){a=a.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\,\s*(.+)\s*\)/);return null===a?!1:{space:"RGB",r:parseFloat(a[1]),g:parseFloat(a[2]),b:parseFloat(a[3]),a:parseFloat(a[4])};},write:a}}},{litmus:b.isNumber,conversions:{HEX:{read:function(a){return{space:"HEX",hex:a,conversionName:"HEX"};},write:function(a){return a.hex;}}}},{litmus:b.isArray,conversions:{RGB_ARRAY:{read:function(a){return 3!=a.length?!1:{space:"RGB",r:a[0],g:a[1],b:a[2]};},write:function(a){return [a.r,a.g,a.b];}},RGBA_ARRAY:{read:function(a){return 4!=a.length?!1:{space:"RGB",r:a[0],g:a[1],b:a[2],a:a[3]};},write:function(a){return [a.r,a.g,a.b,a.a];}}}},{litmus:b.isObject,conversions:{RGBA_OBJ:{read:function(a){return b.isNumber(a.r)&&b.isNumber(a.g)&&b.isNumber(a.b)&&b.isNumber(a.a)?{space:"RGB",r:a.r,g:a.g,b:a.b,a:a.a}:!1;},write:function(a){return{r:a.r,g:a.g,b:a.b,a:a.a};}},RGB_OBJ:{read:function(a){return b.isNumber(a.r)&&b.isNumber(a.g)&&b.isNumber(a.b)?{space:"RGB",r:a.r,g:a.g,b:a.b}:!1;},write:function(a){return{r:a.r,g:a.g,b:a.b};}},HSVA_OBJ:{read:function(a){return b.isNumber(a.h)&&b.isNumber(a.s)&&b.isNumber(a.v)&&b.isNumber(a.a)?{space:"HSV",h:a.h,s:a.s,v:a.v,a:a.a}:!1;},write:function(a){return{h:a.h,s:a.s,v:a.v,a:a.a};}},HSV_OBJ:{read:function(a){return b.isNumber(a.h)&&b.isNumber(a.s)&&b.isNumber(a.v)?{space:"HSV",h:a.h,s:a.s,v:a.v}:!1;},write:function(a){return{h:a.h,s:a.s,v:a.v};}}}}];return function(){d=!1;var a=1\n\n Here\'s the new load parameter for your GUI\'s constructor:\n\n \n\n
\n\n Automatically save\n values to localStorage on exit.\n\n
The values saved to localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n \n