made with requirebin
Last active
August 29, 2015 14:16
-
-
Save thibauts/6eb409a66795f44b5413 to your computer and use it in GitHub Desktop.
requirebin sketch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var shell = require('gl-now')(); | |
var bunny = require('bunny'); | |
var normals = require('normals'); | |
var createGeometry = require('gl-geometry'); | |
var createShader = require('gl-shader'); | |
var mat4 = require('gl-matrix').mat4; | |
var RBF = require('rbf'); | |
var geom, shader, start, warped; | |
var vertexShader = ' \ | |
attribute vec3 position; \ | |
attribute vec3 normal ; \ | |
uniform mat4 mv; \ | |
uniform mat4 proj; \ | |
varying vec3 v_normal; \ | |
varying vec3 v_position; \ | |
\ | |
void main() { \ | |
gl_Position = proj * mv * vec4(position, 1.0); \ | |
v_normal = vec3(mv * vec4(normal, 0.0)); \ | |
v_position = vec3(mv * vec4(position, 1.0)); \ | |
} \ | |
' | |
var fragmentShader = ' \ | |
precision mediump float; \ | |
uniform vec3 ambient; \ | |
uniform vec3 diffuse; \ | |
varying vec3 v_normal; \ | |
varying vec3 v_position; \ | |
\ | |
void main() { \ | |
vec3 N = normalize(v_normal); \ | |
vec3 E = normalize(- v_position); \ | |
float f = max(dot(N, E), 0.0); \ | |
gl_FragColor = vec4(ambient + diffuse * f, 1.0); \ | |
} \ | |
'; | |
shell.on('gl-init', function() { | |
var gl = shell.gl; | |
gl.enable(gl.DEPTH_TEST); | |
var far = 1e6; | |
var points = [ | |
// make space stable | |
[-far, 0, 0], | |
[0, -far, 0], | |
[0, 0, -far], | |
[far, 0, 0], | |
[0, far, 0], | |
[0, 0, far], | |
// fixed | |
[-3.83, 7.51, 2.43], // forehead | |
[-1.044, 8.22, 0.03], // left hear middle | |
[-3.76, 7.41, -0.68], // right ear base | |
[2.57, 5.86, 1.15], // middle back | |
// displaced | |
[-4.594316, 5.771342, 3.01694], // nose tip | |
[0.19, 9.50, -1.48], // left ear tip | |
[-3.45, 9.05, -3.35], // right ear tip | |
[4.83, 1.37, 0.84], // tail tip | |
[3.91, 3.81, 1.35], // back back | |
]; | |
var displaced = [ | |
// make space stable | |
[-far, 0, 0], | |
[0, -far, 0], | |
[0, 0, -far], | |
[far, 0, 0], | |
[0, far, 0], | |
[0, 0, far], | |
// fixed | |
[-3.83, 7.51, 2.43], // forehead | |
[-1.044, 8.22, 0.03], // left hear middle | |
[-3.76, 7.41, -0.68], // right ear base | |
[2.57, 5.86, 1.15], // middle back | |
// displaced | |
[-4.594316, 5.771342, 4.01694], // nose tip | |
[0.19, 7.50, -1.48], // left ear tip | |
[-2.45, 9.05, -2.35], // right ear tip | |
[7.83, 1.37, 0.84], // tail tip | |
[2.41, 3.81, 1.35], // back back | |
]; | |
valuesX = displaced.map(function(p) { return p[0]; }); | |
valuesY = displaced.map(function(p) { return p[1]; }); | |
valuesZ = displaced.map(function(p) { return p[2]; }); | |
var rbfX = new RBF(points, valuesX); | |
var rbfY = new RBF(points, valuesY); | |
var rbfZ = new RBF(points, valuesZ); | |
warped = bunny.positions.map(function(position) { | |
return [ | |
rbfX(position), | |
rbfY(position), | |
rbfZ(position), | |
]; | |
}); | |
bunny.normals = normals.vertexNormals(bunny.cells, bunny.positions); | |
geom = createGeometry(shell.gl) | |
.attr('position', bunny.positions) | |
.attr('normal', bunny.normals) | |
.faces(bunny.cells); | |
shader = createShader(shell.gl, vertexShader, fragmentShader); | |
start = performance.now(); | |
}); | |
shell.on('gl-render', function() { | |
var t = performance.now() - start; | |
shader.bind(); | |
var proj = mat4.create(); | |
mat4.perspective(proj, Math.PI / 4, shell.width / shell.height, 0.1, 1000); | |
var mv = mat4.create(); | |
mat4.lookAt(mv, [0, 0, 20], [0, 4, 0], [0, 1, 0]); | |
mat4.rotateX(mv, mv, Math.PI / 6); | |
mat4.rotateY(mv, mv, 2 * Math.PI * (t / 1000) / 20 * -1); | |
var mesh = { | |
cells: bunny.cells, | |
positions: lerpPositions(bunny.positions, warped, Math.sin(2 * Math.PI * t / 1000 * 0.5)) | |
}; | |
mesh.normals = normals.vertexNormals(mesh.cells, mesh.positions); | |
geom.dispose(); | |
geom = createGeometry(shell.gl) | |
.attr('position', mesh.positions) | |
.attr('normal', mesh.normals) | |
.faces(mesh.cells); | |
geom.bind(shader); | |
shader.uniforms.proj = proj; | |
shader.uniforms.mv = mv; | |
shader.uniforms.ambient = [0.5, 0.5, 0.5]; | |
shader.uniforms.diffuse = [0.5, 0.5, 0.5]; | |
var gl = shell.gl; | |
gl.clearColor(1.0, 1.0, 1.0, 1.0); | |
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); | |
geom.draw(); | |
}); | |
function lerpPositions(a, b, t) { | |
var c = new Array(a.length); | |
for(var i=0; i<a.length; i++) { | |
c[i] = lerp(a[i], b[i], t); | |
} | |
return c; | |
} | |
function lerp(a, b, t) { | |
var c = new Array(a.length); | |
for(var i=0; i<a.length; i++) { | |
c[i] = a[i] * t + b[i] * (1 - t); | |
} | |
return c; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){function EventEmitter(){this._events=this._events||{};this._maxListeners=this._maxListeners||undefined}module.exports=EventEmitter;EventEmitter.EventEmitter=EventEmitter;EventEmitter.prototype._events=undefined;EventEmitter.prototype._maxListeners=undefined;EventEmitter.defaultMaxListeners=10;EventEmitter.prototype.setMaxListeners=function(n){if(!isNumber(n)||n<0||isNaN(n))throw TypeError("n must be a positive number");this._maxListeners=n;return this};EventEmitter.prototype.emit=function(type){var er,handler,len,args,i,listeners;if(!this._events)this._events={};if(type==="error"){if(!this._events.error||isObject(this._events.error)&&!this._events.error.length){er=arguments[1];if(er instanceof Error){throw er}throw TypeError('Uncaught, unspecified "error" event.')}}handler=this._events[type];if(isUndefined(handler))return false;if(isFunction(handler)){switch(arguments.length){case 1:handler.call(this);break;case 2:handler.call(this,arguments[1]);break;case 3:handler.call(this,arguments[1],arguments[2]);break;default:len=arguments.length;args=new Array(len-1);for(i=1;i<len;i++)args[i-1]=arguments[i];handler.apply(this,args)}}else if(isObject(handler)){len=arguments.length;args=new Array(len-1);for(i=1;i<len;i++)args[i-1]=arguments[i];listeners=handler.slice();len=listeners.length;for(i=0;i<len;i++)listeners[i].apply(this,args)}return true};EventEmitter.prototype.addListener=function(type,listener){var m;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events)this._events={};if(this._events.newListener)this.emit("newListener",type,isFunction(listener.listener)?listener.listener:listener);if(!this._events[type])this._events[type]=listener;else if(isObject(this._events[type]))this._events[type].push(listener);else this._events[type]=[this._events[type],listener];if(isObject(this._events[type])&&!this._events[type].warned){var m;if(!isUndefined(this._maxListeners)){m=this._maxListeners}else{m=EventEmitter.defaultMaxListeners}if(m&&m>0&&this._events[type].length>m){this._events[type].warned=true;console.error("(node) warning: possible EventEmitter memory "+"leak detected. %d listeners added. "+"Use emitter.setMaxListeners() to increase limit.",this._events[type].length);if(typeof console.trace==="function"){console.trace()}}}return this};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.once=function(type,listener){if(!isFunction(listener))throw TypeError("listener must be a function");var fired=false;function g(){this.removeListener(type,g);if(!fired){fired=true;listener.apply(this,arguments)}}g.listener=listener;this.on(type,g);return this};EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events||!this._events[type])return this;list=this._events[type];length=list.length;position=-1;if(list===listener||isFunction(list.listener)&&list.listener===listener){delete this._events[type];if(this._events.removeListener)this.emit("removeListener",type,listener)}else if(isObject(list)){for(i=length;i-->0;){if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}}if(position<0)return this;if(list.length===1){list.length=0;delete this._events[type]}else{list.splice(position,1)}if(this._events.removeListener)this.emit("removeListener",type,listener)}return this};EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener){if(arguments.length===0)this._events={};else if(this._events[type])delete this._events[type];return this}if(arguments.length===0){for(key in this._events){if(key==="removeListener")continue;this.removeAllListeners(key)}this.removeAllListeners("removeListener");this._events={};return this}listeners=this._events[type];if(isFunction(listeners)){this.removeListener(type,listeners)}else{while(listeners.length)this.removeListener(type,listeners[listeners.length-1])}delete this._events[type];return this};EventEmitter.prototype.listeners=function(type){var ret;if(!this._events||!this._events[type])ret=[];else if(isFunction(this._events[type]))ret=[this._events[type]];else ret=this._events[type].slice();return ret};EventEmitter.listenerCount=function(emitter,type){var ret;if(!emitter._events||!emitter._events[type])ret=0;else if(isFunction(emitter._events[type]))ret=1;else ret=emitter._events[type].length;return ret};function isFunction(arg){return typeof arg==="function"}function isNumber(arg){return typeof arg==="number"}function isObject(arg){return typeof arg==="object"&&arg!==null}function isUndefined(arg){return arg===void 0}},{}],2:[function(require,module,exports){if(typeof Object.create==="function"){module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}})}}else{module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor;ctor.prototype.constructor=ctor}}},{}],3:[function(require,module,exports){var process=module.exports={};process.nextTick=function(){var canSetImmediate=typeof window!=="undefined"&&window.setImmediate;var canMutationObserver=typeof window!=="undefined"&&window.MutationObserver;var canPost=typeof window!=="undefined"&&window.postMessage&&window.addEventListener;if(canSetImmediate){return function(f){return window.setImmediate(f)}}var queue=[];if(canMutationObserver){var hiddenDiv=document.createElement("div");var observer=new MutationObserver(function(){var queueList=queue.slice();queue.length=0;queueList.forEach(function(fn){fn()})});observer.observe(hiddenDiv,{attributes:true});return function nextTick(fn){if(!queue.length){hiddenDiv.setAttribute("yes","no")}queue.push(fn)}}if(canPost){window.addEventListener("message",function(ev){var source=ev.source;if((source===window||source===null)&&ev.data==="process-tick"){ev.stopPropagation();if(queue.length>0){var fn=queue.shift();fn()}}},true);return function nextTick(fn){queue.push(fn);window.postMessage("process-tick","*")}}return function nextTick(fn){setTimeout(fn,0)}}();process.title="browser";process.browser=true;process.env={};process.argv=[];function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")}},{}],4:[function(require,module,exports){module.exports=function isBuffer(arg){return arg&&typeof arg==="object"&&typeof arg.copy==="function"&&typeof arg.fill==="function"&&typeof arg.readUInt8==="function"}},{}],5:[function(require,module,exports){(function(process,global){var formatRegExp=/%[sdj%]/g;exports.format=function(f){if(!isString(f)){var objects=[];for(var i=0;i<arguments.length;i++){objects.push(inspect(arguments[i]))}return objects.join(" ")}var i=1;var args=arguments;var len=args.length;var str=String(f).replace(formatRegExp,function(x){if(x==="%%")return"%";if(i>=len)return x;switch(x){case"%s":return String(args[i++]);case"%d":return Number(args[i++]);case"%j":try{return JSON.stringify(args[i++])}catch(_){return"[Circular]"}default:return x}});for(var x=args[i];i<len;x=args[++i]){if(isNull(x)||!isObject(x)){str+=" "+x}else{str+=" "+inspect(x)}}return str};exports.deprecate=function(fn,msg){if(isUndefined(global.process)){return function(){return exports.deprecate(fn,msg).apply(this,arguments)}}if(process.noDeprecation===true){return fn}var warned=false;function deprecated(){if(!warned){if(process.throwDeprecation){throw new Error(msg)}else if(process.traceDeprecation){console.trace(msg)}else{console.error(msg)}warned=true}return fn.apply(this,arguments)}return deprecated};var debugs={};var debugEnviron;exports.debuglog=function(set){if(isUndefined(debugEnviron))debugEnviron=process.env.NODE_DEBUG||"";set=set.toUpperCase();if(!debugs[set]){if(new RegExp("\\b"+set+"\\b","i").test(debugEnviron)){var pid=process.pid;debugs[set]=function(){var msg=exports.format.apply(exports,arguments);console.error("%s %d: %s",set,pid,msg)}}else{debugs[set]=function(){}}}return debugs[set]};function inspect(obj,opts){var ctx={seen:[],stylize:stylizeNoColor};if(arguments.length>=3)ctx.depth=arguments[2];if(arguments.length>=4)ctx.colors=arguments[3];if(isBoolean(opts)){ctx.showHidden=opts}else if(opts){exports._extend(ctx,opts)}if(isUndefined(ctx.showHidden))ctx.showHidden=false;if(isUndefined(ctx.depth))ctx.depth=2;if(isUndefined(ctx.colors))ctx.colors=false;if(isUndefined(ctx.customInspect))ctx.customInspect=true;if(ctx.colors)ctx.stylize=stylizeWithColor;return formatValue(ctx,obj,ctx.depth)}exports.inspect=inspect;inspect.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};inspect.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"};function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];if(style){return"["+inspect.colors[style][0]+"m"+str+"["+inspect.colors[style][1]+"m"}else{return str}}function stylizeNoColor(str,styleType){return str}function arrayToHash(array){var hash={};array.forEach(function(val,idx){hash[val]=true});return hash}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==exports.inspect&&!(value.constructor&&value.constructor.prototype===value)){var ret=value.inspect(recurseTimes,ctx);if(!isString(ret)){ret=formatValue(ctx,ret,recurseTimes)}return ret}var primitive=formatPrimitive(ctx,value);if(primitive){return primitive}var keys=Object.keys(value);var visibleKeys=arrayToHash(keys);if(ctx.showHidden){keys=Object.getOwnPropertyNames(value)}if(isError(value)&&(keys.indexOf("message")>=0||keys.indexOf("description")>=0)){return formatError(value)}if(keys.length===0){if(isFunction(value)){var name=value.name?": "+value.name:"";return ctx.stylize("[Function"+name+"]","special")}if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),"regexp")}if(isDate(value)){return ctx.stylize(Date.prototype.toString.call(value),"date")}if(isError(value)){return formatError(value)}}var base="",array=false,braces=["{","}"];if(isArray(value)){array=true;braces=["[","]"]}if(isFunction(value)){var n=value.name?": "+value.name:"";base=" [Function"+n+"]"}if(isRegExp(value)){base=" "+RegExp.prototype.toString.call(value)}if(isDate(value)){base=" "+Date.prototype.toUTCString.call(value)}if(isError(value)){base=" "+formatError(value)}if(keys.length===0&&(!array||value.length==0)){return braces[0]+base+braces[1]}if(recurseTimes<0){if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),"regexp")}else{return ctx.stylize("[Object]","special")}}ctx.seen.push(value);var output;if(array){output=formatArray(ctx,value,recurseTimes,visibleKeys,keys)}else{output=keys.map(function(key){return formatProperty(ctx,value,recurseTimes,visibleKeys,key,array)})}ctx.seen.pop();return reduceToSingleString(output,base,braces)}function formatPrimitive(ctx,value){if(isUndefined(value))return ctx.stylize("undefined","undefined");if(isString(value)){var simple="'"+JSON.stringify(value).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return ctx.stylize(simple,"string")}if(isNumber(value))return ctx.stylize(""+value,"number");if(isBoolean(value))return ctx.stylize(""+value,"boolean");if(isNull(value))return ctx.stylize("null","null")}function formatError(value){return"["+Error.prototype.toString.call(value)+"]"}function formatArray(ctx,value,recurseTimes,visibleKeys,keys){var output=[];for(var i=0,l=value.length;i<l;++i){if(hasOwnProperty(value,String(i))){output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,String(i),true))}else{output.push("")}}keys.forEach(function(key){if(!key.match(/^\d+$/)){output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,key,true))}});return output}function formatProperty(ctx,value,recurseTimes,visibleKeys,key,array){var name,str,desc;desc=Object.getOwnPropertyDescriptor(value,key)||{value:value[key]};if(desc.get){if(desc.set){str=ctx.stylize("[Getter/Setter]","special")}else{str=ctx.stylize("[Getter]","special")}}else{if(desc.set){str=ctx.stylize("[Setter]","special")}}if(!hasOwnProperty(visibleKeys,key)){name="["+key+"]"}if(!str){if(ctx.seen.indexOf(desc.value)<0){if(isNull(recurseTimes)){str=formatValue(ctx,desc.value,null)}else{str=formatValue(ctx,desc.value,recurseTimes-1)}if(str.indexOf("\n")>-1){if(array){str=str.split("\n").map(function(line){return" "+line}).join("\n").substr(2)}else{str="\n"+str.split("\n").map(function(line){return" "+line}).join("\n")}}}else{str=ctx.stylize("[Circular]","special")}}if(isUndefined(name)){if(array&&key.match(/^\d+$/)){return str}name=JSON.stringify(""+key);if(name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)){name=name.substr(1,name.length-2);name=ctx.stylize(name,"name")}else{name=name.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'");name=ctx.stylize(name,"string")}}return name+": "+str}function reduceToSingleString(output,base,braces){var numLinesEst=0;var length=output.reduce(function(prev,cur){numLinesEst++;if(cur.indexOf("\n")>=0)numLinesEst++;return prev+cur.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(length>60){return braces[0]+(base===""?"":base+"\n ")+" "+output.join(",\n ")+" "+braces[1]}return braces[0]+base+" "+output.join(", ")+" "+braces[1]}function isArray(ar){return Array.isArray(ar)}exports.isArray=isArray;function isBoolean(arg){return typeof arg==="boolean"}exports.isBoolean=isBoolean;function isNull(arg){return arg===null}exports.isNull=isNull;function isNullOrUndefined(arg){return arg==null}exports.isNullOrUndefined=isNullOrUndefined;function isNumber(arg){return typeof arg==="number"}exports.isNumber=isNumber;function isString(arg){return typeof arg==="string"}exports.isString=isString;function isSymbol(arg){return typeof arg==="symbol"}exports.isSymbol=isSymbol;function isUndefined(arg){return arg===void 0}exports.isUndefined=isUndefined;function isRegExp(re){return isObject(re)&&objectToString(re)==="[object RegExp]"}exports.isRegExp=isRegExp;function isObject(arg){return typeof arg==="object"&&arg!==null}exports.isObject=isObject;function isDate(d){return isObject(d)&&objectToString(d)==="[object Date]"}exports.isDate=isDate;function isError(e){return isObject(e)&&(objectToString(e)==="[object Error]"||e instanceof Error)}exports.isError=isError;function isFunction(arg){return typeof arg==="function"}exports.isFunction=isFunction;function isPrimitive(arg){return arg===null||typeof arg==="boolean"||typeof arg==="number"||typeof arg==="string"||typeof arg==="symbol"||typeof arg==="undefined"}exports.isPrimitive=isPrimitive;exports.isBuffer=require("./support/isBuffer");function objectToString(o){return Object.prototype.toString.call(o)}function pad(n){return n<10?"0"+n.toString(10):n.toString(10)}var months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function timestamp(){var d=new Date;var time=[pad(d.getHours()),pad(d.getMinutes()),pad(d.getSeconds())].join(":");return[d.getDate(),months[d.getMonth()],time].join(" ")}exports.log=function(){console.log("%s - %s",timestamp(),exports.format.apply(exports,arguments))};exports.inherits=require("inherits");exports._extend=function(origin,add){if(!add||!isObject(add))return origin;var keys=Object.keys(add);var i=keys.length;while(i--){origin[keys[i]]=add[keys[i]]}return origin};function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}}).call(this,require("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./support/isBuffer":4,_process:3,inherits:2}],6:[function(require,module,exports){if(typeof window.performance==="object"){if(window.performance.now){module.exports=function(){return window.performance.now()}}else if(window.performance.webkitNow){module.exports=function(){return window.performance.webkitNow()}}}else if(Date.now){module.exports=Date.now}else{module.exports=function(){return(new Date).getTime()}}},{}],7:[function(require,module,exports){var prefix="",_addEventListener,onwheel,support;if(window.addEventListener){_addEventListener="addEventListener"}else{_addEventListener="attachEvent";prefix="on"}support="onwheel"in document.createElement("div")?"wheel":document.onmousewheel!==undefined?"mousewheel":"DOMMouseScroll";function _addWheelListener(elem,eventName,callback,useCapture){elem[_addEventListener](prefix+eventName,support=="wheel"?callback:function(originalEvent){!originalEvent&&(originalEvent=window.event);var event={originalEvent:originalEvent,target:originalEvent.target||originalEvent.srcElement,type:"wheel",deltaMode:originalEvent.type=="MozMousePixelScroll"?0:1,deltaX:0,delatZ:0,preventDefault:function(){originalEvent.preventDefault?originalEvent.preventDefault():originalEvent.returnValue=false}};if(support=="mousewheel"){event.deltaY=-1/40*originalEvent.wheelDelta;originalEvent.wheelDeltaX&&(event.deltaX=-1/40*originalEvent.wheelDeltaX)}else{event.deltaY=originalEvent.detail}return callback(event)},useCapture||false)}module.exports=function(elem,callback,useCapture){_addWheelListener(elem,support,callback,useCapture);if(support=="DOMMouseScroll"){_addWheelListener(elem,"MozMousePixelScroll",callback,useCapture)}}},{}],8:[function(require,module,exports){var lastTime=0;var vendors=["ms","moz","webkit","o"];for(var x=0;x<vendors.length&&!window.requestAnimationFrame;++x){window.requestAnimationFrame=window[vendors[x]+"RequestAnimationFrame"];window.cancelAnimationFrame=window[vendors[x]+"CancelAnimationFrame"]||window[vendors[x]+"CancelRequestAnimationFrame"]}if(!window.requestAnimationFrame)window.requestAnimationFrame=function(callback,element){var currTime=(new Date).getTime();var timeToCall=Math.max(0,16-(currTime-lastTime));var id=window.setTimeout(function(){callback(currTime+timeToCall)},timeToCall);lastTime=currTime+timeToCall;return id};if(!window.cancelAnimationFrame)window.cancelAnimationFrame=function(id){clearTimeout(id)}},{}],9:[function(require,module,exports){"use strict";function compileSearch(funcName,predicate,reversed,extraArgs,useNdarray,earlyOut){var code=["function ",funcName,"(a,l,h,",extraArgs.join(","),"){",earlyOut?"":"var i=",reversed?"l-1":"h+1",";while(l<=h){var m=(l+h)>>>1,x=a",useNdarray?".get(m)":"[m]"];if(earlyOut){if(predicate.indexOf("c")<0){code.push(";if(x===y){return m}else if(x<=y){")}else{code.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){")}}else{code.push(";if(",predicate,"){i=m;")}if(reversed){code.push("l=m+1}else{h=m-1}")}else{code.push("h=m-1}else{l=m+1}")}code.push("}");if(earlyOut){code.push("return -1};")}else{code.push("return i};")}return code.join("")}function compileBoundsSearch(predicate,reversed,suffix,earlyOut){var result=new Function([compileSearch("A","x"+predicate+"y",reversed,["y"],false,earlyOut),compileSearch("B","x"+predicate+"y",reversed,["y"],true,earlyOut),compileSearch("P","c(x,y)"+predicate+"0",reversed,["y","c"],false,earlyOut),compileSearch("Q","c(x,y)"+predicate+"0",reversed,["y","c"],true,earlyOut),"function dispatchBsearch",suffix,"(a,y,c,l,h){if(a.shape){if(typeof(c)==='function'){return Q(a,(l===undefined)?0:l|0,(h===undefined)?a.shape[0]-1:h|0,y,c)}else{return B(a,(c===undefined)?0:c|0,(l===undefined)?a.shape[0]-1:l|0,y)}}else{if(typeof(c)==='function'){return P(a,(l===undefined)?0:l|0,(h===undefined)?a.length-1:h|0,y,c)}else{return A(a,(c===undefined)?0:c|0,(l===undefined)?a.length-1:l|0,y)}}}return dispatchBsearch",suffix].join(""));return result()}module.exports={ge:compileBoundsSearch(">=",false,"GE"),gt:compileBoundsSearch(">",false,"GT"),lt:compileBoundsSearch("<",true,"LT"),le:compileBoundsSearch("<=",true,"LE"),eq:compileBoundsSearch("-",true,"EQ",true)}},{}],10:[function(require,module,exports){!function(name,definition){if(typeof module!="undefined")module.exports=definition();else if(typeof define=="function"&&typeof define.amd=="object")define(definition);else this[name]=definition()}("domready",function(){var fns=[],listener,doc=document,hack=doc.documentElement.doScroll,domContentLoaded="DOMContentLoaded",loaded=(hack?/^loaded|^c/:/^loaded|^i|^c/).test(doc.readyState);if(!loaded)doc.addEventListener(domContentLoaded,listener=function(){doc.removeEventListener(domContentLoaded,listener);loaded=1;while(listener=fns.shift())listener()});return function(fn){loaded?fn():fns.push(fn)}})},{}],11:[function(require,module,exports){"use strict";function invert(hash){var result={};for(var i in hash){if(hash.hasOwnProperty(i)){result[hash[i]]=i}}return result}module.exports=invert},{}],12:[function(require,module,exports){"use strict";function iota(n){var result=new Array(n);for(var i=0;i<n;++i){result[i]=i}return result}module.exports=iota},{}],13:[function(require,module,exports){"use strict";function unique_pred(list,compare){var ptr=1,len=list.length,a=list[0],b=list[0];for(var i=1;i<len;++i){b=a;a=list[i];if(compare(a,b)){if(i===ptr){ptr++;continue}list[ptr++]=a}}list.length=ptr;return list}function unique_eq(list){var ptr=1,len=list.length,a=list[0],b=list[0];for(var i=1;i<len;++i,b=a){b=a;a=list[i];if(a!==b){if(i===ptr){ptr++;continue}list[ptr++]=a}}list.length=ptr;return list}function unique(list,compare,sorted){if(list.length===0){return list}if(compare){if(!sorted){list.sort(compare)}return unique_pred(list,compare)}if(!sorted){list.sort()}return unique_eq(list)}module.exports=unique},{}],14:[function(require,module,exports){var ua=typeof window!=="undefined"?window.navigator.userAgent:"",isOSX=/OS X/.test(ua),isOpera=/Opera/.test(ua),maybeFirefox=!/like Gecko/.test(ua)&&!isOpera;var i,output=module.exports={0:isOSX?"<menu>":"<UNK>",1:"<mouse 1>",2:"<mouse 2>",3:"<break>",4:"<mouse 3>",5:"<mouse 4>",6:"<mouse 5>",8:"<backspace>",9:"<tab>",12:"<clear>",13:"<enter>",16:"<shift>",17:"<control>",18:"<alt>",19:"<pause>",20:"<caps-lock>",21:"<ime-hangul>",23:"<ime-junja>",24:"<ime-final>",25:"<ime-kanji>",27:"<escape>",28:"<ime-convert>",29:"<ime-nonconvert>",30:"<ime-accept>",31:"<ime-mode-change>",27:"<escape>",32:"<space>",33:"<page-up>",34:"<page-down>",35:"<end>",36:"<home>",37:"<left>",38:"<up>",39:"<right>",40:"<down>",41:"<select>",42:"<print>",43:"<execute>",44:"<snapshot>",45:"<insert>",46:"<delete>",47:"<help>",91:"<meta>",92:"<meta>",93:isOSX?"<meta>":"<menu>",95:"<sleep>",106:"<num-*>",107:"<num-+>",108:"<num-enter>",109:"<num-->",110:"<num-.>",111:"<num-/>",144:"<num-lock>",145:"<scroll-lock>",160:"<shift-left>",161:"<shift-right>",162:"<control-left>",163:"<control-right>",164:"<alt-left>",165:"<alt-right>",166:"<browser-back>",167:"<browser-forward>",168:"<browser-refresh>",169:"<browser-stop>",170:"<browser-search>",171:"<browser-favorites>",172:"<browser-home>",173:isOSX&&maybeFirefox?"-":"<volume-mute>",174:"<volume-down>",175:"<volume-up>",176:"<next-track>",177:"<prev-track>",178:"<stop>",179:"<play-pause>",180:"<launch-mail>",181:"<launch-media-select>",182:"<launch-app 1>",183:"<launch-app 2>",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",223:"<meta>",224:"<meta>",226:"<alt-gr>",229:"<ime-process>",231:isOpera?"`":"<unicode>",246:"<attention>",247:"<crsel>",248:"<exsel>",249:"<erase-eof>",250:"<play>",251:"<zoom>",252:"<no-name>",253:"<pa-1>",254:"<clear>"};for(i=58;i<65;++i){output[i]=String.fromCharCode(i)}for(i=48;i<58;++i){output[i]=i-48+""}for(i=65;i<91;++i){output[i]=String.fromCharCode(i)}for(i=96;i<106;++i){output[i]="<num-"+(i-96)+">"}for(i=112;i<136;++i){output[i]="F"+(i-111)}},{}],15:[function(require,module,exports){"use strict";var EventEmitter=require("events").EventEmitter,util=require("util"),domready=require("domready"),vkey=require("vkey"),invert=require("invert-hash"),uniq=require("uniq"),bsearch=require("binary-search-bounds"),iota=require("iota-array"),min=Math.min;require("./lib/raf-polyfill.js");var addMouseWheel=require("./lib/mousewheel-polyfill.js");var hrtime=require("./lib/hrtime-polyfill.js");var filtered_vkey=function(){var result=new Array(256),i,j,k;for(i=0;i<256;++i){result[i]="UNK"}for(i in vkey){k=vkey[i];if(k.charAt(0)==="<"&&k.charAt(k.length-1)===">"){k=k.substring(1,k.length-1)}k=k.replace(/\s/g,"-");result[parseInt(i)]=k}return result}();var keyNames=uniq(Object.keys(invert(filtered_vkey)));function virtualKeyCode(key){return bsearch.eq(keyNames,key)}function physicalKeyCode(key){return virtualKeyCode(filtered_vkey[key])}function GameShell(){EventEmitter.call(this);this._curKeyState=new Array(keyNames.length);this._pressCount=new Array(keyNames.length);this._releaseCount=new Array(keyNames.length);this._tickInterval=null;this._rafHandle=null;this._tickRate=0;this._lastTick=hrtime();this._frameTime=0;this._paused=true;this._width=0;this._height=0;this._wantFullscreen=false;this._wantPointerLock=false;this._fullscreenActive=false;this._pointerLockActive=false;this._render=render.bind(undefined,this);this.preventDefaults=true;this.stopPropagation=false;for(var i=0;i<keyNames.length;++i){this._curKeyState[i]=false;this._pressCount[i]=this._releaseCount[i]=0}this.element=null;this.bindings={};this.frameSkip=100;this.tickCount=0;this.frameCount=0;this.startTime=hrtime();this.tickTime=this._tickRate;this.frameTime=10;this.stickyFullscreen=false;this.stickyPointLock=false;this.scroll=[0,0,0];this.mouseX=0;this.mouseY=0;this.prevMouseX=0;this.prevMouseY=0}util.inherits(GameShell,EventEmitter);var proto=GameShell.prototype;proto.keyNames=keyNames;proto.bind=function(virtual_key){var arr;if(virtual_key in this.bindings){arr=this.bindings[virtual_key]}else{arr=[]}var physical_key;for(var i=1,n=arguments.length;i<n;++i){physical_key=arguments[i];if(virtualKeyCode(physical_key)>=0){arr.push(physical_key)}else if(physical_key in this.bindings){var keybinds=this.bindings[physical_key];for(var j=0;j<keybinds.length;++j){arr.push(keybinds[j])}}}arr=uniq(arr);if(arr.length>0){this.bindings[virtual_key]=arr}this.emit("bind",virtual_key,arr)};proto.unbind=function(virtual_key){if(virtual_key in this.bindings){delete this.bindings[virtual_key]}this.emit("unbind",virtual_key)};function lookupKey(state,bindings,key){if(key in bindings){var arr=bindings[key];for(var i=0,n=arr.length;i<n;++i){if(state[virtualKeyCode(arr[i])]){return true}}return false}var kc=virtualKeyCode(key);if(kc>=0){return state[kc]}return false}function lookupCount(state,bindings,key){if(key in bindings){var arr=bindings[key],r=0;for(var i=0,n=arr.length;i<n;++i){r+=state[virtualKeyCode(arr[i])]}return r}var kc=virtualKeyCode(key);if(kc>=0){return state[kc]}return 0}proto.down=function(key){return lookupKey(this._curKeyState,this.bindings,key)};proto.wasDown=function(key){return this.down(key)||!!this.press(key)};proto.up=function(key){return!this.down(key)};proto.wasUp=function(key){return this.up(key)||!!this.release(key)};proto.press=function(key){return lookupCount(this._pressCount,this.bindings,key)};proto.release=function(key){return lookupCount(this._releaseCount,this.bindings,key)};Object.defineProperty(proto,"paused",{get:function(){return this._paused},set:function(state){var ns=!!state;if(ns!==this._paused){if(!this._paused){this._paused=true;this._frameTime=min(1,(hrtime()-this._lastTick)/this._tickRate);clearInterval(this._tickInterval)}else{this._paused=false;this._lastTick=hrtime()-Math.floor(this._frameTime*this._tickRate);this._tickInterval=setInterval(tick,this._tickRate,this);this._rafHandle=requestAnimationFrame(this._render)}}}});function tryFullscreen(shell){var elem=shell.element;if(shell._wantFullscreen&&!shell._fullscreenActive){var fs=elem.requestFullscreen||elem.requestFullScreen||elem.webkitRequestFullscreen||elem.webkitRequestFullScreen||elem.mozRequestFullscreen||elem.mozRequestFullScreen||function(){};fs.call(elem)}if(shell._wantPointerLock&&!shell._pointerLockActive){var pl=elem.requestPointerLock||elem.webkitRequestPointerLock||elem.mozRequestPointerLock||elem.msRequestPointerLock||elem.oRequestPointerLock||function(){};pl.call(elem)}}var cancelFullscreen=document.exitFullscreen||document.cancelFullscreen||document.cancelFullScreen||document.webkitCancelFullscreen||document.webkitCancelFullScreen||document.mozCancelFullscreen||document.mozCancelFullScreen||function(){};Object.defineProperty(proto,"fullscreen",{get:function(){return this._fullscreenActive},set:function(state){var ns=!!state;if(!ns){this._wantFullscreen=false;cancelFullscreen.call(document)}else{this._wantFullscreen=true;tryFullscreen(this)}return this._fullscreenActive}});function handleFullscreen(shell){shell._fullscreenActive=document.fullscreen||document.mozFullScreen||document.webkitIsFullScreen||false;if(!shell.stickyFullscreen&&shell._fullscreenActive){shell._wantFullscreen=false}}var exitPointerLock=document.exitPointerLock||document.webkitExitPointerLock||document.mozExitPointerLock||function(){};Object.defineProperty(proto,"pointerLock",{get:function(){return this._pointerLockActive},set:function(state){var ns=!!state;if(!ns){this._wantPointerLock=false;exitPointerLock.call(document)}else{this._wantPointerLock=true;tryFullscreen(this)}return this._pointerLockActive}});function handlePointerLockChange(shell,event){shell._pointerLockActive=shell.element===(document.pointerLockElement||document.mozPointerLockElement||document.webkitPointerLockElement||null);if(!shell.stickyPointerLock&&shell._pointerLockActive){shell._wantPointerLock=false}}Object.defineProperty(proto,"width",{get:function(){return this.element.clientWidth}});Object.defineProperty(proto,"height",{get:function(){return this.element.clientHeight}});function setKeyState(shell,key,state){var ps=shell._curKeyState[key];if(ps!==state){if(state){shell._pressCount[key]++}else{shell._releaseCount[key]++}shell._curKeyState[key]=state}}function tick(shell){var skip=hrtime()+shell.frameSkip,pCount=shell._pressCount,rCount=shell._releaseCount,i,s,t,tr=shell._tickRate,n=keyNames.length;while(!shell._paused&&hrtime()>=shell._lastTick+tr){if(hrtime()>skip){shell._lastTick=hrtime()+tr;return}s=hrtime();shell.emit("tick");t=hrtime();shell.tickTime=t-s;++shell.tickCount;shell._lastTick+=tr;for(i=0;i<n;++i){pCount[i]=rCount[i]=0}if(shell._pointerLockActive){shell.prevMouseX=shell.mouseX=shell.width>>1;shell.prevMouseY=shell.mouseY=shell.height>>1}else{shell.prevMouseX=shell.mouseX;shell.prevMouseY=shell.mouseY}shell.scroll[0]=shell.scroll[1]=shell.scroll[2]=0}}function render(shell){shell._rafHandle=requestAnimationFrame(shell._render);tick(shell);var dt;if(shell._paused){dt=shell._frameTime}else{dt=min(1,(hrtime()-shell._lastTick)/shell._tickRate)}++shell.frameCount;var s=hrtime();shell.emit("render",dt);var t=hrtime();shell.frameTime=t-s}function isFocused(shell){return document.activeElement===document.body||document.activeElement===shell.element}function handleEvent(shell,ev){if(shell.preventDefaults){ev.preventDefault()}if(shell.stopPropagation){ev.stopPropagation()}}function handleKeyUp(shell,ev){handleEvent(shell,ev);var kc=physicalKeyCode(ev.keyCode||ev.char||ev.which||ev.charCode); | |
if(kc>=0){setKeyState(shell,kc,false)}}function handleKeyDown(shell,ev){if(!isFocused(shell)){return}handleEvent(shell,ev);if(ev.metaKey){handleBlur(shell,ev)}else{var kc=physicalKeyCode(ev.keyCode||ev.char||ev.which||ev.charCode);if(kc>=0){setKeyState(shell,kc,true)}}}var mouseCodes=iota(32).map(function(n){return virtualKeyCode("mouse-"+(n+1))});function setMouseButtons(shell,buttons){for(var i=0;i<32;++i){setKeyState(shell,mouseCodes[i],!!(buttons&1<<i))}}function handleMouseMove(shell,ev){handleEvent(shell,ev);if(shell._pointerLockActive){var movementX=ev.movementX||ev.mozMovementX||ev.webkitMovementX||0,movementY=ev.movementY||ev.mozMovementY||ev.webkitMovementY||0;shell.mouseX+=movementX;shell.mouseY+=movementY}else{shell.mouseX=ev.clientX-shell.element.offsetLeft;shell.mouseY=ev.clientY-shell.element.offsetTop}return false}function handleMouseDown(shell,ev){handleEvent(shell,ev);setKeyState(shell,mouseCodes[ev.button],true);return false}function handleMouseUp(shell,ev){handleEvent(shell,ev);setKeyState(shell,mouseCodes[ev.button],false);return false}function handleMouseEnter(shell,ev){handleEvent(shell,ev);if(shell._pointerLockActive){shell.prevMouseX=shell.mouseX=shell.width>>1;shell.prevMouseY=shell.mouseY=shell.height>>1}else{shell.prevMouseX=shell.mouseX=ev.clientX-shell.element.offsetLeft;shell.prevMouseY=shell.mouseY=ev.clientY-shell.element.offsetTop}return false}function handleMouseLeave(shell,ev){handleEvent(shell,ev);setMouseButtons(shell,0);return false}function handleMouseWheel(shell,ev){handleEvent(shell,ev);var scale=1;switch(ev.deltaMode){case 0:scale=1;break;case 1:scale=12;break;case 2:scale=shell.height;break}shell.scroll[0]+=ev.deltaX*scale;shell.scroll[1]+=ev.deltaY*scale;shell.scroll[2]+=ev.deltaZ*scale||0;return false}function handleContexMenu(shell,ev){handleEvent(shell,ev);return false}function handleBlur(shell,ev){var n=keyNames.length,c=shell._curKeyState,r=shell._releaseCount,i;for(i=0;i<n;++i){if(c[i]){++r[i]}c[i]=false}return false}function handleResizeElement(shell,ev){var w=shell.element.clientWidth|0;var h=shell.element.clientHeight|0;if(w!==shell._width||h!==shell._height){shell._width=w;shell._height=h;shell.emit("resize",w,h)}}function makeDefaultContainer(){var container=document.createElement("div");container.tabindex=1;container.style.position="absolute";container.style.left="0px";container.style.right="0px";container.style.top="0px";container.style.bottom="0px";container.style.height="100%";container.style.overflow="hidden";document.body.appendChild(container);document.body.style.overflow="hidden";document.body.style.height="100%";return container}function createShell(options){options=options||{};var useFullscreen=!!options.fullscreen;var usePointerLock=useFullscreen;if(typeof options.pointerLock!==undefined){usePointerLock=!!options.pointerLock}var shell=new GameShell;shell._tickRate=options.tickRate||30;shell.frameSkip=options.frameSkip||(shell._tickRate+5)*5;shell.stickyFullscreen=!!options.stickyFullscreen||!!options.sticky;shell.stickyPointerLock=!!options.stickPointerLock||!options.sticky;if(options.bindings){shell.bindings=options.bindings}setTimeout(function(){domready(function initGameShell(){var element=options.element;if(typeof element==="string"){var e=document.querySelector(element);if(!e){e=document.getElementById(element)}if(!e){e=document.getElementByClass(element)[0]}if(!e){e=makeDefaultContainer()}shell.element=e}else if(typeof element==="object"&&!!element){shell.element=element}else if(typeof element==="function"){shell.element=element()}else{shell.element=makeDefaultContainer()}if(shell.element.style){shell.element.style["-webkit-touch-callout"]="none";shell.element.style["-webkit-user-select"]="none";shell.element.style["-khtml-user-select"]="none";shell.element.style["-moz-user-select"]="none";shell.element.style["-ms-user-select"]="none";shell.element.style["user-select"]="none"}shell._width=shell.element.clientWidth;shell._height=shell.element.clientHeight;var handleResize=handleResizeElement.bind(undefined,shell);if(typeof MutationObserver!=="undefined"){var observer=new MutationObserver(handleResize);observer.observe(shell.element,{attributes:true,subtree:true})}else{shell.element.addEventListener("DOMSubtreeModified",handleResize,false)}window.addEventListener("resize",handleResize,false);window.addEventListener("keydown",handleKeyDown.bind(undefined,shell),false);window.addEventListener("keyup",handleKeyUp.bind(undefined,shell),false);shell.element.oncontextmenu=handleContexMenu.bind(undefined,shell);shell.element.addEventListener("mousedown",handleMouseDown.bind(undefined,shell),false);shell.element.addEventListener("mouseup",handleMouseUp.bind(undefined,shell),false);shell.element.addEventListener("mousemove",handleMouseMove.bind(undefined,shell),false);shell.element.addEventListener("mouseenter",handleMouseEnter.bind(undefined,shell),false);var leave=handleMouseLeave.bind(undefined,shell);shell.element.addEventListener("mouseleave",leave,false);shell.element.addEventListener("mouseout",leave,false);window.addEventListener("mouseleave",leave,false);window.addEventListener("mouseout",leave,false);var blur=handleBlur.bind(undefined,shell);shell.element.addEventListener("blur",blur,false);shell.element.addEventListener("focusout",blur,false);shell.element.addEventListener("focus",blur,false);window.addEventListener("blur",blur,false);window.addEventListener("focusout",blur,false);window.addEventListener("focus",blur,false);addMouseWheel(shell.element,handleMouseWheel.bind(undefined,shell),false);var fullscreenChange=handleFullscreen.bind(undefined,shell);document.addEventListener("fullscreenchange",fullscreenChange,false);document.addEventListener("mozfullscreenchange",fullscreenChange,false);document.addEventListener("webkitfullscreenchange",fullscreenChange,false);shell.element.addEventListener("click",tryFullscreen.bind(undefined,shell),false);var pointerLockChange=handlePointerLockChange.bind(undefined,shell);document.addEventListener("pointerlockchange",pointerLockChange,false);document.addEventListener("mozpointerlockchange",pointerLockChange,false);document.addEventListener("webkitpointerlockchange",pointerLockChange,false);document.addEventListener("pointerlocklost",pointerLockChange,false);document.addEventListener("webkitpointerlocklost",pointerLockChange,false);document.addEventListener("mozpointerlocklost",pointerLockChange,false);shell.fullscreen=useFullscreen;shell.pointerLock=usePointerLock;shell.bind("mouse-left","mouse-1");shell.bind("mouse-right","mouse-3");shell.bind("mouse-middle","mouse-2");shell._lastTick=hrtime();shell.startTime=hrtime();shell.paused=false;shell.emit("init")})},0);return shell}module.exports=createShell},{"./lib/hrtime-polyfill.js":6,"./lib/mousewheel-polyfill.js":7,"./lib/raf-polyfill.js":8,"binary-search-bounds":9,domready:10,events:1,"invert-hash":11,"iota-array":12,uniq:13,util:5,vkey:14}],16:[function(require,module,exports){(function WeakMapModule(){"use strict";if(typeof ses!=="undefined"&&ses.ok&&!ses.ok()){return}function weakMapPermitHostObjects(map){if(map.permitHostObjects___){map.permitHostObjects___(weakMapPermitHostObjects)}}if(typeof ses!=="undefined"){ses.weakMapPermitHostObjects=weakMapPermitHostObjects}var doubleWeakMapCheckSilentFailure=false;if(typeof WeakMap==="function"){var HostWeakMap=WeakMap;if(typeof navigator!=="undefined"&&/Firefox/.test(navigator.userAgent)){}else{var testMap=new HostWeakMap;var testObject=Object.freeze({});testMap.set(testObject,1);if(testMap.get(testObject)!==1){doubleWeakMapCheckSilentFailure=true}else{module.exports=WeakMap;return}}}var hop=Object.prototype.hasOwnProperty;var gopn=Object.getOwnPropertyNames;var defProp=Object.defineProperty;var isExtensible=Object.isExtensible;var HIDDEN_NAME_PREFIX="weakmap:";var HIDDEN_NAME=HIDDEN_NAME_PREFIX+"ident:"+Math.random()+"___";if(typeof crypto!=="undefined"&&typeof crypto.getRandomValues==="function"&&typeof ArrayBuffer==="function"&&typeof Uint8Array==="function"){var ab=new ArrayBuffer(25);var u8s=new Uint8Array(ab);crypto.getRandomValues(u8s);HIDDEN_NAME=HIDDEN_NAME_PREFIX+"rand:"+Array.prototype.map.call(u8s,function(u8){return(u8%36).toString(36)}).join("")+"___"}function isNotHiddenName(name){return!(name.substr(0,HIDDEN_NAME_PREFIX.length)==HIDDEN_NAME_PREFIX&&name.substr(name.length-3)==="___")}defProp(Object,"getOwnPropertyNames",{value:function fakeGetOwnPropertyNames(obj){return gopn(obj).filter(isNotHiddenName)}});if("getPropertyNames"in Object){var originalGetPropertyNames=Object.getPropertyNames;defProp(Object,"getPropertyNames",{value:function fakeGetPropertyNames(obj){return originalGetPropertyNames(obj).filter(isNotHiddenName)}})}function getHiddenRecord(key){if(key!==Object(key)){throw new TypeError("Not an object: "+key)}var hiddenRecord=key[HIDDEN_NAME];if(hiddenRecord&&hiddenRecord.key===key){return hiddenRecord}if(!isExtensible(key)){return void 0}hiddenRecord={key:key};try{defProp(key,HIDDEN_NAME,{value:hiddenRecord,writable:false,enumerable:false,configurable:false});return hiddenRecord}catch(error){return void 0}}(function(){var oldFreeze=Object.freeze;defProp(Object,"freeze",{value:function identifyingFreeze(obj){getHiddenRecord(obj);return oldFreeze(obj)}});var oldSeal=Object.seal;defProp(Object,"seal",{value:function identifyingSeal(obj){getHiddenRecord(obj);return oldSeal(obj)}});var oldPreventExtensions=Object.preventExtensions;defProp(Object,"preventExtensions",{value:function identifyingPreventExtensions(obj){getHiddenRecord(obj);return oldPreventExtensions(obj)}})})();function constFunc(func){func.prototype=null;return Object.freeze(func)}var calledAsFunctionWarningDone=false;function calledAsFunctionWarning(){if(!calledAsFunctionWarningDone&&typeof console!=="undefined"){calledAsFunctionWarningDone=true;console.warn("WeakMap should be invoked as new WeakMap(), not "+"WeakMap(). This will be an error in the future.")}}var nextId=0;var OurWeakMap=function(){if(!(this instanceof OurWeakMap)){calledAsFunctionWarning()}var keys=[];var values=[];var id=nextId++;function get___(key,opt_default){var index;var hiddenRecord=getHiddenRecord(key);if(hiddenRecord){return id in hiddenRecord?hiddenRecord[id]:opt_default}else{index=keys.indexOf(key);return index>=0?values[index]:opt_default}}function has___(key){var hiddenRecord=getHiddenRecord(key);if(hiddenRecord){return id in hiddenRecord}else{return keys.indexOf(key)>=0}}function set___(key,value){var index;var hiddenRecord=getHiddenRecord(key);if(hiddenRecord){hiddenRecord[id]=value}else{index=keys.indexOf(key);if(index>=0){values[index]=value}else{index=keys.length;values[index]=value;keys[index]=key}}return this}function delete___(key){var hiddenRecord=getHiddenRecord(key);var index,lastIndex;if(hiddenRecord){return id in hiddenRecord&&delete hiddenRecord[id]}else{index=keys.indexOf(key);if(index<0){return false}lastIndex=keys.length-1;keys[index]=void 0;values[index]=values[lastIndex];keys[index]=keys[lastIndex];keys.length=lastIndex;values.length=lastIndex;return true}}return Object.create(OurWeakMap.prototype,{get___:{value:constFunc(get___)},has___:{value:constFunc(has___)},set___:{value:constFunc(set___)},delete___:{value:constFunc(delete___)}})};OurWeakMap.prototype=Object.create(Object.prototype,{get:{value:function get(key,opt_default){return this.get___(key,opt_default)},writable:true,configurable:true},has:{value:function has(key){return this.has___(key)},writable:true,configurable:true},set:{value:function set(key,value){return this.set___(key,value)},writable:true,configurable:true},"delete":{value:function remove(key){return this.delete___(key)},writable:true,configurable:true}});if(typeof HostWeakMap==="function"){(function(){if(doubleWeakMapCheckSilentFailure&&typeof Proxy!=="undefined"){Proxy=undefined}function DoubleWeakMap(){if(!(this instanceof OurWeakMap)){calledAsFunctionWarning()}var hmap=new HostWeakMap;var omap=undefined;var enableSwitching=false;function dget(key,opt_default){if(omap){return hmap.has(key)?hmap.get(key):omap.get___(key,opt_default)}else{return hmap.get(key,opt_default)}}function dhas(key){return hmap.has(key)||(omap?omap.has___(key):false)}var dset;if(doubleWeakMapCheckSilentFailure){dset=function(key,value){hmap.set(key,value);if(!hmap.has(key)){if(!omap){omap=new OurWeakMap}omap.set(key,value)}return this}}else{dset=function(key,value){if(enableSwitching){try{hmap.set(key,value)}catch(e){if(!omap){omap=new OurWeakMap}omap.set___(key,value)}}else{hmap.set(key,value)}return this}}function ddelete(key){var result=!!hmap["delete"](key);if(omap){return omap.delete___(key)||result}return result}return Object.create(OurWeakMap.prototype,{get___:{value:constFunc(dget)},has___:{value:constFunc(dhas)},set___:{value:constFunc(dset)},delete___:{value:constFunc(ddelete)},permitHostObjects___:{value:constFunc(function(token){if(token===weakMapPermitHostObjects){enableSwitching=true}else{throw new Error("bogus call to permitHostObjects___")}})}})}DoubleWeakMap.prototype=OurWeakMap.prototype;module.exports=DoubleWeakMap;Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:false,configurable:true,writable:true})})()}else{if(typeof Proxy!=="undefined"){Proxy=undefined}module.exports=OurWeakMap}})()},{}],17:[function(require,module,exports){"use strict";var weakMap=typeof WeakMap==="undefined"?require("weak-map"):WeakMap;var WebGLEWStruct=new weakMap;function baseName(ext_name){return ext_name.replace(/^[A-Z]+_/,"")}function initWebGLEW(gl){var struct=WebGLEWStruct.get(gl);if(struct){return struct}var extensions={};var supported=gl.getSupportedExtensions();for(var i=0;i<supported.length;++i){var extName=supported[i];if(extName.indexOf("MOZ_")===0){continue}var ext=gl.getExtension(supported[i]);if(!ext){continue}while(true){extensions[extName]=ext;var base=baseName(extName);if(base===extName){break}extName=base}}WebGLEWStruct.set(gl,extensions);return extensions}module.exports=initWebGLEW},{"weak-map":16}],"gl-now":[function(require,module,exports){"use strict";var makeGameShell=require("game-shell");var webglew=require("webglew");function createGLShell(options){options=options||{};var extensions=options.extensions||[];var shell=makeGameShell(options);var scale=shell.scale||1;var contextOptions=options.glOptions;shell.on("init",function initGLNow(){var canvas=document.createElement("canvas");var gl=canvas.getContext("webgl",contextOptions)||canvas.getContext("experimental-webgl",contextOptions);if(!gl){shell.emit("gl-error",new Error("Unable to initialize WebGL"));return}var ext=webglew(gl);for(var i=0;i<extensions.length;++i){if(!(extensions[i]in ext)){shell.emit("gl-error",new Error("Missing extension: "+extensions[i]));return}}canvas.style.position="absolute";canvas.style.left="0px";canvas.style.top="0px";shell.element.appendChild(canvas);shell.canvas=canvas;shell.gl=gl;resize();shell.clearFlags=options.clearFlags===undefined?gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT:options.clearFlags;shell.clearColor=options.clearColor||[0,0,0,0];shell.clearDepth=options.clearDepth||1;shell.clearStencil=options.clearStencil||0;shell.on("resize",resize);shell.on("render",function renderGLNow(t){gl.bindFramebuffer(gl.FRAMEBUFFER,null);gl.viewport(0,0,shell._width/scale|0,shell._height/scale|0);if(shell.clearFlags&gl.STENCIL_BUFFER_BIT){gl.clearStencil(shell.clearStencil)}if(shell.clearFlags&gl.COLOR_BUFFER_BIT){gl.clearColor(shell.clearColor[0],shell.clearColor[1],shell.clearColor[2],shell.clearColor[3])}if(shell.clearFlags&gl.DEPTH_BUFFER_BIT){gl.clearDepth(shell.clearDepth)}if(shell.clearFlags){gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT|gl.STENCIL_BUFFER_BIT)}shell.emit("gl-render",t)});shell.emit("gl-init")});function resize(){var nw=shell._width/scale|0;var nh=shell._height/scale|0;shell.canvas.width=nw;shell.canvas.height=nh;shell.canvas.style.width=shell._width+"px";shell.canvas.style.height=shell._height+"px";shell.emit("gl-resize",nw,nh)}Object.defineProperty(shell,"scale",{get:function(){return scale},set:function(_scale){_scale=+_scale;if(_scale<=0||isNaN(_scale)||scale===_scale){return scale}scale=_scale;resize();return scale}});Object.defineProperty(shell,"width",{get:function(){return shell._width/scale|0}});Object.defineProperty(shell,"height",{get:function(){return shell._height/scale|0}});Object.defineProperty(shell,"mouse",{get:function(){return[shell.mouseX/scale,shell.mouseY/scale]}});Object.defineProperty(shell,"prevMouse",{get:function(){return[shell.prevMouseX/scale,shell.prevMouseY/scale]}});return shell}module.exports=createGLShell},{"game-shell":15,webglew:17}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({bunny:[function(require,module,exports){exports.positions=[[1.301895,.122622,2.550061],[1.045326,.139058,2.835156],[.569251,.155925,2.805125],[.251886,.144145,2.82928],[.063033,.131726,3.01408],[-.277753,.135892,3.10716],[-.441048,.277064,2.594331],[-1.010956,.095285,2.668983],[-1.317639,.069897,2.325448],[-.751691,.264681,2.381496],[.684137,.31134,2.364574],[1.347931,.302882,2.201434],[-1.736903,.029894,1.724111],[-1.319986,.11998,.912925],[1.538077,.157372,.481711],[1.951975,.081742,1.1641],[1.834768,.095832,1.602682],[2.446122,.091817,1.37558],[2.617615,.078644,.742801],[-1.609748,.04973,-.238721],[-1.281973,.230984,-.180916],[-1.074501,.248204,.034007],[-1.201734,.058499,.402234],[-1.444454,.054783,.149579],[-4.694605,5.075882,1.043427],[-3.95963,7.767394,.758447],[-4.753339,5.339817,.665061],[-1.150325,9.133327,-.368552],[-4.316107,2.893611,.44399],[-.809202,9.312575,-.466061],[.085626,5.963693,1.685666],[-1.314853,9.00142,-.1339],[-4.364182,3.072556,1.436712],[-2.022074,7.323396,.678657],[1.990887,6.13023,.479643],[-3.295525,7.878917,1.409353],[.571308,6.197569,.670657],[.89661,6.20018,.337056],[.331851,6.162372,1.186371],[-4.840066,5.599874,2.296069],[2.138989,6.031291,.228335],[.678923,6.026173,1.894052],[-.781682,5.601573,1.836738],[1.181315,6.239007,.393293],[-3.606308,7.376476,2.661452],[-.579059,4.042511,-1.540883],[-3.064069,8.630253,-2.597539],[-2.157271,6.837012,.300191],[-2.966013,7.821581,-1.13697],[-2.34426,8.122965,.409043],[-.951684,5.874251,1.415119],[-2.834853,7.748319,.182406],[-3.242493,7.820096,.373674],[-.208532,5.992846,1.252084],[-3.048085,8.431527,-2.129795],[1.413245,5.806324,2.243906],[-.051222,6.064901,.696093],[-4.204306,2.700062,.713875],[-4.610997,6.343405,.344272],[-3.291336,9.30531,-3.340445],[-3.27211,7.559239,-2.324016],[-4.23882,6.498344,3.18452],[-3.945317,6.377804,3.38625],[-4.906378,5.472265,1.315193],[-3.580131,7.846717,.709666],[-1.995504,6.645459,.688487],[-2.595651,7.86054,.793351],[-.008849,.305871,.184484],[-.029011,.314116,-.257312],[-2.522424,7.565392,1.804212],[-1.022993,8.650826,-.855609],[-3.831265,6.595426,3.266783],[-4.042525,6.855724,3.060663],[-4.17126,7.404742,2.391387],[3.904526,3.767693,.092179],[.268076,6.086802,1.469223],[-3.320456,8.753222,-2.08969],[1.203048,6.26925,.612407],[-4.406479,2.985974,.853691],[-3.226889,6.615215,-.404243],[.346326,1.60211,3.509858],[-3.955476,7.253323,2.722392],[-1.23204,.068935,1.68794],[.625436,6.196455,1.333156],[4.469132,2.165298,1.70525],[.950053,6.262899,.922441],[-2.980404,5.25474,-.663155],[-4.859043,6.28741,1.537081],[-3.077453,4.641475,-.892167],[-.44002,8.222503,-.771454],[-4.034112,7.639786,.389935],[-3.696045,6.242042,3.394679],[-1.221806,7.783617,.196451],[.71461,6.149895,1.656636],[-4.713539,6.163154,.495369],[-1.509869,.913044,-.832413],[-1.547249,2.066753,-.852669],[-3.757734,5.793742,3.455794],[-.831911,.199296,1.718536],[-3.062763,7.52718,-1.550559],[.938688,6.103354,1.820958],[-4.037033,2.412311,.988026],[-4.130746,2.571806,1.101689],[-.693664,9.174283,-.952323],[-1.286742,1.079679,-.751219],[1.543185,1.408925,3.483132],[1.535973,2.047979,3.655029],[.93844,5.84101,2.195219],[-.684401,5.918492,1.20109],[1.28844,2.008676,3.710781],[-3.586722,7.435506,-1.454737],[-.129975,4.384192,2.930593],[-1.030531,.281374,3.214273],[-3.058751,8.137238,-3.227714],[3.649524,4.592226,1.340021],[-3.354828,7.322425,-1.412086],[.936449,6.209237,1.512693],[-1.001832,3.590411,-1.545892],[-3.770486,4.593242,2.477056],[-.971925,.067797,.921384],[-4.639832,6.865407,2.311791],[-.441014,8.093595,-.595999],[-2.004852,6.37142,1.635383],[4.759591,1.92818,.328328],[3.748064,1.224074,2.140484],[-.703601,5.285476,2.251988],[.59532,6.21893,.981004],[.980799,6.257026,1.24223],[1.574697,6.204981,.381628],[1.149594,6.173608,1.660763],[-3.501963,5.895989,3.456576],[1.071122,5.424198,2.588717],[-.774693,8.473335,-.276957],[3.849959,4.15542,.396742],[-.801715,4.973149,-1.068582],[-2.927676,.625112,2.326393],[2.669682,4.045542,2.971184],[-4.391324,4.74086,.343463],[1.520129,6.270031,.775471],[1.837586,6.084731,.109188],[1.271475,5.975024,2.032355],[-3.487968,4.513249,2.605871],[-1.32234,1.517264,-.691879],[-1.080301,1.648226,-.805526],[-3.365703,6.910166,-.454902],[1.36034,.432238,3.075004],[-3.305013,5.774685,3.39142],[3.88432,.654141,.12574],[3.57254,.377934,.302501],[4.196136,.807999,.212229],[3.932997,.543123,.380579],[4.023704,3.286125,.537597],[1.864455,4.916544,2.691677],[-4.775427,6.499498,1.440153],[-3.464928,3.68234,2.766356],[3.648972,1.751262,2.157485],[1.179111,3.238846,3.774796],[-.171164,.299126,-.592669],[-4.502912,3.316656,.875188],[-.948454,9.214025,-.679508],[1.237665,6.288593,1.046],[1.523423,6.268963,1.139544],[1.436519,6.140608,1.739316],[3.723607,1.504355,2.136762],[2.009495,4.045514,3.22053],[-1.921944,7.249905,.213973],[1.254068,1.205518,3.474709],[-.317087,5.996269,.525872],[-2.996914,3.934607,2.900178],[-3.316873,4.028154,2.785696],[-3.400267,4.280157,2.689268],[-3.134842,4.564875,2.697192],[1.480563,4.692567,2.834068],[.873682,1.315452,3.541585],[1.599355,.91622,3.246769],[-3.292102,7.125914,2.768515],[3.74296,4.511299,.616539],[4.698935,1.55336,.26921],[-3.274387,3.299421,2.823946],[-2.88809,3.410699,2.955248],[1.171407,1.76905,3.688472],[1.430276,3.92483,3.473666],[3.916941,2.553308,.018941],[.701632,2.442372,3.778639],[1.562657,2.302778,3.660957],[4.476622,1.152407,.182131],[-.61136,5.761367,1.598838],[-3.102154,3.691687,2.903738],[1.816012,5.546167,2.380308],[3.853928,4.25066,.750017],[1.234681,3.581665,3.673723],[1.862271,1.361863,3.355209],[1.346844,4.146995,3.327877],[1.70672,4.080043,3.274307],[.897242,1.908983,3.6969],[-.587022,9.191132,-.565301],[-.217426,5.674606,2.019968],[.278925,6.120777,.485403],[1.463328,3.578742,-2.001464],[-3.072985,4.264581,2.789502],[3.62353,4.673843,.383452],[-3.053491,8.752377,-2.908434],[-2.628687,4.505072,2.755601],[.891047,5.113781,2.748272],[-2.923732,3.06515,2.866368],[.848008,4.754252,2.896972],[-3.319184,8.811641,-2.327412],[.12864,8.814781,-1.334456],[1.549501,4.549331,-1.28243],[1.647161,3.738973,3.507719],[1.250888,.945599,3.348739],[3.809662,4.038822,.053142],[1.483166,.673327,3.09156],[.829726,3.635921,3.713103],[1.352914,5.226651,2.668113],[2.237352,4.37414,3.016386],[4.507929,.889447,.744249],[4.57304,1.010981,.496588],[3.931422,1.720989,2.088175],[-.463177,5.989835,.834346],[-2.811236,3.745023,2.969587],[-2.805135,4.219721,2.841108],[-2.836842,4.802543,2.60826],[1.776716,2.084611,3.568638],[4.046881,1.463478,2.106273],[.316265,5.944313,1.892785],[-2.86347,2.776049,2.77242],[-2.673644,3.116508,2.907104],[-2.621149,4.018502,2.903409],[-2.573447,5.198013,2.477481],[1.104039,2.278985,3.722469],[-4.602743,4.306413,.902296],[-2.684878,1.510731,.535039],[.092036,8.473269,-.99413],[-1.280472,5.602393,1.928105],[-1.0279,4.121582,-1.403103],[-2.461081,3.304477,2.957317],[-2.375929,3.659383,2.953233],[1.417579,2.715389,3.718767],[.819727,2.948823,3.810639],[1.329962,.761779,3.203724],[1.73952,5.295229,2.537725],[.952523,3.945016,3.548229],[-2.569498,.633669,2.84818],[-2.276676,.757013,2.780717],[-2.013147,7.354429,-.003202],[.93143,1.565913,3.600325],[1.249014,1.550556,3.585842],[2.287252,4.072353,3.124544],[-4.7349,7.006244,1.690653],[-3.500602,8.80386,-2.009196],[-.582629,5.549138,2.000923],[-1.865297,6.356066,1.313593],[-3.212154,2.376143,-.565593],[2.092889,3.493536,-1.727931],[-2.528501,2.784531,2.833758],[-2.565697,4.893154,2.559605],[-2.153366,5.04584,2.465215],[1.631311,2.568241,3.681445],[2.150193,4.699227,2.807505],[.507599,5.01813,2.775892],[4.129862,1.863698,2.015101],[3.578279,4.50766,-.009598],[3.491023,4.806749,1.549265],[.619485,1.625336,3.605125],[1.107499,2.932557,3.790061],[-2.082292,6.99321,.742601],[4.839909,1.379279,.945274],[3.591328,4.322645,-.259497],[1.055245,.710686,3.16553],[-3.026494,7.842227,1.624553],[.146569,6.119214,.981673],[-2.043687,2.614509,2.785526],[-2.302242,3.047775,2.936355],[-2.245686,4.100424,2.87794],[2.116148,5.063507,2.572204],[-1.448406,7.64559,.251692],[2.550717,4.9268,2.517526],[-2.955456,7.80293,-1.782407],[1.882995,4.637167,2.895436],[-2.014924,3.398262,2.954896],[-2.273654,4.771227,2.611418],[-2.162723,7.876761,.702473],[-.198659,5.823062,1.739272],[-1.280908,2.133189,-.921241],[2.039932,4.251568,3.136579],[1.477815,4.354333,3.108325],[.560504,3.744128,3.6913],[-2.234018,1.054373,2.352782],[-3.189156,7.686661,-2.514955],[-3.744736,7.69963,2.116973],[-2.283366,2.878365,2.87882],[-2.153786,4.457481,2.743529],[4.933978,1.677287,.713773],[3.502146,.535336,1.752511],[1.825169,4.419253,3.081198],[3.072331,.280979,.106534],[-.508381,1.220392,2.878049],[-3.138824,8.445394,-1.659711],[-2.056425,2.954815,2.897241],[-2.035343,5.398477,2.215842],[-3.239915,7.126798,-.712547],[-1.867923,7.989805,.526518],[1.23405,6.248973,1.387189],[-.216492,8.320933,-.862495],[-2.079659,3.755709,2.928563],[-1.78595,4.300374,2.805295],[-1.856589,5.10678,2.386572],[-1.714362,5.544778,2.004623],[1.722403,4.200291,-1.408161],[.195386,.086928,-1.318006],[1.393693,3.013404,3.710686],[-.415307,8.508471,-.996883],[-1.853777,.755635,2.757275],[-1.724057,3.64533,2.884251],[-1.884511,4.927802,2.530885],[-1.017174,7.783908,-.227078],[-1.7798,2.342513,2.741749],[-1.841329,3.943996,2.88436],[1.430388,5.468067,2.503467],[-2.030296,.940028,2.611088],[-1.677028,1.215666,2.607771],[-1.74092,2.832564,2.827295],[4.144673,.631374,.503358],[4.238811,.653992,.762436],[-1.847016,2.082815,2.642674],[4.045764,3.194073,.852117],[-1.563989,8.112739,.303102],[-1.781627,1.794836,2.602338],[-1.493749,2.533799,2.797251],[-1.934496,4.690689,2.658999],[-1.499174,5.777946,1.747498],[-2.387409,.851291,1.500524],[-1.872211,8.269987,.392533],[-4.647726,6.765771,.833653],[-3.157482,.341958,-.20671],[-1.725766,3.24703,2.883579],[-1.458199,4.079031,2.836325],[-1.621548,4.515869,2.719266],[-1.607292,4.918914,2.505881],[-1.494661,5.556239,1.991599],[-1.727269,7.423769,.012337],[-1.382497,1.161322,2.640222],[-1.52129,4.681714,2.615467],[-4.247127,2.792812,1.250843],[-1.576338,.742947,2.769799],[-1.499257,2.172763,2.743142],[-1.480392,3.103261,2.862262],[1.049137,2.625836,3.775384],[-1.368063,1.791587,2.695516],[-1.307839,2.344534,2.767575],[-1.336758,5.092221,2.355225],[-1.5617,5.301749,2.21625],[-1.483362,8.537704,.196752],[-1.517348,8.773614,.074053],[-1.474302,1.492731,2.641433],[2.48718,.644247,-.920226],[.818091,.422682,3.171218],[-3.623398,6.930094,3.033045],[1.676333,3.531039,3.591591],[1.199939,5.683873,2.365623],[-1.223851,8.841201,.025414],[-1.286307,3.847643,2.918044],[-1.25857,4.810831,2.543605],[2.603662,5.572146,1.991854],[.138984,5.779724,2.077834],[-1.267039,3.175169,2.890889],[-1.293616,3.454612,2.911774],[-2.60112,1.277184,.07724],[2.552779,3.649877,3.163643],[-1.038983,1.248011,2.605933],[-1.288709,4.390967,2.761214],[-1.034218,5.485963,2.011467],[-1.185576,1.464842,2.624335],[-1.045682,2.54896,2.761102],[4.259176,1.660627,2.018096],[-.961707,1.717183,2.598342],[-1.044603,3.147464,2.855335],[-.891998,4.685429,2.669696],[-1.027561,5.081672,2.377939],[4.386506,.832434,.510074],[-1.014225,9.064991,-.175352],[-1.218752,2.895443,2.823785],[-.972075,4.432669,2.788005],[-2.714986,.52425,1.509798],[-.699248,1.517219,2.645738],[-1.161581,2.078852,2.722795],[-.845249,3.286247,2.996471],[1.068329,4.443444,2.993863],[3.98132,3.715557,1.027775],[1.658097,3.982428,-1.651688],[-4.053701,2.449888,.734746],[-.910935,2.214149,2.702393],[.087824,3.96165,3.439344],[-.779714,3.724134,2.993429],[-1.051093,3.810797,2.941957],[-.644941,4.3859,2.870863],[-2.98403,8.666895,-3.691888],[-.754304,2.508325,2.812999],[-4.635524,3.662891,.913005],[-.983299,4.125978,2.915378],[4.916497,1.905209,.621315],[4.874983,1.728429,.468521],[2.33127,5.181957,2.441697],[-.653711,2.253387,2.7949],[-3.623744,8.978795,-2.46192],[-4.555927,6.160279,.215755],[-4.940628,5.806712,1.18383],[3.308506,2.40326,-.910776],[.58835,5.251928,-.992886],[2.152215,5.449733,2.331679],[-.712755,.766765,3.280375],[-.741771,1.9716,2.657235],[-4.828957,5.566946,2.635623],[-3.474788,8.696771,-1.776121],[1.770417,6.205561,1.331627],[-.620626,4.064721,2.968972],[-1.499187,2.307735,-.978901],[4.098793,2.330245,1.667951],[1.940444,6.167057,.935904],[-2.314436,1.104995,1.681277],[-2.733629,7.742793,1.7705],[-.452248,4.719868,2.740834],[-.649143,4.951713,2.541296],[-.479417,9.43959,-.676324],[-2.251853,6.559275,.046819],[.033531,8.316907,-.789939],[-.513125,.995673,3.125462],[-2.637602,1.039747,.602434],[1.527513,6.230089,1.430903],[4.036124,2.609846,1.506498],[-3.559828,7.877892,1.228076],[-4.570736,4.960193,.838201],[-.432121,5.157731,2.467518],[-1.206735,4.562511,-1.237054],[-.823768,3.788746,-1.567481],[-3.095544,7.353613,-1.024577],[-4.056088,7.631119,2.062001],[-.289385,5.382261,2.329421],[1.69752,6.136483,1.667037],[-.168758,5.061138,2.617453],[2.853576,1.605528,-1.229958],[-4.514319,6.586675,.352756],[-2.558081,7.741151,1.29295],[1.61116,5.92358,2.071534],[3.936921,3.354857,.091755],[-.1633,1.119272,3.147975],[.067551,1.593475,3.38212],[-1.303239,2.328184,-1.011672],[-.438093,.73423,3.398384],[-4.62767,3.898187,.849573],[.286853,4.165281,3.284834],[-2.968052,8.492812,-3.493693],[-.111896,3.696111,3.53791],[-3.808245,8.451731,-1.574742],[.053416,5.558764,2.31107],[3.956269,3.012071,.11121],[-.710956,8.106561,-.665154],[.234725,2.717326,3.722379],[-.031594,2.76411,3.657347],[-.017371,4.700633,2.81911],[.215064,5.034859,2.721426],[-.111151,8.480333,-.649399],[3.97942,3.575478,.362219],[.392962,4.735392,2.874321],[4.17015,2.085087,1.865999],[.169054,1.244786,3.337709],[.020049,3.165818,3.721736],[.248212,3.595518,3.698376],[.130706,5.295541,2.540034],[-4.541357,4.798332,1.026866],[-1.277485,1.289518,-.667272],[3.892133,3.54263,-.078056],[4.057379,3.03669,.997913],[.287719,.884758,3.251787],[.535771,1.144701,3.400096],[.585303,1.399362,3.505353],[.191551,2.076246,3.549355],[.328656,2.394576,3.649623],[.413124,3.240728,3.771515],[.630361,4.501549,2.963623],[.529441,5.854392,2.120225],[3.805796,3.769958,-.162079],[3.447279,4.344846,-.467276],[.377618,5.551116,2.426017],[.409355,1.821269,3.606333],[.719959,2.194726,3.703851],[.495922,3.501519,3.755661],[.603408,5.354097,2.603088],[-4.605056,7.531978,1.19579],[.907972,.973128,3.356513],[.750134,3.356137,3.765847],[.4496,3.993244,3.504544],[-3.030738,7.48947,-1.259169],[.707505,5.602005,2.43476],[.668944,.654891,3.213797],[.593244,2.700978,3.791427],[1.467759,3.30327,3.71035],[3.316249,2.436388,2.581175],[3.26138,1.724425,2.539028],[-1.231292,7.968263,.281414],[-.108773,8.712307,-.790607],[4.445684,1.819442,1.896988],[1.998959,2.281499,3.49447],[2.162269,2.113817,3.365449],[4.363397,1.406731,1.922714],[4.808,2.225842,.611127],[2.735919,.771812,-.701142],[1.897735,2.878428,3.583482],[-3.31616,5.331985,3.212394],[-3.3314,6.018137,3.313018],[-3.503183,6.480103,3.222216],[-1.904453,5.750392,1.913324],[-1.339735,3.559592,-1.421817],[-1.044242,8.22539,.037414],[1.643492,3.110676,3.647424],[3.992832,3.686244,.710946],[1.774207,1.71842,3.475768],[-3.438842,5.5713,3.427818],[4.602447,1.2583,1.619528],[-.925516,7.930042,.072336],[-1.252093,3.846565,-1.420761],[-3.426857,5.072419,2.97806],[-3.160408,6.152629,3.061869],[3.739931,3.367082,2.041273],[1.027419,4.235891,3.251253],[4.777703,1.887452,1.560409],[-3.318528,6.733796,2.982968],[2.929265,4.962579,2.271079],[3.449761,2.838629,2.474576],[-3.280159,5.029875,2.787514],[4.068939,2.993629,.741567],[.303312,8.70927,-1.121972],[.229852,8.981322,-1.186075],[-.011045,9.148156,-1.047057],[-2.942683,5.579613,2.929297],[-3.145409,5.698727,3.205778],[-3.019089,6.30887,2.794323],[-3.217135,6.468191,2.970032],[-3.048298,6.993641,2.623378],[-3.07429,6.660982,2.702434],[3.612011,2.5574,2.25349],[2.54516,4.553967,2.75884],[-1.683759,7.400787,.250868],[-1.756066,7.463557,.448031],[-3.023761,5.149697,2.673539],[3.112376,2.677218,2.782378],[2.835327,4.581196,2.567146],[-2.973799,7.225458,2.506988],[-.591645,8.740662,-.505845],[3.782861,2.04337,2.03066],[3.331604,3.36343,2.605047],[2.966866,1.205497,2.537432],[.002669,9.654748,-1.355559],[2.632801,.58497,2.540311],[-2.819398,5.087372,2.521098],[2.616193,5.332961,2.194288],[-3.193973,4.925634,2.607924],[-3.12618,5.27524,2.944544],[-.426003,8.516354,-.501528],[2.802717,1.387643,2.751649],[-3.120597,7.889111,-2.75431],[2.636648,1.71702,2.991302],[-2.853151,6.711792,2.430276],[-2.843836,6.962865,2.400842],[1.9696,3.199023,3.504514],[-2.461751,.386352,3.008994],[1.64127,.495758,3.02958],[-4.330472,5.409831,.025287],[-2.912387,5.980416,2.844261],[-2.490069,.211078,2.985391],[3.581816,4.809118,.733728],[2.693199,2.647213,3.126709],[-.182964,8.184108,-.638459],[-2.226855,.444711,2.946552],[-.720175,8.115055,.017689],[2.645302,4.316212,2.850139],[-.232764,9.329503,-.918639],[4.852365,1.471901,.65275],[2.76229,2.014994,2.957755],[-2.808374,5.354301,2.644695],[-2.790967,6.406963,2.547985],[-1.342684,.418488,-1.669183],[2.690675,5.593587,-.041236],[4.660146,1.6318,1.713314],[2.775667,3.007229,3.111332],[-.396696,8.963432,-.706202],[2.446707,2.740617,3.321433],[-4.803209,5.884634,2.603672],[-2.652003,1.6541,1.5078],[3.932327,3.972874,.831924],[2.135906,.955587,2.986608],[2.486131,2.053802,3.124115],[-.386706,8.115753,-.37565],[-2.720727,7.325044,2.224878],[-1.396946,7.638016,-.16486],[-.62083,7.989771,-.144413],[-2.653272,5.729684,2.667679],[3.038188,4.65835,2.364142],[2.381721,.739472,2.788992],[-2.345829,5.474929,2.380633],[-2.518983,6.080562,2.479383],[-2.615793,6.839622,2.186116],[-2.286566,.143752,2.766848],[-4.771219,6.508766,1.070797],[3.717308,2.905019,2.097994],[2.50521,3.016743,3.295898],[2.208448,1.56029,3.216806],[3.346783,1.01254,2.119951],[2.653503,3.26122,3.175738],[-2.359636,5.827519,2.402297],[-1.952693,.558102,2.853307],[-.321562,9.414885,-1.187501],[3.138923,1.405072,2.520765],[1.493728,1.780051,3.621969],[3.01817,.907291,2.336909],[3.183548,1.185297,2.352175],[1.608619,5.006753,2.695131],[-4.723919,6.836107,1.095288],[-1.017586,8.865429,-.149328],[4.730762,1.214014,.64008],[-2.135182,6.647907,1.495471],[-2.420382,6.546114,2.108209],[-2.458053,7.186346,1.896623],[3.437124,.275798,1.138203],[.095925,8.725832,-.926481],[2.417376,2.429869,3.287659],[2.279951,1.200317,3.049994],[2.674753,2.326926,3.044059],[-2.328123,6.849164,1.75751],[-3.418616,7.853407,.126248],[-3.151587,7.77543,-.110889],[2.349144,5.653242,2.05869],[-2.273236,6.085631,2.242888],[-4.560601,4.525342,1.261241],[2.866334,3.796067,2.934717],[-2.17493,6.505518,1.791367],[3.12059,3.283157,2.818869],[3.037703,3.562356,2.866653],[.066233,9.488418,-1.248237],[2.749941,.975018,2.573371],[-2.155749,5.801033,2.204009],[-2.162778,6.261889,2.028596],[1.936874,.459142,2.956718],[3.176249,4.335541,2.440447],[4.356599,1.029423,1.700589],[3.873502,3.082678,1.80431],[2.895489,4.243034,2.735259],[-.095774,9.468195,-1.07451],[-1.124982,7.886808,-.480851],[3.032304,3.065454,2.897927],[3.692687,4.5961,.957858],[-3.013045,3.807235,-1.098381],[-.790012,8.92912,-.367572],[1.905793,.73179,2.996728],[3.530396,3.426233,2.356583],[2.12299,.624933,2.929167],[-2.069196,6.039284,2.01251],[-3.565623,7.182525,2.850039],[2.959264,2.376337,2.829242],[2.949071,1.822483,2.793933],[4.036142,.763803,1.703744],[-1.993527,6.180318,1.804936],[-.030987,.766389,3.344766],[-.549683,8.225193,-.189341],[-.765469,8.272246,-.127174],[-2.947047,7.541648,-.414113],[-3.050327,9.10114,-3.435619],[3.488566,2.231807,2.399836],[3.352283,4.727851,1.946438],[4.741011,2.162773,1.499574],[-1.815093,6.072079,1.580722],[-3.720969,8.267927,-.984713],[1.932826,3.714052,3.427488],[3.323617,4.438961,2.20732],[.254111,9.26364,-1.373244],[-1.493384,7.868585,-.450051],[-.841901,.776135,-1.619467],[.243537,6.027668,.091687],[.303057,.313022,-.531105],[-.435273,.474098,3.481552],[2.121507,2.622389,3.486293],[1.96194,1.101753,3.159584],[3.937991,3.407551,1.551392],[.070906,.295753,1.377185],[-1.93588,7.631764,.651674],[-2.523531,.744818,-.30985],[2.891496,3.319875,2.983079],[4.781765,1.547061,1.523129],[-2.256064,7.571251,.973716],[3.244861,3.058249,2.724392],[-.145855,.437775,3.433662],[1.586296,5.658538,2.358487],[3.658336,3.774921,2.071837],[2.840463,4.817098,2.46376],[-1.219464,8.122542,-.672808],[-2.520906,2.664486,-1.034346],[-1.315417,8.471365,-.709557],[3.429165,3.74686,2.446169],[3.074579,3.840758,2.767409],[3.569443,3.166337,2.333647],[2.294337,3.280051,3.359346],[2.21816,3.66578,3.269222],[2.158662,4.151444,-1.357919],[1.13862,4.380986,-1.404565],[3.388382,2.749931,-.840949],[3.059892,5.084848,2.026066],[3.204739,2.075145,2.640706],[3.387065,1.42617,2.305275],[3.910398,2.670742,1.750179],[3.471512,1.945821,2.395881],[4.08082,1.070654,1.960171],[-1.057861,.133036,2.146707],[-.151749,5.53551,-.624323],[3.233099,4.003778,2.571172],[2.611726,5.319199,-.499388],[2.682909,1.094499,-1.206247],[-1.22823,7.656887,.041409],[-2.293247,7.259189,.013844],[.081315,.202174,3.286381],[-1.002038,5.794454,-.187194],[3.448856,4.08091,2.258325],[.287883,9.006888,-1.550641],[-3.851019,4.059839,-.646922],[3.610966,4.205438,1.913129],[2.239042,2.950872,3.449959],[.216305,.442843,3.328052],[1.87141,2.470745,3.574559],[3.811378,2.768718,-.228364],[2.511081,1.362724,2.969349],[-1.59813,7.866506,.440184],[-3.307975,2.851072,-.894978],[-.107011,8.90573,-.884399],[-3.855315,2.842597,-.434541],[2.517853,1.090768,2.799687],[3.791709,2.36685,2.002703],[4.06294,2.773922,.452723],[-2.973289,7.61703,-.623653],[-2.95509,8.924462,-3.446319],[2.861402,.562592,2.184397],[-1.109725,8.594206,-.076812],[-.725722,7.924485,-.381133],[-1.485587,1.329994,-.654405],[-4.342113,3.233735,1.752922],[-2.968049,7.955519,-2.09405],[-3.130948,.446196,.85287],[-4.958475,5.757329,1.447055],[-3.086547,7.615193,-1.953168],[-3.751923,5.412821,3.373373],[-4.599645,7.480953,1.677134],[1.133992,.274871,.032249],[-2.956512,8.126905,-1.785461],[-.960645,4.73065,-1.191786],[-2.871064,.875559,.424881],[-4.932114,5.99614,1.483845],[-2.981761,8.124612,-1.387276],[.362298,8.978545,-1.368024],[-4.408375,3.046271,.602373],[2.865841,2.322263,-1.344625],[-4.7848,5.620895,.594432],[-2.88322,.338931,1.67231],[-4.688101,6.772931,1.872318],[-4.903948,6.164698,1.27135],[2.85663,1.005647,-.906843],[2.691286,.209811,.050512],[-4.693636,6.477556,.665796],[-4.472331,6.861067,.477318],[.883065,.204907,3.073933],[-.995867,8.048729,-.653897],[-.794663,5.670397,-.390119],[3.313153,1.638006,-.722289],[-4.856459,5.394758,1.032591],[-3.005448,7.783023,-.819641],[3.11891,2.036974,-1.08689],[-2.364319,2.408419,2.63419],[-2.927132,8.75435,-3.537159],[-3.296222,7.964629,-3.134625],[-1.642041,4.13417,-1.301665],[2.030759,.176372,-1.030923],[-4.559069,3.751053,.548453],[3.438385,4.59454,-.243215],[-2.561769,7.93935,.177696],[2.990593,1.335314,-.943177],[1.2808,.276396,-.49072],[-.318889,.290684,.211143],[3.54614,3.342635,-.767878],[-3.073372,7.780018,-2.357807],[-4.455388,4.387245,.361038],[-4.659393,6.276064,2.767014],[.636799,4.482223,-1.426284],[-2.987681,8.072969,-2.45245],[-2.610445,.763554,1.792054],[3.358241,2.006707,-.802973],[-.498347,.251594,.962885],[3.1322,.683312,2.038777],[-4.389801,7.493776,.690247],[.431467,4.22119,-1.614215],[-4.376181,3.213141,.273255],[-4.872319,5.715645,.829714],[-4.826893,6.195334,.849912],[3.516562,2.23732,-.677597],[3.131656,1.698841,-.975761],[-4.754925,5.411666,1.989303],[-2.987299,7.320765,-.629479],[-3.757635,3.274862,-.744022],[3.487044,2.541999,-.699933],[-4.53274,4.649505,.77093],[-1.424192,.099423,2.633327],[3.090867,2.476975,-1.146957],[-2.713256,.815622,2.17311],[3.348121,3.254167,-.984896],[-3.031379,.16453,-.309937],[-.949757,4.518137,-1.309172],[-.889509,.095256,1.288803],[3.539594,1.966105,-.553965],[-4.60612,7.127749,.811958],[-2.332953,1.444713,1.624548],[3.136293,2.95805,-1.138272],[3.540808,3.069058,-.735285],[3.678852,2.362375,-.452543],[-4.648898,7.37438,.954791],[-.646871,.19037,3.344746],[2.2825,.29343,-.826273],[-4.422291,7.183959,.557517],[-4.694668,5.246103,2.541768],[-4.583691,4.145486,.600207],[-2.934854,7.912513,-1.539269],[-3.067861,7.817472,-.546501],[3.825095,3.229512,-.237547],[2.532494,.323059,2.387105],[-2.514583,.692857,1.23597],[-4.736805,7.214384,1.259421],[-2.98071,8.409903,-2.468199],[2.621468,1.385844,-1.406355],[3.811447,3.560855,1.847828],[3.432925,1.497205,-.489784],[3.746609,3.631538,-.39067],[3.594909,2.832257,-.576012],[-.404192,5.300188,-.856561],[-4.762996,6.483774,1.702648],[-4.756612,6.786223,1.43682],[-2.965309,8.437217,-2.785495],[2.863867,.74087,-.429684],[4.02503,2.968753,1.392419],[3.669036,1.833858,-.304971],[-2.888864,.720537,.778057],[-2.36982,.979443,1.054447],[-2.959259,8.222303,-2.659724],[-3.467825,7.545739,-2.333445],[2.153426,.446256,-1.20523],[-3.229807,9.189699,-3.596609],[-3.72486,8.773707,-2.046671],[3.687218,3.297751,-.523746],[1.381025,.08815,-1.185668],[-2.796828,7.205622,-.208783],[3.647194,4.066232,-.291507],[-4.578376,3.885556,1.52546],[-2.840262,.63094,1.89499],[-2.429514,.922118,1.820781],[-4.675079,6.573925,2.423363],[2.806207,4.320188,-1.027372],[-1.289608,.097241,1.321661],[-3.010731,8.141334,-2.866148],[3.202291,1.235617,-.549025],[4.094792,2.477519,.304581],[2.948403,.966873,-.664857],[-4.83297,5.920587,2.095461],[-2.169693,7.257277,.946184],[-1.335807,3.057597,-1.303166],[-1.037877,.64151,-1.685271],[2.627919,.089814,.439074],[3.815794,3.808102,1.730493],[-2.973455,8.433141,-3.08872],[-2.391558,7.331428,1.658264],[-4.333107,4.529978,1.850516],[-4.640293,3.767107,1.168841],[3.600716,4.46931,1.734024],[3.880803,1.730158,-.172736],[3.814183,4.262372,1.167042],[4.37325,.829542,1.413729],[2.490447,5.75111,.011492],[3.460003,4.962436,1.188971],[3.918419,3.814234,1.358271],[-.807595,8.840504,-.953711],[3.752855,4.20577,1.57177],[-2.991085,8.816501,-3.244595],[-2.333196,7.128889,1.551985],[3.977718,3.570941,1.25937],[4.360071,.755579,1.079916],[4.637579,1.027973,1.032567],[-2.317,7.421066,1.329589],[-1.013404,8.293662,-.7823],[4.548023,1.020644,1.420462],[4.763258,1.266798,1.296203],[4.896,2.073084,1.255213],[4.015005,3.325226,1.093879],[4.94885,1.860936,.894463],[-2.189645,6.954634,1.270077],[4.887442,1.720992,1.288526],[-3.184068,7.871802,.956189],[-1.274318,.839887,-1.224389],[-2.919521,7.84432,.541629],[-2.994586,7.766102,1.96867],[-3.417504,9.241714,-3.093201],[-3.174563,7.466456,2.473617],[-3.263067,9.069412,-3.003459],[-2.841592,.529833,2.693434],[-3.611069,9.158804,-2.829871],[-4.642828,5.927526,.320549],[-3.809308,9.051035,-2.692749],[-2.837582,7.487987,-.106206],[4.773025,2.330442,1.213899],[4.897435,2.209906,.966657],[-3.067637,8.164062,-1.12661],[-3.122129,8.08074,-.899194],[4.571019,2.358113,1.462054],[4.584884,2.454418,.709466],[-3.661093,7.146581,-.475948],[4.735131,2.415859,.933939],[4.207556,2.540018,1.218293],[-3.607595,7.89161,-.121172],[-1.527952,.775564,-1.061903],[4.53874,2.503273,1.099583],[-3.938837,7.587988,.082449],[-4.853582,6.152409,1.787943],[-4.752214,6.247234,2.296873],[4.602935,2.363955,.488901],[-1.81638,6.365879,.868272],[.595467,4.744074,-1.32483],[1.87635,3.511986,-1.842924],[4.330947,2.534326,.720503],[4.108736,2.750805,.904552],[-1.890939,8.492628,-.290768],[-3.504309,6.173058,-.422804],[-1.611992,6.196732,.648736],[-3.899149,7.826123,1.088845],[-3.078303,3.008813,-1.035784],[-2.798999,7.844899,1.340061],[-1.248839,5.959105,.041761],[.767779,4.337318,3.090817],[-3.831177,7.515605,2.432261],[-1.667528,6.156208,.365267],[-1.726078,6.237384,1.100059],[-3.972037,4.520832,-.370756],[-4.40449,7.636357,1.520425],[-1.34506,6.004054,1.293159],[-1.233556,6.049933,.500651],[-3.696869,7.79732,.37979],[-3.307798,8.949964,-2.698113],[-1.997295,6.615056,1.103691],[-3.219222,8.336394,-1.150614],[-3.452623,8.31866,-.9417],[-3.94641,2.990494,2.212592],[-3.250025,8.030414,-.596097],[-2.02375,1.571333,2.397939],[-3.190358,7.665013,2.268183],[-2.811918,7.618526,2.145587],[-1.005265,5.892303,.072158],[-.93721,5.974148,.906669],[-4.646072,7.492193,1.45312],[-.252931,1.797654,3.140638],[-1.076064,5.738433,1.695953],[-3.980534,7.744391,1.735791],[-.721187,5.939396,.526032],[-.42818,5.919755,.229001],[-1.43429,6.11622,.93863],[-.985638,5.939683,.290636],[-4.433836,7.461372,1.966437],[-3.696398,7.844859,1.547325],[-3.390772,7.820186,1.812204],[-2.916787,7.864019,.804341],[-3.715952,8.037269,-.591341],[-4.204634,7.72919,1.119866],[-4.592233,5.592883,.246264],[3.307299,5.061701,1.622917],[-3.515159,7.601467,2.368914],[-3.435742,8.533457,-1.37916],[-.269421,4.545635,-1.366445],[-2.542124,3.768736,-1.258512],[-3.034003,7.873773,1.256854],[-2.801399,7.856028,1.080137],[3.29354,5.220894,1.081767],[-2.35109,1.299486,1.01206],[-3.232213,7.768136,2.047563],[3.290415,5.217525,.68019],[-3.415109,7.731034,2.144326],[3.440357,4.962463,.373387],[3.147346,5.352121,1.386923],[2.847252,5.469051,1.831981],[3.137682,5.410222,1.050188],[3.102694,5.310456,1.676434],[-3.044601,.39515,1.994084],[2.903647,5.561338,1.518598],[-3.810148,8.093598,-.889131],[4.234835,.803054,1.593271],[3.240165,5.228747,.325955],[3.037452,5.509825,.817137],[2.635031,5.795187,1.439724],[3.071607,5.318303,.080142],[2.909167,5.611751,1.155874],[3.044889,5.465928,.486566],[2.502256,5.770673,1.740054],[-.067497,.086416,-1.190239],[2.33326,5.906051,.138295],[.65096,4.205423,3.308767],[-2.671137,7.936535,.432731],[2.14463,5.879214,1.866047],[-4.776469,5.890689,.561986],[2.72432,5.655145,.211951],[2.730488,5.751455,.695894],[2.572682,5.869295,1.152663],[1.906776,5.739123,2.196551],[2.344414,5.999961,.772922],[-3.377905,7.448708,-1.863251],[2.285149,5.968156,1.459258],[2.385989,5.928974,.3689],[2.192111,6.087516,.959901],[2.36372,6.001101,1.074346],[1.972022,6.079603,1.591175],[1.87615,5.976698,1.91554],[-3.824761,9.05372,-2.928615],[2.044704,6.129704,1.263111],[-2.583046,.849537,2.497344],[-.078825,2.342205,3.520322],[-.704686,.537165,3.397194],[-.257449,3.235334,3.647545],[-.332064,1.448284,3.022583],[-2.200146,.898284,-.447212],[-2.497508,1.745446,1.829167],[.30702,4.416315,2.978956],[-3.205197,3.479307,-1.040582],[.110069,9.347725,-1.563686],[-.82754,.883886,3.065838],[-2.017103,1.244785,2.42512],[-.421091,2.309929,3.153898],[-.491604,3.796072,3.16245],[2.786955,3.501241,-1.340214],[-3.229055,4.380713,-.899241],[3.730768,.76845,1.90312],[-.561079,2.652382,3.152463],[-3.461471,3.086496,2.662505],[-.661405,3.446009,3.179939],[-.915351,.636755,3.243708],[-2.992964,8.915628,-3.729833],[-.439627,3.502104,3.42665],[-1.154217,.883181,2.800835],[-1.736193,1.465474,2.595489],[-.423928,3.24435,3.548277],[-.511153,2.871046,3.379749],[-.675722,2.991756,3.143262],[-1.092602,.599103,3.090639],[-.89821,2.836952,2.840023],[-2.658412,.781376,.960575],[-2.271455,1.222857,1.330478],[-.877861,1.111222,2.72263],[-.306959,2.876987,3.556044],[-3.839274,7.84138,-.918404],[-.172094,4.083799,3.141708],[-1.548332,.2529,2.864655],[-.217353,4.873911,-1.223104],[-3.384242,3.181056,-.95579],[-2.731704,.382421,2.895502],[-1.285037,.551267,2.947675],[.077224,4.246579,3.066738],[-.479979,1.77955,2.860011],[-.716375,1.224694,2.666751],[-.54622,3.138255,3.393457],[-2.33413,1.821222,2.124883],[-.50653,2.037147,2.897465],[2.451291,1.211389,-1.466589],[-3.160047,2.894081,2.724286],[-4.137258,5.433431,3.21201],[.462896,.320456,-.174837],[-.37458,2.609447,3.379253],[-3.095244,.256205,2.196446],[-4.197985,5.732991,3.262924],[-.729747,.246036,.497036],[-2.356189,5.062,-.965619],[-1.609036,.25962,-1.487367],[-4.074381,6.074061,3.409459],[-3.619304,4.0022,2.65705],[-.543393,8.742896,-1.056622],[-4.30356,6.858934,2.879642],[-.716688,2.901831,-2.11202],[1.547362,.083189,1.138764],[-.250916,.275268,1.201344],[-3.778035,3.13624,2.466177],[-4.594316,5.771342,3.01694],[-3.717706,3.442887,2.603344],[-4.311163,5.224669,3.019373],[-.610389,2.095161,-1.923515],[-3.040086,6.196918,-.429149],[-3.802695,3.768247,2.545523],[-.159541,2.043362,3.328549],[-3.744329,4.31785,2.491889],[-3.047939,.214155,1.873639],[-4.41685,6.113058,3.166774],[-1.165133,.460692,-1.742134],[-1.371289,4.249996,-1.317935],[-3.447883,.3521,.466205],[-4.495555,6.465548,2.944147],[-3.455335,.171653,.390816],[-3.964028,4.017196,2.376009],[-1.323595,1.763126,-.750772],[-3.971142,5.277524,-.19496],[-3.222052,.237723,.872229],[-4.403784,3.89107,1.872077],[-3.333311,.342997,.661016],[-4.495871,4.29606,1.63608],[-3.636081,2.760711,2.361949],[-4.487235,3.559608,1.66737],[-4.719787,7.26888,1.658722],[-1.086143,9.035741,-.707144],[-2.339693,1.600485,-.404817],[-4.642011,7.123829,1.990987],[-1.498077,3.854035,-1.369787],[-4.188372,4.729363,2.02983],[-3.116344,5.882284,-.468884],[-4.305236,4.246417,1.976991],[-3.022509,.22819,1.065688],[-2.799916,.52022,1.128319],[-4.262823,3.534409,2.020383],[-4.221533,3.947676,2.11735],[-3.744353,4.391712,-.6193],[-1.272905,.156694,-1.741753],[-3.62491,2.669825,-.549664],[-4.180756,3.096179,1.987215],[-4.059276,4.305313,2.232924],[-2.812753,.183226,1.370267],[-4.032437,3.512234,2.309985],[-.03787,.28188,.530391],[-4.711562,5.468653,2.822838],[-4.500636,6.953314,2.564445],[-4.479433,7.216991,2.270682],[3.990562,.50522,.716309],[-2.512229,6.863447,-.100658],[-2.968058,6.956639,-.37061],[2.550375,3.142683,-1.54068],[-2.320059,3.521605,-1.279397],[-4.556319,6.64662,2.745363],[-4.281091,7.108116,2.667598],[-2.050095,8.411689,.121353],[-2.44854,1.135487,.851875],[3.121815,.699943,-.277167],[-4.69877,6.00376,2.843035],[-1.360599,8.824742,-.595597],[1.128437,.171611,.301691],[-4.360146,6.289423,.042233],[1.400795,4.088829,-1.620409],[-3.193462,8.460137,-3.559446],[-3.168771,8.878431,-3.635795],[-3.434275,9.304302,-3.460878],[-3.349993,8.808093,-3.38179],[-3.304823,8.323865,-3.325905],[-3.572607,9.308843,-3.207672],[-3.166393,8.201215,-3.43014],[-3.451638,9.05331,-3.351345],[-3.309591,8.549758,-3.375055],[-3.527992,8.793926,-3.100376],[-3.6287,8.981677,-3.076319],[-3.445505,8.001887,-2.8273],[-3.408011,8.221014,-3.039237],[-3.65928,8.740382,-2.808856],[-3.878019,8.797295,-2.462866],[-3.515132,8.232341,-2.747739],[-3.460331,8.51524,-3.06818],[-3.403703,7.658628,-2.648789],[-3.507113,8.00159,-2.582275],[-3.607373,8.174737,-2.401723],[-3.749043,8.378084,-2.226959],[-3.648514,8.502213,-2.6138],[-2.534199,.904753,2.021148],[1.4083,5.744252,-.571402],[-3.852536,8.571009,-2.352358],[2.868255,5.373126,-.163705],[2.224363,4.669891,-1.061586],[-4.528281,4.885838,1.340274],[1.30817,4.609629,-1.28762],[-4.519698,3.422501,1.354826],[-3.549955,7.783228,-2.332859],[1.12313,6.120856,.045115],[-3.620324,7.57716,-2.033423],[-.798833,2.624133,-1.992682],[-3.617587,7.783148,-2.051383],[-3.669293,8.103776,-2.10227],[-3.892417,8.667436,-2.167288],[-.537435,.285345,-.176267],[-.841522,3.299866,-1.887861],[-.761547,3.647082,-1.798953],[-3.661544,7.85708,-1.867924],[-3.886763,8.551783,-1.889171],[-.591244,1.549749,-1.714784],[-.775276,1.908218,-1.597609],[-.961458,2.573273,-1.695549],[-2.215672,1.335009,2.143031],[-4.622674,4.130242,1.220683],[1.07344,.290099,1.584734],[-.976906,2.92171,-1.76667],[-1.13696,3.194401,-1.513455],[-3.743262,7.99949,-1.629286],[-2.876359,4.900986,-.879556],[.550835,3.905557,-2.031372],[.777647,4.992314,-1.215703],[1.445881,4.266201,-1.414663],[1.274222,5.510543,-.824495],[-.864685,2.318581,-1.702389],[-.627458,3.820722,-1.743153],[-3.867699,8.30866,-1.850066],[1.635287,5.45587,-.83844],[-1.037876,2.538589,-1.513504],[-4.38993,4.73926,1.699639],[.048709,4.765232,-1.279506],[-.626548,1.339887,-1.595114],[-3.682827,7.643453,-1.723398],[-3.868783,8.180191,-1.511743],[-.76988,1.508373,-1.419599],[-1.138374,2.766765,-1.448163],[1.699883,5.780752,-.475361],[1.214305,.308517,1.866405],[-1.713642,.373461,-1.265204],[-1.582388,.58294,-1.267977],[-.879549,1.821581,-1.313787],[.519057,5.858757,-.381397],[-3.770989,2.449208,-.132655],[.087576,.156713,-1.53616],[-.942622,2.146534,-1.421494],[-1.026192,1.022164,-1.145423],[-.964079,1.645473,-1.067631],[-1.109128,2.458789,-1.29106],[-1.037478,.209489,-1.805424],[-3.724391,7.599686,-1.273458],[-3.787898,7.951792,-1.304794],[3.821677,2.165581,-.181535],[-2.39467,.304606,-.570375],[-2.352928,1.0439,2.079369],[-.288899,9.640684,-1.006079],[-3.472118,7.263001,-1.080326],[-1.240769,.972352,-.976446],[-1.845253,.356801,-.995574],[-2.32279,7.915361,-.057477],[-1.08092,2.179315,-1.168821],[4.598833,2.156768,.280264],[-4.725417,6.442373,2.056809],[-.490347,9.46429,-.981092],[-1.99652,.09737,-.765828],[-1.137793,1.888846,-.894165],[-.37247,4.29661,-1.465199],[-.184631,5.692946,-.421398],[-3.751694,7.742231,-1.086908],[-1.001416,1.298225,-.904674],[-3.536884,7.190777,-.788609],[-3.737597,7.511281,-.940052],[-1.766651,.669388,-.873054],[3.112245,3.474345,-1.129672],[-.175504,3.81298,-2.0479],[-3.766762,7.412514,-.681569],[-.63375,9.439424,-.785128],[-.518199,4.768982,-1.258625],[.790619,4.212759,-1.610218],[-3.761951,3.742528,-.756283],[.897483,5.679808,-.612423],[2.221126,4.427468,-1.252155],[-.728577,5.846457,.062702],[.194451,9.503908,-1.482461],[-.099243,9.385459,-1.39564],[.643185,3.636855,-2.180247],[.894522,5.900601,-.356935],[2.595516,4.75731,-.893245],[1.108497,3.936893,-1.905098],[1.989894,5.789726,-.343268],[-3.802345,7.655508,-.613817],[2.339353,4.96257,-.90308],[.12564,4.013324,-1.879236],[-4.078965,3.683254,-.445439],[2.092899,5.256128,-.831607],[.427571,.291769,1.272964],[2.335549,3.480056,-1.581949],[-.15687,.324827,-1.648922],[-.536522,5.760786,-.203535],[1.507082,.078251,-.923109],[-1.854742,.134826,2.698774],[-3.939827,3.168498,-.526144],[-3.98461,3.39869,-.533212],[-3.961738,4.217132,-.489147],[4.273789,2.181164,.153786],[-.470498,5.645664,-.439079],[-.414539,5.488017,-.673379],[-.097462,5.062739,-1.114863],[1.198092,5.882232,-.391699],[2.855834,5.085022,-.498678],[1.037998,4.129757,-1.701811],[1.728091,5.068444,-1.063761],[-3.832258,2.625141,-.311384],[-4.078526,3.070256,-.284362],[-4.080365,3.954243,-.440471],[-.152578,5.276267,-.929815],[-1.489635,8.928082,-.295891],[.759294,5.15585,-1.087374],[-4.000338,2.801647,-.235135],[-4.290801,3.823209,-.19374],[-4.221493,4.25618,-.189894],[-4.066195,4.71916,-.201724],[-.155386,4.076396,-1.662865],[3.054571,4.414305,-.825985],[-1.652919,8.726499,-.388504],[-3.042753,.560068,-.126425],[-2.434456,1.118088,-.213563],[-2.623502,1.845062,-.283697],[-4.233371,3.43941,-.202918],[2.726702,3.82071,-1.280097],[.184199,4.14639,-1.673653],[-1.289203,.624562,-1.560929],[-3.823676,7.382458,-.407223],[.476667,5.064419,-1.143742],[-3.873651,4.955112,-.269389],[1.349666,5.312227,-1.000274],[-2.043776,8.434488,-.108891],[-2.763964,.733395,-.129294],[-4.380505,3.664409,-.024546],[-.71211,5.341811,-.803281],[-3.960858,7.183112,-.118407],[-3.822277,7.712853,-.263221],[-2.346808,8.108588,.063244],[-1.841731,8.642999,-.142496],[-2.600055,.985604,-.043595],[-3.513057,2.213243,-.044151],[-3.963492,2.603055,-.080898],[-4.258066,3.14537,-.027046],[-4.261572,5.00334,.13004],[.795464,3.99873,-1.905688],[-3.300873,.384761,.013271],[-2.770244,.881942,.077313],[-3.456227,1.993871,.301054],[-4.441987,3.914144,.177867],[-4.367075,6.611414,.165312],[-3.201767,.576292,.105769],[-3.174354,.645009,.440373],[-2.996576,.74262,.161325],[-2.724979,1.656497,.092983],[-3.261757,2.017742,-.070763],[-4.280173,4.518235,-.002999],[-4.471073,5.945358,.05202],[-3.877137,2.40743,.274928],[-4.371219,4.252758,.078039],[-3.400914,.40983,.238599],[-4.44293,3.523242,.146339],[-4.574528,5.279761,.353923],[-4.226643,7.191282,.269256],[-4.16361,2.843204,.097727],[-4.528506,5.011661,.536625],[.35514,5.664802,-.572814],[2.508711,5.580976,-.266636],[2.556226,3.633779,-1.426362],[1.878456,4.533714,-1.223744],[2.460709,4.440241,-1.1395],[2.218589,5.514603,-.560066],[2.263712,5.737023,-.250694],[2.964981,3.814858,-1.139927],[.991384,5.304131,-.999867],[2.81187,4.547292,-.916025],[2.918089,4.768382,-.702808],[3.262403,4.414286,-.657935],[.652136,6.089113,.069089],[3.361389,3.5052,-.946123],[2.613042,5.037192,-.697153],[.094339,4.36858,-1.451238],[3.290862,4.155716,-.732318],[2.658063,4.073614,-1.217455],[3.260349,3.753257,-.946819],[1.124268,4.862463,-1.207855],[3.35158,4.899247,-.027586],[3.194057,4.691257,-.524566],[3.090119,5.116085,-.23255],[2.418965,3.811753,-1.419399],[2.191789,3.877038,-1.47023],[4.043166,2.034188,.015477],[-1.026966,.86766,-1.410912],[1.937563,3.860005,-1.617465],[2.98904,4.101806,-.998132],[-.142611,5.865305,-.100872],[3.972673,2.292069,.089463],[3.23349,3.959925,-.849829],[.16304,5.857276,-.216704],[4.122964,1.770061,-.114906],[2.099057,4.978374,-.98449],[3.502411,3.76181,-.667502],[2.079484,5.939614,-.036205],[-.084568,3.525193,-2.253506],[.423859,4.06095,-1.845327],[1.6013,6.006466,-.153429],[.271701,3.844964,-2.078748],[.273577,5.218904,-.994711],[-.410578,3.92165,-1.773635],[1.941954,5.60041,-.621569],[.100825,5.462131,-.774256],[-.53016,3.619892,-2.027451],[-.822371,5.517453,-.605747],[-2.474925,7.670892,-.020174],[4.01571,.830194,-.013793],[-.400092,5.094112,-1.041992],[-2.887284,5.581246,-.525324],[-1.559841,6.050972,.079301],[-.469317,3.291673,-2.235211],[.337397,3.467926,-2.295458],[-2.632074,5.573701,-.582717],[-.030318,6.011395,.276616],[-.934373,.388987,-1.780523],[-2.661263,5.844838,-.425966],[.549353,5.489646,-.807268],[-2.194355,6.197491,-.109322],[-2.289618,5.664813,-.581098],[1.583583,3.796366,-1.844498],[.855295,.215979,-1.425557],[-2.627569,5.300236,-.767174],[4.333347,2.384332,.399129],[-1.880401,5.583843,-.696561],[-2.172346,5.324859,-.846246],[-2.27058,5.906265,-.388373],[-1.960049,5.889346,-.397593],[.965756,3.67547,-2.105671],[-2.014066,6.431125,.287254],[-1.776173,5.287097,-.89091],[-2.025852,5.089562,-.980218],[-1.886418,6.108358,-667e-6],[-1.600803,5.785347,-.491069],[-1.66188,4.968053,-1.042535],[-1.600621,5.962818,-.188044],[-1.588831,5.615418,-.665456],[4.46901,1.880138,.057248],[-1.978845,.927399,-.554856],[-1.408074,5.325266,-.83967],[1.923123,4.843955,-1.101389],[-2.87378,.117106,-.412735],[-1.222193,5.62638,-.539981],[-2.632537,.166349,-.489218],[-1.370865,5.838832,-.341026],[-1.067742,5.448874,-.692701],[-1.073798,5.220878,-.908779],[-1.147562,4.950417,-1.079727],[-2.789115,4.531047,-1.042713],[-3.550826,4.170487,-.806058],[-3.331694,4.798177,-.69568],[-3.689404,4.688543,-.534317],[-3.511509,5.106246,-.483632],[1.796344,.076137,.080455],[-3.306354,5.473605,-.478764],[-2.692503,3.346604,-1.20959],[-3.963056,5.187462,3.113156],[-3.901231,6.391477,-.246984],[4.484234,1.518638,-.001617],[4.308829,1.657716,-.119275],[4.290045,1.339528,-.110626],[-3.514938,3.524974,-.909109],[-2.1943,2.12163,-.71966],[4.108206,1.091087,-.11416],[3.785312,1.392435,-.28588],[4.092886,1.480476,-.210655],[-2.965937,6.469006,-.379085],[-3.708581,2.962974,-.63979],[-3.297971,2.218917,-.299872],[3.806949,.804703,-.11438],[3.747957,1.059258,-.273069],[-3.101827,4.111444,-1.006255],[-1.536445,4.658913,-1.195049],[-3.549826,2.450555,-.375694],[-3.676495,2.108366,.534323],[-3.674738,5.925075,-.400011],[-2.250115,2.848335,-1.121174],[-3.698062,5.667567,-.381396],[3.468966,.734643,-.190624],[-3.97972,5.670078,-.26874],[-3.002087,4.337837,-1.033421],[-3.356392,2.608308,-.713323],[-1.833016,3.359983,-1.28775],[-1.989069,3.632416,-1.305607],[3.591254,.542371,.026146],[3.364927,1.082572,-.342613],[-3.393759,3.866801,-.937266],[-4.124865,5.549529,-.161729],[-4.423423,5.687223,103e-6],[-1.496881,2.601785,-1.114328],[-2.642297,6.496932,-.264175],[-3.684236,6.819423,-.320233],[-2.286996,3.167067,-1.246651],[-1.624896,8.44848,-.530014],[-3.666787,2.159266,.268149],[-2.402625,2.011243,-.56446],[-2.736166,2.259839,-.6943],[-2.168611,3.89078,-1.292206],[-2.065956,3.345708,-1.281346],[-2.778147,2.675605,-.995706],[-3.507431,4.513272,-.71829],[-2.301184,4.293911,-1.238182],[3.205808,.211078,.394349],[-2.129936,4.870577,-1.080781],[-2.287977,2.496593,-.934069],[-2.701833,2.931814,-1.114509],[3.294795,.50631,-.081062],[-2.552829,7.468771,-.021541],[3.06721,.944066,-.43074],[-2.86086,1.973622,-.303132],[-3.598818,5.419613,-.401645],[-1.524381,.080156,-1.61662],[-1.907291,2.646274,-1.039438],[2.950783,.407562,-.105407],[-1.663048,1.655038,-.689787],[-1.728102,1.110064,-.635963],[-2.085823,7.686296,-.159745],[2.883518,3.157009,-1.30858],[-2.724116,.417169,-.389719],[-1.788636,7.862672,-.346413],[-2.186418,1.249609,-.434583],[-3.092434,2.606657,-.860002],[-1.737314,3.874201,-1.330986],[2.564522,.422967,-.390903],[1.670782,3.538432,-1.924753],[-2.338131,4.02578,-1.286673],[-1.916516,4.054121,-1.301788],[2.87159,2.034949,-1.267139],[-1.931518,3.062883,-1.197227],[-.816602,.135682,3.104104],[.469392,.213916,-1.489608],[2.574055,1.950091,-1.514427],[2.733595,2.682546,-1.461213],[-1.915407,4.693647,-1.151721],[-3.412883,5.867094,-.450528],[2.28822,.120432,-.04102],[2.244477,.14424,-.376933],[-1.676198,3.570698,-1.328031],[-1.821193,4.366982,-1.266271],[-1.552208,8.099221,-.53262],[-1.727419,2.39097,-.989456],[-2.468226,4.711663,-1.069766],[-2.451669,6.113319,-.273788],[2.635447,2.295842,-1.518361],[-2.020809,8.150253,-.246714],[2.292455,.805596,-1.3042],[2.641556,1.65665,-1.466962],[2.409062,2.842538,-1.635025],[2.456682,1.459484,-1.57543],[-1.691047,3.173582,-1.247082],[-1.865642,1.957608,-.768683],[-3.401579,.20407,.100932],[2.301981,1.7102,-1.650461],[2.342929,2.611944,-1.690713],[-1.676111,2.923894,-1.17835],[-2.992039,3.547631,-1.118945],[-3.571677,6.504634,-.375455],[2.141764,1.460869,-1.702464],[-3.221958,5.146049,-.615632],[2.19238,2.949367,-1.747242],[2.320791,2.232971,-1.706842],[2.088678,2.585235,-1.813159],[-2.196404,.592218,-.569709],[-2.120811,1.836483,-.62338],[-1.949935,2.271249,-.874128],[2.235901,1.110183,-1.510719],[2.020157,3.241128,-1.803917],[2.054336,1.949394,-1.792332],[-3.094117,4.996595,-.740238],[2.038063,.635949,-1.402041],[1.980644,1.684408,-1.76778],[1.587432,3.306542,-1.991131],[1.935322,.976267,-1.602208],[1.922621,1.235522,-1.698813],[1.712495,1.911874,-1.903234],[1.912802,2.259273,-1.888698],[1.884367,.355453,-1.312633],[1.676427,.76283,-1.539455],[1.78453,2.83662,-1.943035],[1.697312,.120281,-1.150324],[1.648318,2.484973,-1.999505],[-4.051804,5.958472,-.231731],[-1.964823,1.464607,-.58115],[1.55996,2.183486,-1.971378],[1.628125,1.045912,-1.707832],[1.701684,1.540428,-1.827156],[1.567475,4.869481,-1.184665],[1.432492,.843779,-1.648083],[1.173837,2.978983,-2.156687],[1.235287,3.37975,-2.09515],[1.252589,1.525293,-1.949205],[1.159334,2.336379,-2.105361],[1.49061,2.695263,-2.083216],[-4.122486,6.782604,-.02545],[1.173388,.279193,-1.423418],[1.505684,.380815,-1.414395],[1.391423,1.343031,-1.843557],[1.263449,2.73225,-2.144961],[1.295858,.597122,-1.515628],[1.245851,3.729126,-1.993015],[-2.761439,6.23717,-.365856],[.978887,1.664888,-2.046633],[1.219542,.982729,-1.785486],[1.315915,1.91748,-2.02788],[-3.052746,2.127222,-.369082],[.977656,1.36223,-1.944119],[.936122,3.39447,-2.203007],[-2.740036,4.184702,-1.122849],[.853581,2.864694,-2.260847],[.719569,.818762,-1.763618],[.839115,1.159359,-1.907943],[.932069,1.94559,-2.117962],[.579321,3.326747,-2.299369],[.86324,.597822,-1.565106],[.574567,1.158452,-1.943123],[.525138,2.137252,-2.213867],[.779941,2.342019,-2.206157],[.915255,2.618102,-2.209041],[.526426,3.02241,-2.321826],[.495431,2.521396,-2.295905],[.80799,3.156817,-2.286432],[.273556,1.304936,-2.012509],[.664326,1.530024,-2.048722],[.219173,2.32907,-2.323212],[.405324,.695359,-1.704884],[.398827,.946649,-1.843899],[.345109,1.608829,-2.100174],[-2.356743,.062032,-.4947],[-3.001084,.27146,2.560034],[-2.064663,.303055,-.697324],[.221271,3.174023,-2.374399],[.195842,.437865,-1.621473],[-.385613,.297763,1.960096],[1.999609,.108928,-.79125],[.351698,9.227494,-1.57565],[.021477,2.191913,-2.309353],[.246381,2.836575,-2.356365],[1.543281,.237539,1.901906],[.031881,9.147022,-1.454203],[-.001881,1.648503,-2.108044],[.333423,1.907088,-2.204533],[.044063,2.634032,-2.368412],[-.028148,3.053684,-2.390082],[.02413,3.34297,-2.36544],[-.272645,9.02879,-1.238685],[-.006348,.832044,-1.758222],[-.321105,1.458754,-1.886313],[-.153948,8.618809,-1.105353],[-.409303,1.137783,-1.720556],[-.410054,1.742789,-1.957989],[-.287905,2.380404,-2.294509],[-.261375,2.646629,-2.356322],[-.221986,3.215303,-2.345844],[-.31608,.687581,-1.71901],[-.537705,.855802,-1.648585],[-.142834,1.193053,-1.87371],[-.24371,2.044435,-2.176958],[-.437999,2.959748,-2.299698],[-.78895,.176226,-1.729046],[-.608509,.546932,-1.734032],[-.693698,4.478782,-1.369372],[-.669153,8.469645,-.911149],[-.741857,1.082705,-1.458474],[-.554059,2.440325,-2.141785],[2.09261,.153182,2.57581],[1.792547,.111794,2.563777],[1.855787,.189541,2.835089],[1.492601,.232246,2.987681],[-.284918,.236687,3.429738],[2.604841,.11997,1.01506],[.331271,.168113,3.124031],[.280606,.308368,2.495937],[.544591,.325711,2.081274],[.193145,.19154,-.977556],[3.810099,.42324,1.032202],[3.54622,.379245,1.392814],[.61402,.276328,.849356],[-1.198628,.144953,2.911457],[4.17199,.68037,1.391526],[.88279,.321339,2.059129],[1.93035,.109992,2.054154],[1.620331,.121986,2.37203],[2.374812,.10921,1.734876],[-.031227,.294412,2.593687],[4.075018,.561914,1.038065],[-.570366,.126583,2.975558],[.950052,.318463,1.804012],[1.130034,.117125,.98385],[2.123049,.08946,1.665911],[2.087572,.068621,.335013],[2.927337,.167117,.289611],[.528876,.313434,3.205969],[1.174911,.162744,1.328262],[-4.88844,5.59535,1.661134],[-4.709607,5.165338,1.324082],[.871199,.277021,1.263831],[-3.910877,2.349318,1.272269],[1.56824,.118605,2.768112],[1.179176,.152617,-.858003],[1.634629,.247872,2.128625],[-4.627425,5.126935,1.617836],[3.845542,.54907,1.45601],[2.654006,.165508,1.637169],[-.678324,.26488,1.974741],[2.451139,.100377,.213768],[.633199,.286719,.403357],[-.533042,.2524,1.373267],[.99317,.171106,.624966],[-.100063,.306466,2.170225],[1.245943,.092351,.661031],[1.390414,.198996,-.0864],[-4.457265,5.030531,2.138242],[2.89776,.146575,1.297468],[1.802703,.088824,-.490405],[1.055447,.309261,2.392437],[2.300436,.142429,2.104254],[2.33399,.187756,2.416935],[2.325183,.134349,.574063],[2.410924,.370971,2.637115],[1.132924,.290511,3.061],[1.764028,.070212,-.80535],[2.156994,.397657,2.844061],[.920711,.225527,-.882456],[-4.552135,5.24096,2.85514],[.210016,.309396,2.064296],[.612067,.136815,-1.086002],[3.150236,.426757,1.802703],[-.24824,.282258,1.470997],[.974269,.301311,-.640898],[-4.401413,5.03966,2.535553],[.644319,.274006,-.817806],[.332922,.309077,.108474],[3.610001,.317447,.689353],[3.335681,.358195,.118477],[.623544,.318983,-.4193],[-.11012,.307747,1.831331],[-.407528,.291044,2.282935],[.069783,.285095,.950289],[.970135,.310392,-.283742],[.840564,.306898,.098854],[-.541827,.267753,1.683795],[-3.956082,4.55713,2.297164],[-4.161036,2.834481,1.64183],[-4.093952,4.977551,2.747747],[2.661819,.261867,1.926145],[-3.749926,2.161875,.895238],[-2.497776,1.3629,.791855],[.691482,.304968,1.582939],[-4.013193,4.830963,2.4769],[-3.639585,2.091265,1.304415],[-3.9767,2.563053,1.6284],[-3.979915,2.788616,1.977977],[.388782,.312656,1.709168],[-3.40873,1.877324,.851652],[-3.671637,5.136974,3.170734],[-3.12964,1.852012,.157682],[-3.629687,4.852698,2.686837],[-3.196164,1.793459,.452804],[-3.746338,2.31357,1.648551],[2.992192,.125251,.575976],[-3.254051,.054431,.314152],[-3.474644,1.925288,1.134116],[-3.418372,2.022882,1.578901],[-2.920955,1.705403,.29842],[-3.57229,2.152022,1.607572],[-3.251259,.09013,-.106174],[-3.299952,1.877781,1.348623],[-3.666819,2.441459,2.004838],[-2.912646,1.824748,-.045348],[-3.399511,2.479484,2.340393],[-3.009754,.015286,.075567],[-3.381443,2.316937,2.156923],[-3.352801,2.133341,1.857366],[-3.01788,1.687685,.645867],[-2.931857,1.678712,1.158472],[-3.301008,.08836,.591001],[1.358025,.19795,1.599144],[-2.999565,1.845016,1.618396],[-2.767957,.028397,-.196436],[-2.93962,2.078779,2.140593],[-3.346648,2.674056,2.518097],[3.324322,.20822,.628605],[3.091677,.137202,.9345],[-2.881807,.009952,.318439],[-2.764946,1.786619,1.693439],[-2.905542,1.932343,1.900002],[-3.140854,2.271384,2.274946],[-2.88995,2.487856,2.574759],[-2.367194,-943e-6,-.15576],[-3.050738,.068703,.742988],[-2.759525,1.55679,.877782],[-3.151775,2.48054,2.482749],[-2.578618,-.002885,.165716],[-2.651618,1.877246,1.981189],[-2.933973,.133731,1.631023],[1.047628,.100284,-1.085248],[-1.585123,.062083,-1.394896],[-2.287917,-.002671,.214434],[-2.524899,.007481,.471788],[-2.815492,2.188198,2.343294],[-2.095142,-.003149,-.094574],[-2.172686,-133e-6,.47963],[-2.732704,.074306,1.742079],[-2.49653,2.145668,2.42691],[-1.343683,.047721,-1.506391],[-2.581185,.048703,.975528],[-2.905101,.083158,2.010052],[-2.601514,2.007801,2.223089],[-2.339464,.02634,1.484304],[-2.907873,.10367,2.378149],[-1.368796,.062516,-1.049125],[-1.93244,.02443,-.427603],[-2.705081,.060513,2.303802],[3.372155,.206274,.892293],[-1.761827,.093202,-1.037404],[-1.700667,.0397,-.614221],[-1.872291,.011979,-.135753],[-1.929257,.074005,.728999],[-2.520128,.049665,1.99054],[-2.699411,.10092,2.603116],[3.211701,.27302,1.423357],[-1.445362,.1371,-.626491],[2.921332,.259112,1.645525],[-.993242,.058686,-1.408916],[-.944986,.157541,-1.097665],[-2.154301,.032749,1.882001],[-2.108789,1.988557,2.442673],[-1.015659,.25497,-.416665],[-1.898411,.015872,.16715],[-1.585517,.027121,.453445],[-2.311105,.061264,2.327061],[-2.637042,.152224,2.832201],[-2.087515,2.292972,2.617585],[-.750611,.056697,-1.504516],[-.472029,.075654,-1.360203],[-.710798,.139244,-1.183863],[-.97755,.26052,-.831167],[-.655814,.260843,-.880068],[-.897513,.275537,-.133042],[-2.049194,.084947,2.455422],[-.177837,.076362,-1.449009],[-.553393,.279083,-.59573],[-1.788636,.06163,2.231198],[-.34761,.255578,-.999614],[-1.398589,.036482,.65871],[-1.133918,.05617,.69473],[-1.43369,.058226,1.977865],[-2.505459,1.492266,1.19295]]; | |
exports.cells=[[2,1661,3],[1676,7,6],[712,1694,9],[3,1674,1662],[11,1672,0],[1705,0,1],[5,6,1674],[4,5,1674],[7,8,712],[2,1662,10],[1,10,1705],[11,1690,1672],[1705,11,0],[5,1676,6],[7,9,6],[7,712,9],[2,3,1662],[3,4,1674],[1,2,10],[12,82,1837],[1808,12,1799],[1808,1799,1796],[12,861,82],[861,1808,13],[1808,861,12],[1799,12,1816],[1680,14,1444],[15,17,16],[14,1678,1700],[16,17,1679],[15,1660,17],[14,1084,1678],[15,1708,18],[15,18,1660],[1680,1084,14],[1680,15,1084],[15,1680,1708],[793,813,119],[1076,793,119],[1076,1836,22],[23,19,20],[21,1076,22],[21,22,23],[23,20,21],[1076,119,1836],[806,634,470],[432,1349,806],[251,42,125],[809,1171,791],[953,631,827],[634,1210,1176],[157,1832,1834],[56,219,53],[126,38,83],[37,85,43],[59,1151,1154],[83,75,41],[77,85,138],[201,948,46],[1362,36,37],[452,775,885],[1237,95,104],[966,963,1262],[85,77,43],[36,85,37],[1018,439,1019],[41,225,481],[85,83,127],[93,83,41],[935,972,962],[116,93,100],[98,82,813],[41,75,225],[298,751,54],[1021,415,1018],[77,138,128],[766,823,1347],[593,121,573],[905,885,667],[786,744,747],[100,41,107],[604,334,765],[779,450,825],[968,962,969],[225,365,481],[365,283,196],[161,160,303],[875,399,158],[328,1817,954],[62,61,1079],[358,81,72],[74,211,133],[160,161,138],[91,62,1079],[167,56,1405],[56,167,219],[913,914,48],[344,57,102],[43,77,128],[1075,97,1079],[389,882,887],[219,108,53],[1242,859,120],[604,840,618],[754,87,762],[197,36,1362],[1439,88,1200],[1652,304,89],[81,44,940],[445,463,151],[717,520,92],[129,116,100],[1666,1811,624],[1079,97,91],[62,91,71],[688,898,526],[463,74,133],[278,826,99],[961,372,42],[799,94,1007],[100,93,41],[1314,943,1301],[184,230,109],[875,1195,231],[133,176,189],[751,755,826],[101,102,57],[1198,513,117],[748,518,97],[1145,1484,1304],[358,658,81],[971,672,993],[445,151,456],[252,621,122],[36,271,126],[85,36,126],[116,83,93],[141,171,1747],[1081,883,103],[1398,1454,149],[457,121,593],[127,116,303],[697,70,891],[457,891,1652],[1058,1668,112],[518,130,97],[214,319,131],[185,1451,1449],[463,133,516],[1428,123,177],[113,862,561],[215,248,136],[186,42,251],[127,83,116],[160,85,127],[162,129,140],[154,169,1080],[169,170,1080],[210,174,166],[1529,1492,1524],[450,875,231],[399,875,450],[171,141,170],[113,1155,452],[131,319,360],[44,175,904],[452,872,113],[746,754,407],[147,149,150],[309,390,1148],[53,186,283],[757,158,797],[303,129,162],[429,303,162],[154,168,169],[673,164,193],[38,271,75],[320,288,1022],[246,476,173],[175,548,904],[182,728,456],[199,170,169],[168,199,169],[199,171,170],[184,238,230],[246,247,180],[1496,1483,1467],[147,150,148],[828,472,445],[53,108,186],[56,53,271],[186,961,42],[1342,391,57],[1664,157,1834],[1070,204,178],[178,204,179],[285,215,295],[692,55,360],[192,193,286],[359,673,209],[586,195,653],[121,89,573],[202,171,199],[238,515,311],[174,210,240],[174,105,166],[717,276,595],[1155,1149,452],[1405,56,197],[53,283,30],[75,53,30],[45,235,1651],[210,166,490],[181,193,192],[185,620,217],[26,798,759],[1070,226,204],[220,187,179],[220,168,187],[202,222,171],[359,209,181],[182,456,736],[964,167,1405],[76,250,414],[807,1280,1833],[70,883,1652],[227,179,204],[221,199,168],[221,202,199],[360,494,131],[214,241,319],[105,247,166],[205,203,260],[388,480,939],[482,855,211],[8,807,1833],[226,255,204],[228,221,168],[166,173,490],[701,369,702],[211,855,262],[631,920,630],[1448,1147,1584],[255,227,204],[237,220,179],[228,168,220],[222,256,555],[215,259,279],[126,271,38],[108,50,186],[227,236,179],[236,237,179],[220,237,228],[228,202,221],[256,222,202],[555,256,229],[259,152,279],[27,1296,31],[186,50,961],[961,234,372],[1651,235,812],[1572,1147,1448],[255,226,1778],[255,236,227],[256,257,229],[106,184,109],[241,410,188],[177,578,620],[209,673,181],[1136,1457,79],[1507,245,718],[255,273,236],[275,410,241],[206,851,250],[1459,253,1595],[1406,677,1650],[228,274,202],[202,281,256],[348,239,496],[205,172,203],[369,248,702],[261,550,218],[261,465,550],[574,243,566],[921,900,1220],[291,273,255],[348,238,265],[109,230,194],[149,380,323],[443,270,421],[272,291,255],[274,228,237],[274,292,202],[281,257,256],[276,543,341],[152,259,275],[1111,831,249],[632,556,364],[299,273,291],[299,236,273],[280,237,236],[202,292,281],[247,246,173],[282,49,66],[1620,1233,1553],[299,280,236],[280,305,237],[237,305,274],[306,292,274],[330,257,281],[246,194,264],[166,247,173],[912,894,896],[611,320,244],[1154,1020,907],[969,962,290],[272,299,291],[305,318,274],[145,212,240],[164,248,285],[259,277,275],[193,164,295],[269,240,210],[1033,288,320],[46,948,206],[336,280,299],[330,281,292],[257,307,300],[369,136,248],[145,240,269],[502,84,465],[193,295,286],[164,285,295],[282,302,49],[161,303,429],[318,306,274],[306,330,292],[315,257,330],[315,307,257],[307,352,300],[300,352,308],[275,277,403],[353,1141,333],[1420,425,47],[611,313,320],[85,126,83],[128,1180,43],[303,116,129],[280,314,305],[314,318,305],[190,181,242],[203,214,131],[820,795,815],[322,299,272],[322,336,299],[315,339,307],[172,152,617],[172,214,203],[321,1033,320],[1401,941,946],[85,160,138],[976,454,951],[747,60,786],[317,322,272],[339,352,307],[266,33,867],[163,224,218],[247,614,180],[648,639,553],[388,172,205],[611,345,313],[313,345,320],[160,127,303],[454,672,951],[317,329,322],[314,280,336],[306,338,330],[330,339,315],[1236,115,436],[342,321,320],[1046,355,328],[328,346,325],[325,346,317],[367,314,336],[314,337,318],[337,306,318],[338,343,330],[342,320,345],[355,349,328],[346,329,317],[347,336,322],[314,362,337],[330,343,339],[340,308,352],[135,906,1022],[239,156,491],[194,230,486],[40,1015,1003],[321,355,1046],[329,382,322],[382,347,322],[347,367,336],[337,371,306],[306,371,338],[1681,296,1493],[286,172,388],[230,348,486],[348,183,486],[384,332,830],[328,349,346],[367,362,314],[371,343,338],[339,351,352],[57,344,78],[342,355,321],[386,346,349],[386,350,346],[346,350,329],[347,366,367],[343,363,339],[323,380,324],[152,275,241],[345,1045,342],[350,374,329],[339,363,351],[234,340,352],[353,361,354],[40,34,1015],[373,355,342],[373,349,355],[374,382,329],[366,347,382],[371,363,343],[351,379,352],[379,372,352],[372,234,352],[156,190,491],[319,241,692],[354,361,31],[366,377,367],[363,379,351],[133,590,516],[197,56,271],[1045,370,342],[370,373,342],[374,350,386],[377,366,382],[367,395,362],[400,337,362],[400,371,337],[378,363,371],[106,109,614],[181,673,193],[953,920,631],[376,349,373],[376,386,349],[378,379,363],[224,375,218],[279,152,172],[361,619,381],[1347,823,795],[760,857,384],[392,374,386],[394,395,367],[383,371,400],[383,378,371],[218,375,261],[197,271,36],[414,454,976],[385,376,373],[1051,382,374],[387,394,367],[377,387,367],[395,400,362],[279,172,295],[30,365,225],[450,231,825],[385,373,370],[398,374,392],[1051,377,382],[396,378,383],[348,496,183],[295,172,286],[357,269,495],[1148,390,1411],[75,30,225],[206,76,54],[412,386,376],[412,392,386],[396,383,400],[651,114,878],[123,1241,506],[238,311,265],[381,653,29],[618,815,334],[427,1032,411],[298,414,976],[791,332,384],[129,100,140],[412,404,392],[392,404,398],[140,107,360],[395,394,400],[423,379,378],[385,412,376],[406,94,58],[419,415,1021],[422,423,378],[423,125,379],[258,508,238],[311,156,265],[213,287,491],[449,411,1024],[412,1068,404],[55,140,360],[76,414,54],[394,416,400],[400,416,396],[422,378,396],[1258,796,789],[427,411,449],[427,297,1032],[1385,1366,483],[417,448,284],[1507,341,245],[162,140,444],[658,44,81],[433,125,423],[438,251,125],[429,162,439],[1342,57,1348],[765,766,442],[697,891,695],[1057,396,416],[440,423,422],[440,433,423],[433,438,125],[438,196,251],[74,482,211],[1136,79,144],[29,195,424],[242,1004,492],[57,757,28],[414,298,54],[238,348,230],[224,163,124],[295,215,279],[495,269,490],[449,446,427],[446,297,427],[1020,1163,909],[128,138,419],[66,980,443],[415,439,1018],[111,396,1057],[111,422,396],[840,249,831],[593,664,596],[218,550,155],[109,194,180],[483,268,855],[161,415,419],[1737,232,428],[360,107,494],[1006,1011,410],[444,140,55],[919,843,430],[190,242,213],[275,403,410],[131,494,488],[449,663,446],[138,161,419],[128,419,34],[439,162,444],[460,440,422],[440,438,433],[472,74,445],[491,190,213],[238,508,515],[46,206,54],[972,944,962],[1241,1428,1284],[111,460,422],[470,432,806],[248,164,702],[1025,467,453],[553,1235,648],[263,114,881],[267,293,896],[469,438,440],[455,196,438],[287,242,492],[239,265,156],[213,242,287],[1684,746,63],[663,474,446],[415,161,429],[140,100,107],[1055,459,467],[469,455,438],[259,542,277],[446,474,466],[446,466,447],[439,444,1019],[614,109,180],[190,359,181],[156,497,190],[726,474,663],[1023,458,459],[461,440,460],[269,210,490],[246,180,194],[590,133,189],[163,218,155],[467,468,453],[1063,1029,111],[111,1029,460],[1029,464,460],[461,469,440],[150,149,323],[828,445,456],[375,502,261],[474,475,466],[573,426,462],[478,1023,477],[478,458,1023],[458,479,467],[459,458,467],[468,393,453],[464,461,460],[484,365,455],[1232,182,1380],[172,617,214],[547,694,277],[542,547,277],[184,258,238],[261,502,465],[467,479,468],[484,455,469],[1380,182,864],[475,476,466],[80,447,476],[466,476,447],[415,429,439],[479,487,468],[487,287,468],[492,393,468],[260,469,461],[481,365,484],[531,473,931],[692,360,319],[726,495,474],[468,287,492],[480,464,1029],[260,461,464],[494,481,484],[74,472,482],[174,240,212],[223,106,614],[486,477,485],[478,496,458],[491,487,479],[123,402,177],[488,469,260],[488,484,469],[265,239,348],[248,215,285],[474,490,475],[477,486,478],[458,496,479],[239,491,479],[1584,1147,1334],[488,494,484],[401,123,506],[495,490,474],[490,173,475],[80,476,264],[491,287,487],[480,1029,1004],[480,205,464],[173,476,475],[485,194,486],[486,183,478],[478,183,496],[496,239,479],[848,1166,60],[268,262,855],[205,260,464],[260,203,488],[203,131,488],[246,264,476],[194,485,264],[1002,310,1664],[311,515,497],[515,359,497],[565,359,515],[1250,1236,301],[736,456,151],[654,174,567],[577,534,648],[519,505,645],[725,565,508],[150,1723,148],[584,502,505],[584,526,502],[502,526,84],[607,191,682],[560,499,660],[607,517,191],[1038,711,124],[951,672,971],[716,507,356],[868,513,1198],[615,794,608],[682,191,174],[1313,928,1211],[617,241,214],[511,71,91],[408,800,792],[192,286,525],[80,485,447],[91,97,130],[1675,324,888],[207,756,532],[582,1097,1124],[311,497,156],[510,130,146],[523,511,510],[608,708,616],[546,690,650],[511,527,358],[536,146,518],[465,418,550],[418,709,735],[520,514,500],[584,505,519],[536,518,509],[146,536,510],[538,527,511],[876,263,669],[646,524,605],[510,536,523],[527,175,358],[724,876,669],[721,724,674],[524,683,834],[558,509,522],[558,536,509],[523,538,511],[611,243,574],[528,706,556],[668,541,498],[523,537,538],[527,540,175],[532,756,533],[1013,60,747],[551,698,699],[92,520,500],[535,536,558],[536,569,523],[538,540,527],[539,548,175],[567,212,145],[401,896,293],[534,675,639],[1510,595,1507],[557,545,530],[569,536,535],[537,540,538],[540,539,175],[569,537,523],[1135,718,47],[587,681,626],[580,535,558],[99,747,278],[701,565,725],[665,132,514],[665,514,575],[132,549,653],[176,651,189],[65,47,266],[597,569,535],[569,581,537],[537,581,540],[563,539,540],[539,564,548],[1509,1233,1434],[132,653,740],[550,710,155],[714,721,644],[410,1011,188],[732,534,586],[560,562,729],[555,557,222],[580,558,545],[597,535,580],[581,563,540],[5,821,1676],[576,215,136],[649,457,741],[564,539,563],[124,711,224],[550,668,710],[550,541,668],[565,701,673],[560,613,499],[233,532,625],[545,555,580],[601,581,569],[594,904,548],[1463,1425,434],[185,149,1454],[721,674,644],[185,380,149],[577,424,586],[462,586,559],[597,601,569],[594,548,564],[566,603,574],[165,543,544],[457,89,121],[586,424,195],[725,587,606],[1078,582,1124],[588,925,866],[462,559,593],[189,878,590],[555,229,580],[602,563,581],[904,594,956],[434,1425,1438],[1024,112,821],[572,587,626],[600,597,580],[599,591,656],[600,580,229],[601,622,581],[581,622,602],[602,564,563],[602,594,564],[603,611,574],[498,529,546],[697,1145,70],[592,628,626],[610,597,600],[597,610,601],[222,557,171],[604,765,799],[573,462,593],[133,200,176],[729,607,627],[1011,692,188],[518,146,130],[585,687,609],[682,627,607],[1712,599,656],[562,592,607],[643,656,654],[257,600,229],[601,633,622],[623,594,602],[174,212,567],[725,606,701],[609,701,606],[610,633,601],[633,642,622],[380,216,324],[142,143,1249],[501,732,586],[534,577,586],[648,1235,577],[610,641,633],[310,1002,1831],[618,334,604],[1710,145,269],[707,498,659],[501,586,462],[625,501,462],[726,663,691],[300,600,257],[641,610,600],[622,629,602],[602,629,623],[55,692,444],[518,748,509],[929,1515,1411],[620,578,267],[71,511,358],[707,668,498],[650,687,585],[600,300,641],[641,657,633],[1675,888,1669],[622,636,629],[505,502,375],[541,529,498],[332,420,1053],[637,551,638],[534,639,648],[69,623,873],[300,512,641],[633,657,642],[562,660,579],[687,637,638],[709,646,605],[775,738,885],[559,549,132],[646,683,524],[641,512,657],[266,897,949],[1712,643,1657],[184,727,258],[674,724,669],[699,714,647],[628,659,572],[657,662,642],[571,881,651],[517,607,504],[598,706,528],[598,694,547],[640,552,560],[655,693,698],[698,693,721],[91,510,511],[144,301,1136],[324,216,888],[870,764,1681],[575,514,520],[276,544,543],[658,175,44],[645,505,711],[659,546,572],[700,524,655],[605,700,529],[266,867,897],[1695,1526,764],[579,659,628],[654,591,682],[586,549,559],[698,721,714],[896,401,506],[640,734,599],[664,665,575],[621,629,636],[1712,656,643],[547,644,598],[710,668,707],[640,560,734],[655,698,551],[694,528,277],[512,662,657],[504,592,626],[688,584,519],[152,241,617],[587,725,681],[598,669,706],[526,670,84],[598,528,694],[710,707,499],[579,592,562],[660,659,579],[323,324,1134],[326,895,473],[195,29,653],[84,670,915],[560,660,562],[504,626,681],[711,505,224],[651,881,114],[216,620,889],[1362,678,197],[493,99,48],[1659,691,680],[529,690,546],[430,843,709],[655,524,693],[174,191,105],[674,669,598],[98,712,82],[572,546,585],[72,61,71],[912,911,894],[106,223,184],[664,132,665],[843,646,709],[635,699,136],[699,698,714],[593,132,664],[688,526,584],[185,177,620],[533,675,534],[687,638,635],[1652,89,457],[896,506,912],[132,740,514],[689,685,282],[691,449,680],[48,436,493],[136,699,647],[739,640,554],[549,586,653],[532,533,625],[1530,695,649],[653,381,619],[736,151,531],[188,692,241],[177,402,578],[33,689,867],[689,33,685],[593,559,132],[949,65,266],[711,1038,661],[939,480,1004],[609,369,701],[616,552,615],[619,361,740],[151,463,516],[513,521,117],[691,663,449],[186,251,196],[333,302,327],[613,560,552],[616,613,552],[690,551,637],[660,707,659],[704,208,1203],[418,735,550],[163,708,124],[524,834,693],[554,640,599],[245,341,165],[565,673,359],[155,710,708],[105,191,517],[1515,198,1411],[1709,554,599],[60,289,786],[838,1295,1399],[533,534,625],[710,499,708],[556,632,410],[217,620,216],[591,627,682],[504,503,223],[643,654,567],[690,637,650],[545,557,555],[174,654,682],[719,691,1659],[727,681,508],[645,711,661],[794,615,739],[565,515,508],[282,685,302],[1150,397,1149],[638,699,635],[544,685,33],[719,726,691],[1742,1126,1733],[1724,1475,148],[556,410,403],[185,217,380],[503,504,681],[277,556,403],[32,1178,158],[1712,1709,599],[605,529,541],[635,136,369],[687,635,369],[529,700,690],[700,551,690],[89,304,573],[625,534,732],[730,302,685],[503,681,727],[702,673,701],[730,327,302],[327,353,333],[596,664,575],[660,499,707],[585,546,650],[560,729,734],[700,655,551],[176,571,651],[517,504,223],[730,685,544],[1661,1682,726],[1682,495,726],[1250,301,917],[605,524,700],[609,687,369],[516,389,895],[1553,686,1027],[673,702,164],[656,591,654],[520,596,575],[402,123,401],[828,456,728],[1645,677,1653],[528,556,277],[638,551,699],[190,497,359],[276,730,544],[1117,1525,933],[1027,686,1306],[155,708,163],[709,605,541],[647,644,547],[650,637,687],[599,734,591],[578,293,267],[1682,357,495],[510,91,130],[734,729,627],[576,542,215],[709,541,735],[735,541,550],[276,500,730],[500,327,730],[653,619,740],[414,851,454],[734,627,591],[729,562,607],[615,552,640],[525,181,192],[308,512,300],[223,503,727],[266,165,33],[92,500,276],[321,1046,1033],[585,609,606],[1200,1559,86],[628,572,626],[301,436,803],[714,644,647],[708,499,613],[721,693,724],[514,353,327],[353,740,361],[344,158,78],[708,613,616],[615,640,739],[500,514,327],[514,740,353],[1449,177,185],[462,233,625],[851,405,1163],[608,616,615],[647,542,576],[625,732,501],[1097,582,1311],[1235,424,577],[579,628,592],[607,592,504],[24,432,470],[105,614,247],[104,742,471],[542,259,215],[365,196,455],[1420,47,65],[223,727,184],[547,542,647],[572,585,606],[587,572,606],[262,780,1370],[647,576,136],[644,674,598],[271,53,75],[727,508,258],[471,742,142],[505,375,224],[357,1710,269],[725,508,681],[659,498,546],[743,1178,32],[1195,634,231],[1176,24,470],[743,1110,1178],[135,809,857],[63,746,407],[634,1176,470],[159,1112,27],[1176,1685,24],[399,450,779],[1178,856,875],[751,744,54],[436,48,772],[634,1108,1210],[769,1285,1286],[751,298,755],[746,1684,754],[754,924,87],[722,1625,756],[87,839,153],[489,795,820],[758,808,1518],[839,840,153],[831,1111,959],[1111,749,959],[810,1253,1363],[1247,1394,713],[1388,1329,1201],[1242,120,761],[857,791,384],[758,1523,808],[296,764,1504],[70,1652,891],[207,233,1638],[1348,57,28],[858,420,332],[964,1379,1278],[420,1194,816],[784,1076,1186],[1076,21,1186],[1710,767,1],[849,822,778],[806,137,787],[786,790,744],[790,54,744],[771,63,407],[785,852,818],[774,1823,272],[895,151,516],[135,1022,809],[99,826,48],[48,826,755],[808,705,408],[833,441,716],[1733,743,32],[1385,836,852],[772,827,737],[1005,49,781],[793,1697,813],[1518,441,1537],[1139,1132,859],[782,801,770],[1510,1530,676],[770,814,835],[231,787,825],[207,722,756],[26,771,798],[782,863,865],[832,54,790],[865,842,507],[799,765,94],[1175,1261,1353],[800,408,805],[262,986,200],[792,800,814],[801,792,770],[704,1203,1148],[356,1514,822],[165,544,33],[561,776,113],[1043,738,775],[815,831,820],[773,792,801],[772,48,914],[772,737,803],[436,772,803],[808,817,705],[1624,822,1527],[588,1144,788],[799,762,604],[821,1520,1676],[854,803,666],[828,482,472],[445,74,463],[831,489,820],[828,836,482],[716,782,763],[334,815,766],[815,823,766],[334,766,765],[819,805,837],[1716,1521,1412],[1684,924,754],[800,805,819],[1709,829,554],[806,1349,137],[99,1013,747],[341,595,276],[817,810,818],[1176,1691,1685],[763,782,865],[830,846,1052],[865,1499,842],[982,846,1053],[847,832,790],[1178,875,158],[817,818,705],[1302,1392,45],[96,417,284],[223,614,517],[356,507,1514],[1166,848,1179],[1349,432,26],[717,92,276],[770,835,863],[522,509,1745],[847,841,832],[832,841,46],[829,739,554],[802,824,39],[397,1043,775],[1567,849,778],[1385,483,855],[1349,26,1346],[441,801,782],[402,401,293],[1043,667,738],[759,798,1007],[819,837,728],[728,837,828],[837,852,828],[1537,441,833],[148,1475,147],[805,705,837],[716,441,782],[483,1371,780],[814,819,844],[845,753,1336],[1661,719,4],[862,847,790],[737,827,666],[201,46,841],[810,785,818],[408,705,805],[1560,1536,849],[1585,853,1786],[7,1668,807],[7,807,8],[822,1514,1527],[800,819,814],[847,862,841],[991,857,760],[705,818,837],[808,408,773],[402,293,578],[791,858,332],[1480,1228,1240],[814,844,835],[785,1385,852],[1132,120,859],[1743,1726,684],[1704,783,1279],[1623,1694,1731],[959,489,831],[1518,808,773],[862,872,841],[441,773,801],[331,512,308],[380,217,216],[841,872,201],[818,852,837],[448,1480,1240],[856,1108,1195],[1527,1514,1526],[819,182,1232],[871,724,693],[852,836,828],[770,792,814],[803,737,666],[751,826,278],[1674,1727,1699],[849,356,822],[871,693,834],[507,842,1514],[1406,1097,869],[1328,1349,1346],[823,815,795],[744,751,278],[1110,856,1178],[520,717,316],[871,834,683],[884,876,724],[165,266,47],[716,763,507],[216,889,888],[853,1585,1570],[1536,716,356],[886,873,623],[782,770,863],[432,24,26],[683,882,871],[884,724,871],[114,876,884],[516,590,389],[11,1218,1628],[862,113,872],[886,623,629],[830,1052,1120],[762,153,604],[773,408,792],[763,865,507],[153,840,604],[882,884,871],[531,151,326],[886,890,873],[133,262,200],[819,1232,844],[621,636,122],[645,892,519],[1130,1076,784],[114,263,876],[1670,10,1663],[911,670,894],[452,885,872],[872,885,201],[887,882,683],[878,884,882],[590,878,882],[890,867,689],[897,629,621],[897,886,629],[819,728,182],[519,893,688],[894,670,526],[898,894,526],[1536,356,849],[810,1363,785],[878,114,884],[879,888,892],[892,889,893],[893,898,688],[895,683,843],[895,887,683],[889,620,267],[590,882,389],[418,465,84],[949,897,621],[897,890,886],[889,267,893],[898,267,896],[531,326,473],[189,651,878],[843,683,646],[897,867,890],[888,889,892],[893,267,898],[896,894,898],[473,895,843],[895,389,887],[974,706,669],[513,1115,521],[326,151,895],[809,791,857],[211,262,133],[920,923,947],[923,90,947],[90,25,947],[25,972,935],[64,431,899],[52,899,901],[903,905,59],[437,967,73],[839,1242,761],[904,975,44],[917,301,144],[915,670,911],[905,201,885],[1684,63,1685],[1033,1194,288],[950,913,755],[912,918,911],[950,914,913],[506,918,912],[922,919,915],[911,922,915],[1004,451,492],[1263,553,639],[922,911,918],[630,920,947],[916,506,926],[916,918,506],[521,1115,1098],[916,922,918],[919,418,915],[83,38,75],[24,1685,771],[110,1230,1213],[712,8,1837],[922,930,919],[919,430,418],[1395,1402,1187],[930,922,916],[594,623,69],[35,431,968],[35,968,969],[866,924,1684],[1625,1263,675],[631,630,52],[930,931,919],[430,709,418],[302,333,49],[1446,978,1138],[799,1007,798],[931,843,919],[947,25,64],[885,738,667],[1262,963,964],[899,970,901],[1401,946,938],[1117,933,1091],[1685,63,771],[905,948,201],[979,937,980],[951,953,950],[937,270,443],[1154,903,59],[1194,954,1067],[909,405,907],[850,1151,59],[1769,811,1432],[76,206,250],[938,946,966],[965,927,942],[938,966,957],[955,975,904],[927,965,934],[52,51,631],[59,905,667],[431,935,968],[786,289,561],[252,122,671],[481,494,107],[954,1817,1067],[795,25,90],[958,965,945],[795,972,25],[902,983,955],[972,489,944],[1256,29,424],[671,331,945],[946,958,963],[956,955,904],[902,955,956],[671,512,331],[945,331,961],[662,671,122],[671,662,512],[934,65,927],[630,947,52],[666,631,910],[850,59,667],[961,331,234],[1024,411,1042],[890,69,873],[252,671,945],[975,290,940],[283,186,196],[30,283,365],[950,755,298],[946,965,958],[985,290,975],[969,290,985],[405,851,206],[935,431,64],[941,1423,1420],[964,963,167],[942,252,945],[78,757,57],[49,1005,66],[937,979,270],[631,666,827],[980,937,443],[66,689,282],[421,902,956],[947,64,52],[35,979,899],[951,971,953],[762,87,153],[27,31,381],[924,839,87],[946,963,966],[331,308,340],[957,966,1262],[473,843,931],[953,971,920],[270,969,902],[935,962,968],[51,1005,781],[969,983,902],[437,73,940],[69,421,956],[761,249,840],[263,974,669],[962,944,967],[962,437,290],[985,975,955],[907,405,948],[720,957,1262],[25,935,64],[176,200,571],[108,945,50],[250,851,414],[200,986,571],[881,974,263],[827,772,953],[970,899,980],[29,159,27],[234,331,340],[948,405,206],[980,899,979],[986,984,571],[571,984,881],[990,706,974],[946,934,965],[970,980,66],[1113,1486,1554],[984,981,881],[881,987,974],[689,66,443],[1005,901,66],[983,985,955],[165,47,718],[987,990,974],[1370,986,262],[901,970,66],[51,901,1005],[981,987,881],[988,706,990],[942,945,965],[290,437,940],[64,899,52],[988,556,706],[941,934,946],[431,35,899],[996,989,984],[984,989,981],[981,989,987],[35,969,270],[1370,995,986],[986,995,984],[989,999,987],[987,992,990],[992,988,990],[962,967,437],[951,950,976],[979,35,270],[421,270,902],[998,995,1370],[987,999,992],[988,364,556],[969,985,983],[689,443,890],[995,1e3,984],[219,958,108],[998,1e3,995],[999,997,992],[914,953,772],[845,1336,745],[806,787,231],[1e3,996,984],[989,996,999],[50,945,961],[443,421,69],[797,158,779],[1098,1463,434],[996,1009,999],[1001,988,992],[1001,364,988],[903,907,905],[26,759,973],[997,1001,992],[632,364,1001],[1346,26,973],[998,1008,1e3],[1e3,1009,996],[531,931,736],[252,949,621],[286,388,525],[1174,1008,998],[1009,1010,999],[999,1010,997],[1014,1001,997],[614,105,517],[958,945,108],[525,1004,242],[963,958,219],[233,426,304],[1e3,1008,1009],[1010,1014,997],[1001,1006,632],[824,413,39],[642,636,622],[480,388,205],[28,757,797],[1014,1006,1001],[1006,410,632],[975,940,44],[1234,420,858],[54,832,46],[1009,1012,1010],[167,963,219],[41,481,107],[1017,1010,1012],[122,636,662],[939,525,388],[525,939,1004],[950,953,914],[829,1735,739],[1008,880,1015],[1008,1015,1009],[1263,639,675],[956,594,69],[795,90,1347],[1179,848,1013],[759,1007,973],[1009,1015,1012],[1012,1016,1017],[1017,1014,1010],[1019,1011,1006],[927,65,949],[649,316,595],[913,48,755],[976,950,298],[1003,1015,880],[1018,1006,1014],[1021,1018,1014],[444,692,1011],[451,1029,1063],[1185,851,1163],[29,27,381],[181,525,242],[1021,1014,1017],[1016,1021,1017],[1018,1019,1006],[1019,444,1011],[927,949,942],[451,393,492],[903,1154,907],[391,101,57],[94,765,58],[419,1016,1012],[949,252,942],[907,1020,909],[765,442,58],[94,406,908],[1007,94,908],[34,1012,1015],[34,419,1012],[419,1021,1016],[451,1057,393],[907,948,905],[1034,1073,1039],[1061,906,1619],[1068,960,1034],[471,1249,104],[112,1024,1042],[372,379,125],[341,543,165],[141,1094,170],[566,243,1061],[398,1034,1039],[325,317,1823],[1493,296,1724],[850,667,1043],[1054,297,1065],[1619,135,1074],[1061,243,906],[680,1024,821],[1103,96,1245],[1440,1123,1491],[1047,1025,1044],[672,454,1231],[1484,697,1530],[993,672,1231],[178,154,1088],[1044,1041,1066],[112,1062,1058],[1530,649,676],[178,1088,1040],[1046,328,954],[243,244,1022],[954,1194,1033],[1042,411,1032],[971,993,1056],[960,1093,1034],[1754,1338,232],[385,1064,412],[1057,1063,111],[748,1071,1447],[1530,697,695],[971,1056,1270],[977,1059,1211],[649,741,316],[1060,1452,1030],[353,354,1323],[695,768,649],[398,404,1034],[596,316,741],[1836,119,13],[1513,1115,1528],[883,1081,1652],[1039,1073,1048],[462,426,233],[31,1296,354],[1055,1047,1066],[1032,1054,1045],[1521,310,1224],[119,861,13],[1194,1234,288],[1109,1771,1070],[1166,1160,776],[1044,1035,1041],[1026,960,1064],[1050,1032,1045],[1049,1041,387],[115,1013,99],[1046,954,1033],[1321,920,971],[611,1058,345],[1048,1066,1049],[1023,1055,1073],[1029,451,1004],[118,1094,141],[1094,1080,170],[1042,1032,1050],[1026,1064,385],[15,16,1084],[1096,1079,61],[1075,1071,748],[325,1817,328],[909,1163,405],[1022,1234,809],[374,398,1051],[1082,72,81],[1023,1034,1093],[1817,1794,1067],[86,1445,1400],[1507,1535,1510],[1079,1096,1075],[568,1478,1104],[1070,178,1040],[1034,1023,1073],[776,1155,113],[1103,143,142],[1140,81,73],[1082,81,1140],[1060,1030,936],[1040,1086,1109],[370,1065,385],[61,72,1082],[1087,1096,1144],[1040,1088,1086],[1651,812,752],[1062,1050,1045],[187,154,178],[179,187,178],[1099,1344,1101],[1668,1058,807],[1073,1055,1048],[1099,1336,1344],[1283,943,1123],[1049,387,1051],[1024,680,449],[61,1082,1100],[967,749,1111],[1439,1037,88],[742,1505,142],[398,1039,1051],[1107,1336,1099],[1344,1542,1101],[142,1505,1103],[477,1093,447],[477,1023,1093],[471,142,1249],[1041,1035,394],[1328,568,1104],[61,1100,1096],[154,1092,1088],[112,1042,1050],[154,187,168],[435,235,45],[1075,1096,1087],[97,1075,748],[1049,1066,1041],[816,1067,1028],[846,982,1142],[1245,96,284],[1092,154,1080],[1057,451,1063],[387,377,1051],[1055,1025,1047],[1075,1087,1089],[1106,1108,856],[1068,1034,404],[1480,1545,868],[906,135,1619],[1074,991,1095],[570,566,1061],[1025,453,1044],[745,1336,1107],[1035,1057,416],[1092,1102,1129],[1074,135,991],[1105,745,1107],[447,1026,446],[394,387,1041],[73,81,940],[1118,1108,1106],[1210,1108,874],[243,1022,906],[412,1064,1068],[1280,611,603],[960,447,1093],[1051,1039,1049],[1040,1109,1070],[1471,1037,1439],[69,890,443],[1377,703,1374],[1092,1080,1102],[1096,1100,788],[1096,788,1144],[1114,967,1111],[446,1026,297],[70,1112,883],[453,393,1057],[1118,874,1108],[1054,370,1045],[1080,1094,1102],[1039,1048,1049],[428,753,845],[1047,1044,1066],[1044,453,1035],[1472,731,1512],[1126,1121,743],[743,1121,1110],[1032,297,1054],[1480,868,1216],[71,358,72],[1133,967,1114],[1105,1119,745],[1035,453,1057],[1026,447,960],[454,851,1190],[1030,1477,652],[589,816,1028],[1110,1121,1106],[1122,1118,1106],[1116,874,1118],[1048,1055,1066],[1194,1067,816],[744,278,747],[745,1120,845],[845,1052,428],[1105,1780,1119],[1065,297,385],[1098,1529,1463],[731,1060,936],[235,434,812],[1445,1525,1117],[1106,1121,1122],[1122,1127,1118],[1127,1116,1118],[1094,118,1732],[1119,1120,745],[1406,1124,1097],[435,117,235],[1462,1440,1037],[1126,1129,1121],[1088,1092,1129],[1133,73,967],[1120,1052,845],[812,434,752],[1441,1559,1200],[1131,588,413],[1054,1065,370],[235,1098,434],[1052,1142,428],[1737,428,1142],[1496,1446,1483],[1182,1083,1654],[1121,1129,1122],[1732,1116,1127],[768,457,649],[761,1114,249],[1064,960,1068],[1135,1481,1136],[1126,952,1129],[1087,588,1131],[1087,1144,588],[859,788,1139],[1140,1133,1132],[1133,1140,73],[1822,570,1061],[394,1035,416],[1055,1023,459],[80,264,485],[1119,1128,1120],[145,1658,567],[695,891,768],[1129,1102,1122],[1122,1102,1127],[1416,1077,1413],[297,1026,385],[1052,846,1142],[1445,1117,1400],[952,1086,1129],[1714,1089,1131],[1131,1089,1087],[1100,1139,788],[112,1050,1062],[1323,354,1296],[49,333,1141],[1142,982,1737],[79,1457,1091],[1088,1129,1086],[1102,1094,1127],[1127,1094,1732],[1100,1082,1139],[1082,1132,1139],[1082,1140,1132],[1150,1043,397],[60,1166,289],[1696,1146,1698],[1297,1202,1313],[409,1297,1313],[1234,1194,420],[1408,1391,1394],[424,1235,1243],[1203,309,1148],[485,477,447],[1152,1156,850],[1153,1149,1155],[1153,1157,1149],[1149,1152,1150],[1156,1154,1151],[776,1153,1155],[1157,1152,1149],[1217,1393,1208],[1156,1159,1154],[1153,1165,1157],[1165,1152,1157],[1159,1020,1154],[1161,1153,776],[1161,1165,1153],[1165,1158,1152],[1152,1158,1156],[1158,1159,1156],[1166,776,561],[1160,1161,776],[1161,1164,1165],[1161,1160,1164],[1158,1162,1159],[1159,1162,1020],[1270,1321,971],[1164,1170,1165],[1165,1162,1158],[1162,1163,1020],[588,788,925],[1166,1167,1160],[1165,1170,1162],[1160,1167,1164],[1162,1170,1163],[1179,1167,1166],[1167,1168,1164],[1164,1168,1170],[1168,1169,1170],[1234,1022,288],[802,39,866],[1179,1168,1167],[1169,1173,1170],[1170,1173,1163],[1173,1185,1163],[1360,1267,1364],[1169,1185,1173],[611,244,243],[900,1226,1376],[1260,1408,1350],[618,840,831],[1181,1183,1179],[1179,1184,1168],[1208,1274,1291],[1183,1184,1179],[1168,1184,1169],[1387,1395,1254],[1208,1204,1172],[1182,1197,1083],[1187,1083,1197],[1213,1183,1181],[1169,1207,1185],[135,857,991],[1013,1213,1181],[1189,1183,1213],[1183,1189,1184],[1169,1184,1207],[1207,1190,1185],[1180,1389,1288],[1191,1192,1640],[1640,1192,1090],[1090,1205,1654],[1654,1205,1182],[1188,1395,1187],[1126,743,1733],[788,859,925],[809,1234,1171],[1193,1197,1182],[1189,1199,1184],[1639,1191,1637],[1639,1212,1191],[1205,1193,1182],[1198,1187,1197],[1199,1207,1184],[332,1053,846],[1090,1192,1205],[117,1188,1187],[435,1188,117],[435,1206,1188],[1199,1189,1213],[420,816,1053],[1212,1215,1191],[117,1187,1198],[45,1206,435],[120,1132,1133],[874,1116,1210],[1191,1215,1192],[1193,1216,1197],[1216,1198,1197],[1199,1214,1207],[117,521,235],[1220,1311,1078],[1220,900,1311],[1653,1215,1212],[1192,1225,1205],[1205,1209,1193],[1209,1216,1193],[1389,1217,1172],[1207,1214,454],[171,557,1747],[1805,1078,1787],[1805,1219,1078],[1198,1216,868],[666,910,854],[1230,1231,1213],[1213,1231,1199],[1199,1231,1214],[1219,1220,1078],[1215,1221,1192],[1192,1221,1225],[1225,1228,1205],[1205,1228,1209],[1209,1228,1216],[1464,1325,1223],[1215,1227,1221],[1228,1480,1216],[1226,1653,1376],[1653,1249,1215],[1221,1240,1225],[1225,1240,1228],[839,761,840],[1238,1219,1805],[1238,1220,1219],[1232,1380,1375],[1226,1249,1653],[1221,1227,1240],[233,207,532],[110,1236,1230],[1248,1231,1230],[1231,454,1214],[1249,1227,1215],[1248,1056,1231],[489,959,944],[448,1240,284],[925,859,1242],[1805,1244,1238],[1252,1220,1238],[1252,921,1220],[1236,1251,1230],[1230,1251,1248],[1056,993,1231],[1031,1264,1263],[68,1186,157],[1227,1245,1240],[1103,1245,143],[1243,1235,612],[1252,95,921],[1249,1226,1237],[1390,1387,1254],[1120,384,830],[830,332,846],[1227,143,1245],[1315,1369,1358],[1356,1269,1386],[972,795,489],[1831,1224,310],[1250,1255,1251],[1251,1056,1248],[1256,1243,103],[658,358,175],[1620,1238,1244],[1620,1252,1238],[1506,95,1252],[104,1249,1237],[1249,143,1227],[1268,1419,1329],[634,806,231],[618,831,815],[924,1242,839],[1255,1270,1251],[1251,1270,1056],[866,925,1242],[103,29,1256],[424,1243,1256],[134,1651,752],[1250,917,1255],[1172,1204,1260],[1352,1036,1276],[1265,1201,1329],[804,1282,1259],[1259,1294,723],[335,1330,1305],[407,762,799],[875,856,1195],[32,158,344],[967,944,749],[372,125,42],[1175,1354,1261],[553,612,1235],[1259,1273,1294],[1294,1283,723],[757,78,158],[407,799,798],[901,51,52],[139,1386,1389],[1386,1269,1389],[1389,1269,1217],[1148,1590,1268],[1428,1449,1450],[804,1281,1282],[1273,1259,1282],[158,399,779],[771,407,798],[521,1098,235],[917,1312,1255],[1312,1270,1255],[1217,1269,1393],[1195,1108,634],[1110,1106,856],[1210,1691,1176],[27,1112,1145],[1296,27,1145],[1171,858,791],[704,1148,1290],[1430,1436,1437],[1282,1308,1273],[1300,943,1283],[1393,1355,1274],[720,1278,769],[1287,1059,1399],[1310,1388,1272],[1312,1321,1270],[851,1185,1190],[1296,1145,1304],[26,24,771],[51,910,631],[1329,1290,1268],[1290,1148,1268],[1298,1293,733],[1281,1293,1282],[1282,1293,1308],[1308,1299,1273],[1300,1283,1294],[1340,943,1300],[1340,1301,943],[407,754,762],[1287,1399,1295],[34,139,128],[1288,1172,1260],[120,1133,1114],[1306,1113,1511],[1464,1223,1292],[1299,1294,1273],[1299,1300,1294],[1286,1295,838],[1285,1247,1286],[1247,713,1286],[1201,1265,1390],[1378,1368,1357],[1482,1320,917],[917,1320,1312],[850,1156,1151],[588,39,413],[1324,1306,686],[789,1365,928],[1223,1326,1292],[1292,1326,1298],[869,1097,1311],[790,786,561],[1323,1304,932],[1323,1296,1304],[1317,1324,686],[1306,368,1113],[1325,1342,1223],[1326,1348,1298],[1293,1327,1308],[1308,1318,1299],[704,1290,1258],[1320,1321,1312],[761,120,1114],[1684,802,866],[1674,6,1727],[1316,1323,932],[1335,1337,1305],[1348,1327,1293],[1298,1348,1293],[1333,1300,1299],[1333,1343,1300],[1328,1301,1340],[1328,1314,1301],[838,1399,1319],[921,1237,900],[409,1391,1408],[1376,1653,677],[1281,804,1458],[1331,1324,1317],[1324,368,1306],[368,1338,1307],[1327,797,1308],[797,1345,1308],[1308,1345,1318],[1318,1333,1299],[1341,1147,1572],[923,1321,1320],[923,920,1321],[39,588,866],[1141,1323,1316],[1330,1335,1305],[1337,1335,1336],[1339,1332,1325],[1223,1342,1326],[1342,1348,1326],[1348,797,1327],[1345,1333,1318],[1343,1340,1300],[1419,1265,1329],[1347,1320,1584],[1535,1141,1316],[1078,1311,582],[1344,1335,1330],[753,1331,1337],[368,1324,1331],[753,368,1331],[1332,1485,1325],[1325,1485,1342],[787,1343,1333],[137,1328,1340],[973,1341,1479],[406,1147,1341],[1171,1234,858],[1141,1535,1322],[49,1141,1322],[1344,1336,1335],[973,908,1341],[766,1347,1584],[1347,923,1320],[781,49,1322],[368,232,1338],[787,1340,1343],[787,137,1340],[568,1346,973],[58,1147,406],[442,1334,1147],[58,442,1147],[442,766,1334],[90,923,1347],[428,368,753],[779,1333,1345],[825,787,1333],[137,1349,1328],[1328,1346,568],[908,406,1341],[924,866,1242],[1336,753,1337],[428,232,368],[1115,777,1098],[1348,28,797],[797,779,1345],[779,825,1333],[1007,908,973],[583,1351,880],[1365,1246,977],[1658,145,1710],[1310,796,1388],[718,245,165],[1302,1272,1254],[1174,1351,583],[1174,715,1351],[1358,1260,1204],[1374,1373,1276],[1377,1374,1276],[678,1362,1382],[1377,1276,254],[139,34,40],[1008,1174,583],[1396,1286,1319],[768,891,457],[1316,932,1535],[1289,1371,1360],[182,736,864],[1355,1364,1274],[860,1367,1354],[1362,1222,1382],[1376,869,1311],[1590,1411,198],[1232,1375,877],[1394,1295,1286],[880,1356,1386],[880,1351,1356],[1211,1059,1287],[197,678,1405],[880,1386,1003],[1368,1253,1357],[1357,1253,1036],[715,1289,1364],[1354,1367,703],[1383,877,1375],[1266,1288,1260],[1373,1374,703],[1372,1289,1174],[1303,1366,1378],[1351,715,1355],[1665,1666,624],[1309,1357,1036],[900,1237,1226],[1174,1289,715],[1337,1331,1317],[1360,1303,1359],[1267,1354,1175],[1241,1284,1414],[1377,254,929],[1385,855,836],[1396,1319,1436],[1361,1366,1303],[1381,1368,1378],[1313,1211,1391],[1368,1385,1363],[813,82,861],[1058,1280,807],[893,519,892],[1359,1303,860],[1382,1350,1247],[1371,1303,1360],[1267,1175,1271],[769,1286,1396],[712,1837,82],[1366,1385,1381],[1365,796,1310],[1003,1386,40],[780,1371,1370],[561,862,790],[1284,1380,864],[1449,1428,177],[611,1280,1058],[1284,1375,1380],[926,506,1241],[1305,1337,1317],[309,1203,208],[1388,1201,1390],[1309,1036,1352],[1377,929,1411],[1399,1059,1257],[1112,70,1145],[289,1166,561],[1288,1389,1172],[1362,37,1180],[713,1394,1286],[1355,1393,1269],[1401,1423,941],[1274,1271,1384],[860,1378,1367],[715,1364,1355],[677,1406,869],[1297,1358,1202],[1388,1258,1329],[1180,1288,1266],[1008,583,880],[1524,1425,1463],[1390,1403,1387],[1278,1379,1247],[1278,1247,1285],[964,1278,1262],[1358,1369,1202],[1715,1699,1726],[926,1241,1414],[1341,1572,1479],[926,930,916],[1397,51,781],[409,1358,1297],[1236,436,301],[1376,677,869],[1351,1355,1356],[758,1534,1523],[1378,1357,1367],[977,1211,1365],[1135,1136,854],[1394,1391,1295],[1266,1260,1222],[1365,1302,1246],[1232,877,844],[736,930,864],[1408,1358,409],[1508,817,1523],[1381,1385,1368],[718,854,910],[854,718,1135],[1382,1222,1350],[1391,1211,1287],[1391,1287,1295],[1257,1651,134],[1414,1284,864],[1291,1369,1315],[1202,928,1313],[86,1400,1413],[1413,1200,86],[1263,1625,1031],[1413,1400,1404],[1002,1664,1834],[930,926,1414],[1399,1257,134],[520,316,596],[1393,1274,1208],[1657,1655,1712],[1407,1404,1400],[1404,1410,1413],[1649,1229,1406],[1362,1266,1222],[1384,1271,1175],[900,1376,1311],[1274,1384,1291],[1291,1384,1431],[1433,1396,1436],[1267,1359,1354],[309,1353,703],[838,1319,1286],[1407,1410,1404],[441,1518,773],[1241,123,1428],[1622,1521,1224],[1217,1208,1172],[1130,793,1076],[425,1409,1481],[1481,1409,1533],[1303,1378,860],[1350,1408,1394],[1246,1651,977],[1289,1360,1364],[1727,1694,1623],[1417,1407,1533],[1417,1410,1407],[1406,1650,1649],[1319,134,1437],[1414,864,930],[1406,1229,1124],[1354,1359,860],[1433,769,1396],[1417,1533,1409],[1416,1413,1410],[1415,1416,1410],[95,1237,921],[1392,1254,1395],[1360,1359,1267],[1258,1290,1329],[1180,128,1389],[1420,1409,425],[1417,1418,1410],[1418,1415,1410],[1422,1077,1416],[1247,1350,1394],[37,43,1180],[1204,1315,1358],[1428,1383,1375],[1356,1355,1269],[1409,1418,1417],[1302,45,1246],[1421,1416,1415],[1421,1422,1416],[1422,1494,1077],[957,720,938],[1423,1409,1420],[1423,1418,1409],[752,434,1438],[1260,1358,1408],[1363,1385,785],[1423,1426,1418],[1426,1424,1418],[1229,1649,1124],[1222,1260,1350],[1508,1523,1137],[1278,1285,769],[1482,917,144],[1418,1424,1415],[1425,1422,1421],[1425,1524,1422],[1272,1388,1390],[1391,409,1313],[1378,1366,1381],[1371,483,1361],[720,1262,1278],[29,103,159],[1271,1364,1267],[1424,1427,1415],[1537,1522,1518],[134,752,1438],[1420,934,941],[1428,1375,1284],[1277,1224,1831],[1362,1180,1266],[1401,1426,1423],[1577,1369,1291],[268,483,262],[1383,1450,1456],[1384,1175,1431],[1430,1415,1427],[1430,1421,1415],[1430,1425,1421],[1379,1382,1247],[1252,1553,1429],[1206,1392,1395],[1433,1430,1427],[309,208,1353],[1272,1390,1254],[1361,483,1366],[1523,817,808],[1302,1254,1392],[1371,1361,1303],[1426,1435,1424],[1435,1433,1424],[1433,1427,1424],[720,769,1433],[796,1258,1388],[1590,1419,1268],[1289,1372,1371],[1305,1317,1509],[998,1372,1174],[40,1386,139],[1261,1354,703],[1364,1271,1274],[134,1438,1437],[1436,1319,1437],[1317,686,1509],[1484,932,1304],[1434,1432,1509],[1420,65,934],[931,930,736],[1367,1357,1309],[1372,1370,1371],[1204,1208,1315],[1426,938,1435],[1368,1363,1253],[1207,454,1190],[1302,1310,1272],[309,1377,390],[390,1377,1411],[1370,1372,998],[1411,1590,1148],[720,1433,1435],[1450,1383,1428],[1379,678,1382],[1405,678,1379],[1208,1291,1315],[1399,134,1319],[1367,1309,1373],[1373,1352,1276],[596,741,593],[553,1264,612],[1433,1436,1430],[1437,1438,1430],[964,1405,1379],[1373,1309,1352],[1265,1403,1390],[1233,1618,1434],[1365,1310,1302],[789,796,1365],[720,1435,938],[128,139,1389],[1466,933,1525],[1191,1640,1637],[1314,1442,943],[1141,353,1323],[1489,1138,1474],[1462,1477,1440],[1474,1138,1488],[1442,1314,1443],[1446,1030,1546],[1484,1145,697],[1549,1443,1445],[1470,1572,1468],[1397,1239,1507],[1649,1825,1824],[1259,1440,1477],[1451,1450,1449],[978,1446,652],[1454,1456,1451],[1451,1456,1450],[341,1507,595],[933,1547,79],[804,1452,1060],[1454,1455,1456],[1398,1460,1454],[1455,877,1456],[1277,1831,1825],[804,1060,1458],[1339,1459,1595],[1314,1104,1443],[933,1448,1547],[147,1460,1398],[1460,1461,1454],[1454,1461,1455],[1292,1125,1464],[417,1531,1480],[1459,1339,1325],[811,1756,335],[1512,936,1490],[777,1529,1098],[147,1475,1460],[1464,253,1459],[836,855,482],[1487,1486,1307],[1104,1501,1443],[1439,1200,1532],[1475,1469,1460],[1460,1469,1461],[1325,1464,1459],[1277,1825,1649],[1532,1200,1077],[844,877,1455],[1572,933,1466],[1479,568,973],[1509,335,1305],[1339,1595,1759],[1469,1476,1461],[1461,1476,1455],[1104,1470,1468],[1464,1472,253],[1117,1091,1407],[1756,1542,335],[1206,1395,1188],[335,1542,1330],[835,844,1455],[1471,1598,1462],[1491,1442,1441],[835,1455,1476],[1441,1442,1443],[1489,1474,1473],[1251,1236,1250],[1030,1452,1477],[1598,1439,1532],[978,1598,1492],[1426,1401,938],[1448,1584,1482],[1724,1497,1475],[1475,1497,1469],[1484,1535,932],[1307,1486,1113],[1487,696,1495],[1037,1491,1441],[1030,1446,936],[1453,1487,1495],[696,1467,1495],[1138,1489,1483],[1497,1143,1469],[1469,1143,1476],[652,1598,978],[850,1043,1150],[1482,1584,1320],[1731,98,1697],[1113,1554,1573],[1524,1532,1494],[1496,1467,696],[1452,1259,1477],[296,1504,1497],[1504,1143,1497],[1143,1499,1476],[718,910,1498],[868,1540,1528],[817,1253,810],[1490,696,1487],[1440,1491,1037],[1510,676,595],[1488,1492,1517],[781,1239,1397],[1467,1519,1503],[1500,1307,1759],[1149,397,452],[1504,1514,1143],[1514,842,1143],[1125,733,1458],[1503,1531,1555],[1276,1036,1137],[1440,723,1123],[1036,1508,1137],[817,1508,1253],[103,883,1112],[1458,731,1472],[1512,1490,1487],[1487,1453,1486],[1138,978,1488],[1036,1253,1508],[1398,149,147],[1474,1517,1513],[1125,1458,1472],[1486,1453,1554],[1518,1534,758],[345,1058,1062],[928,1202,1369],[1554,1541,1505],[1464,1125,1472],[1504,764,1514],[304,426,573],[1505,742,1506],[1479,1572,1478],[1519,1483,1489],[833,716,1069],[1522,1534,1518],[1115,1513,777],[811,335,1432],[1591,1533,1407],[777,1517,1529],[1513,1517,777],[1498,910,1397],[1069,1539,833],[833,1539,1537],[1522,1551,1534],[1534,1551,1523],[1538,1137,1523],[910,51,1397],[1367,1373,703],[1466,1525,1468],[157,1186,1832],[1429,1511,1506],[1573,1505,1506],[1259,1452,804],[1503,1495,1467],[262,483,780],[1572,1466,1468],[1536,1556,716],[716,1556,1069],[1544,1523,1551],[1544,1538,1523],[1511,1573,1506],[933,1572,1448],[1543,1537,1539],[1537,1543,1522],[1091,933,79],[1519,1540,1545],[1549,1445,86],[1069,1548,1539],[1548,1543,1539],[1543,1551,1522],[1500,1487,1307],[68,784,1186],[1552,1544,1551],[1550,1538,1544],[1538,1550,1137],[1519,1473,1540],[1547,1448,1482],[1560,1563,1536],[1536,1563,1556],[1556,1548,1069],[1543,1558,1551],[1137,1550,1276],[1453,1495,1555],[1561,1543,1548],[1543,1561,1558],[1558,1566,1551],[1552,1550,1544],[1569,1557,1550],[1557,1276,1550],[1276,1557,254],[1531,1503,1480],[1535,1530,1510],[1545,1503,1519],[1547,1482,79],[1566,1552,1551],[1552,1569,1550],[1503,1545,1480],[703,1377,309],[1625,675,756],[1037,1441,88],[929,254,1557],[849,1567,1560],[1556,1564,1548],[1492,1529,1517],[1252,1429,1506],[1553,1027,1429],[1453,1555,1541],[1554,1453,1541],[1233,686,1553],[1328,1104,1314],[1564,1576,1548],[1548,1576,1561],[1557,1562,929],[1520,112,1668],[1483,1446,1138],[778,1570,1567],[1563,1564,1556],[1561,1565,1558],[1565,1566,1558],[1569,1552,1566],[1562,1557,1569],[1530,1535,1484],[1387,1402,1395],[1621,1634,1387],[1567,1568,1560],[1560,1568,1563],[1571,1569,1566],[1344,1330,1542],[1577,1431,1353],[1638,233,304],[1524,1463,1529],[1353,1431,1175],[1077,1200,1413],[1478,1470,1104],[1568,1575,1563],[1563,1575,1564],[1575,1576,1564],[1561,1576,1565],[1565,1574,1566],[1562,1515,929],[1555,96,1541],[1531,417,96],[1555,1531,96],[1246,45,1651],[208,1577,1353],[1586,1568,1567],[1574,1571,1566],[1571,1583,1569],[1474,1513,1528],[1239,1322,1535],[1478,1572,1470],[1570,1586,1567],[1488,1517,1474],[8,1833,1837],[1123,1442,1491],[1589,1568,1586],[1576,1594,1565],[1565,1594,1574],[1562,198,1515],[1559,1441,1549],[1441,1443,1549],[1135,425,1481],[1239,1535,1507],[1595,1487,1500],[1570,1585,1586],[1589,1578,1568],[1568,1578,1575],[1579,1569,1583],[1177,1577,208],[115,1236,110],[1578,1593,1575],[1587,1576,1575],[1576,1581,1594],[1571,1582,1583],[1588,1579,1583],[1579,1580,1562],[1569,1579,1562],[1562,1580,198],[1027,1511,1429],[1589,1593,1578],[1587,1581,1576],[1582,1574,1594],[1574,1582,1571],[1575,1593,1587],[1583,1582,1588],[1580,1590,198],[1587,1593,1581],[1505,1541,96],[1369,1577,1177],[1573,1554,1505],[1479,1478,568],[1585,1589,1586],[1369,1177,704],[766,1584,1334],[977,1257,1059],[1091,1591,1407],[1591,1091,1457],[1585,1604,1589],[1581,1592,1594],[1602,1582,1594],[1582,1608,1588],[1608,1579,1588],[1579,1597,1580],[1419,1590,1580],[1597,1419,1580],[1431,1577,1291],[1589,1604,1593],[1601,1596,1593],[1593,1596,1581],[1306,1511,1027],[1511,1113,1573],[1786,1412,1585],[1412,1604,1585],[1581,1596,1592],[1592,1602,1594],[1608,1599,1579],[1599,1611,1579],[1579,1611,1597],[1512,1487,253],[1519,1489,1473],[1545,1540,868],[1083,1187,1402],[1117,1407,1400],[1292,733,1125],[284,1240,1245],[1604,1600,1593],[1600,1601,1593],[1582,1607,1608],[789,1369,704],[1467,1483,1519],[1601,1613,1596],[1596,1613,1592],[1602,1607,1582],[1620,1553,1252],[1601,1605,1613],[1592,1613,1602],[1602,1606,1607],[1608,1609,1599],[1599,1609,1611],[1603,1597,1611],[1265,1419,1597],[1603,1265,1597],[1392,1206,45],[928,1369,789],[1474,1528,1473],[1104,1468,1501],[1412,1521,1604],[1613,1631,1602],[1607,1610,1608],[1608,1610,1609],[1476,863,835],[1495,1503,1555],[1498,1397,718],[1520,1668,7],[1604,1615,1600],[1605,1601,1600],[1602,1631,1606],[1606,1610,1607],[1759,1595,1500],[1292,1298,733],[1615,1604,1521],[1609,1603,1611],[652,1462,1598],[1468,1525,1445],[1443,1501,1445],[1134,1723,150],[1521,1622,1615],[1615,1616,1600],[1616,1605,1600],[1605,1616,1612],[1605,1612,1613],[1612,1617,1613],[1613,1617,1631],[1606,1614,1610],[1265,1603,1403],[448,417,1480],[1595,253,1487],[1501,1468,1445],[1383,1456,877],[1490,1496,696],[1610,1627,1609],[1627,1621,1609],[1591,1481,1533],[1598,1471,1439],[1353,1261,703],[1606,1631,1614],[1609,1621,1403],[1532,1077,1494],[1528,1115,513],[1546,652,1446],[1211,928,1365],[1540,1473,1528],[1078,1502,1787],[1425,1430,1438],[1617,1630,1631],[959,749,944],[566,570,603],[1716,310,1521],[775,452,397],[1615,1636,1616],[1616,1636,1612],[1610,1632,1627],[789,704,1258],[1457,1481,1591],[1769,1756,811],[207,1629,722],[1629,1625,722],[1224,1277,1622],[1622,1636,1615],[1636,1646,1612],[1612,1630,1617],[1631,1626,1614],[1614,1632,1610],[1506,104,95],[1481,1457,1136],[1123,943,1442],[936,1446,1496],[1499,863,1476],[1629,1031,1625],[1233,1509,686],[1633,1634,1621],[1621,1387,1403],[1472,1512,253],[1177,208,704],[1277,1636,1622],[1626,1632,1614],[1627,1633,1621],[936,1496,1490],[185,1454,1451],[731,936,1512],[1638,1635,207],[553,1263,1264],[1653,1212,1639],[1633,1627,1632],[1633,1387,1634],[1458,1060,731],[368,1307,1113],[1264,1031,1629],[1152,850,1150],[1277,1644,1636],[1646,1637,1612],[1637,1630,1612],[1647,1631,1630],[1647,1626,1631],[1422,1524,1494],[1030,652,1546],[1635,1629,207],[1635,1264,1629],[1639,1646,1636],[1637,1640,1630],[1641,1632,1626],[1632,1642,1633],[1633,1643,1387],[842,1499,1143],[865,863,1499],[1516,978,1492],[67,1130,784],[1103,1505,96],[88,1441,1200],[1644,1639,1636],[1640,1647,1630],[1647,1641,1626],[1633,1648,1643],[1492,1532,1524],[1488,1516,1492],[1037,1471,1462],[612,1264,1635],[1502,1078,1124],[1641,1642,1632],[1648,1633,1642],[1528,513,868],[1492,1598,1532],[1095,991,760],[679,157,1664],[760,1128,1785],[1277,1650,1644],[320,1022,244],[1559,1549,86],[1676,1520,7],[1488,978,1516],[1095,760,1785],[1128,384,1120],[304,312,1638],[1081,1638,312],[1081,1635,1638],[103,612,1635],[652,1477,1462],[1650,1645,1644],[1645,1639,1644],[1639,1637,1646],[1640,1090,1647],[1654,1641,1647],[1654,1642,1641],[1654,1648,1642],[1643,1402,1387],[1432,335,1509],[384,1128,760],[1652,312,304],[103,1243,612],[1277,1649,1650],[1090,1654,1647],[1643,1648,1402],[1134,324,1675],[679,68,157],[1652,1081,312],[1136,301,803],[1653,1639,1645],[723,1440,1259],[803,854,1136],[104,1506,742],[1112,159,103],[1654,1083,1648],[977,1651,1257],[1397,1507,718],[1081,103,1635],[1650,677,1645],[1083,1402,1648],[1706,1655,1671],[1624,1704,1711],[767,2,1],[608,794,294],[1678,1683,1686],[767,1682,2],[1669,1692,1675],[296,1681,764],[1671,1656,1672],[17,1673,1679],[1706,1671,1673],[1662,1674,1699],[1655,1657,1656],[418,84,915],[1526,1514,764],[1658,1657,567],[870,1695,764],[813,1697,98],[1659,821,5],[60,1013,848],[1013,110,1213],[661,1038,1692],[1660,1703,17],[1693,1673,17],[1663,1715,1743],[1013,115,110],[344,1733,32],[1670,1663,1743],[1670,1743,1738],[1677,1670,1738],[1661,4,3],[1084,1683,1678],[1728,793,1130],[1683,1767,1196],[1677,1738,1196],[1279,1786,853],[294,1038,608],[1279,1689,1786],[870,18,1708],[870,1680,1695],[1705,10,1670],[1084,1767,1683],[1196,1738,1686],[1750,870,1681],[1750,18,870],[1773,1703,1660],[1135,47,425],[150,323,1134],[1707,1655,1706],[1741,344,1687],[1685,1691,1684],[1684,1691,802],[1672,1656,0],[1038,124,608],[1671,1672,1690],[1628,1218,1767],[1686,1275,1667],[1493,1750,1681],[1773,18,1750],[1773,1660,18],[1679,1671,16],[1735,1706,1673],[1667,1678,1686],[1688,1658,1],[1656,1688,0],[1293,1281,1458],[1698,1678,1667],[1696,1130,1722],[1698,1667,1696],[1715,1662,1699],[1692,1038,294],[1682,767,357],[1669,661,1692],[802,1702,824],[1028,1067,1784],[822,1624,778],[119,813,861],[1218,1670,1677],[1703,1693,17],[1658,1710,1],[750,1730,1729],[1701,750,1729],[1693,1735,1673],[1731,1694,98],[1691,1702,802],[783,1729,1719],[1680,870,1708],[1707,1709,1655],[533,756,675],[1691,1210,1702],[11,1705,1670],[1767,1218,1196],[1218,1677,1196],[1664,1716,1721],[1729,1725,1719],[1729,1072,1725],[1210,1116,1702],[1702,1720,824],[1682,1661,2],[1713,1719,1721],[1716,1786,1713],[1730,1722,1072],[294,1717,1811],[1692,294,1666],[1659,680,821],[824,1720,1714],[1726,1731,1718],[345,1062,1045],[1738,1743,1275],[1075,1089,1071],[783,1719,1689],[1275,684,1728],[1692,1666,1665],[1675,1692,1665],[294,1811,1666],[1716,1664,310],[1678,1698,1700],[6,9,1727],[676,649,595],[381,31,361],[1723,1804,1772],[1727,9,1694],[1720,1089,1714],[1786,1716,1412],[1683,1196,1686],[1718,1697,1085],[1116,1739,1702],[1739,1734,1720],[1702,1739,1720],[1089,1720,1734],[509,748,1745],[1743,1715,1726],[1717,294,794],[1116,1732,1739],[1718,1731,1697],[1696,1667,1130],[1134,1665,1723],[1694,712,98],[101,1687,102],[391,1736,101],[662,636,642],[1734,1447,1089],[1089,1447,1071],[436,99,493],[1689,1279,783],[1485,1465,1342],[1736,1687,101],[344,1741,1733],[1741,1742,1733],[1735,829,1706],[829,1707,1706],[1485,1332,1465],[952,1126,1742],[1747,1447,1734],[879,892,645],[1730,1146,1696],[829,1709,1707],[1709,1712,1655],[118,1739,1732],[1332,1744,1465],[1687,1749,1741],[1741,1758,1742],[679,1072,68],[1072,1722,68],[118,1747,1739],[1747,1734,1739],[1465,1744,1736],[1736,1740,1687],[1704,1701,783],[1665,624,1723],[1722,1130,67],[1025,1055,467],[1444,14,1701],[558,522,530],[1657,1658,1688],[1339,1746,1332],[1332,1748,1744],[1687,1740,1749],[1741,1749,1758],[1109,952,1742],[1747,118,141],[1671,1690,1628],[1671,1628,16],[1657,1688,1656],[1745,748,1447],[357,767,1710],[1746,1748,1332],[1146,1700,1698],[1759,1307,1338],[1239,781,1322],[1745,1447,1747],[522,1745,1747],[316,717,595],[148,1493,1724],[1758,1109,1742],[1725,1072,679],[726,719,1661],[1695,1680,1526],[1772,1750,1493],[148,1772,1493],[1542,1751,1101],[952,1109,1086],[1744,1752,1736],[1736,1752,1740],[1753,1755,1740],[391,1342,1736],[821,112,1520],[557,530,1747],[530,522,1747],[994,879,645],[1542,1756,1751],[1813,1693,1703],[1746,1754,1748],[1748,1764,1744],[1752,1757,1740],[1740,1757,1753],[1749,1740,1755],[1755,1763,1749],[1763,1758,1749],[1275,1743,684],[1813,1735,1693],[1107,1099,1101],[1723,624,1804],[1403,1603,1609],[1748,1754,1764],[1744,1757,1752],[1760,1109,1758],[1465,1736,1342],[436,115,99],[1686,1738,1275],[1751,1766,1101],[1759,1754,1746],[1755,1753,1763],[1570,1279,853],[1701,1146,750],[1655,1656,1671],[11,1670,1218],[1761,1751,1756],[1766,1107,1101],[1726,1623,1731],[1711,1704,1279],[67,784,68],[558,530,545],[1620,1618,1233],[1769,1761,1756],[102,1687,344],[1338,1754,1759],[1754,232,1764],[1744,1765,1757],[1757,1763,1753],[1762,1760,1758],[1760,1771,1109],[1339,1759,1746],[1675,1665,1134],[1730,1696,1722],[1774,1751,1761],[1766,1780,1107],[1780,1105,1107],[1764,1765,1744],[1763,1762,1758],[1772,1773,1750],[1811,1813,1703],[1434,1769,1432],[1780,1766,1751],[232,1781,1764],[1711,1279,1570],[1688,1,0],[1774,1780,1751],[1764,1781,1765],[1765,1768,1757],[1757,1768,1763],[1777,1782,1760],[1762,1777,1760],[1769,1774,1761],[1763,1777,1762],[1760,1782,1771],[232,1737,1781],[1768,1776,1763],[272,255,774],[1669,994,661],[1618,1769,1434],[1765,589,1768],[1770,1777,1763],[1701,1729,783],[1783,1774,1769],[1789,1780,1774],[589,1775,1768],[1776,1770,1763],[1782,1778,1771],[1771,1778,1070],[624,1703,1773],[624,1811,1703],[1620,1244,1618],[1779,1769,1618],[1779,1783,1769],[739,1735,1813],[1775,1776,1768],[1790,1777,1770],[1777,1778,1782],[1725,679,1721],[733,1293,1458],[1802,1618,1244],[1802,1779,1618],[1788,1783,1779],[1789,1774,1783],[1796,1780,1789],[1796,1119,1780],[1823,1817,325],[1699,1727,1623],[750,1146,1730],[1497,1724,296],[1128,1119,1796],[61,62,71],[1131,413,824],[1114,1111,249],[1784,1776,1775],[1123,723,1283],[1791,1788,1779],[1788,1789,1783],[1095,1797,1074],[1028,1784,1775],[1784,1770,1776],[1777,1790,1778],[1793,1797,1095],[1797,1800,1074],[1798,1790,1770],[1805,1802,1244],[1802,1791,1779],[1792,1789,1788],[1793,1785,1128],[1793,1095,1785],[1074,1800,1619],[741,457,593],[1798,1770,1784],[1798,1794,1790],[1786,1689,1713],[684,1726,1718],[1728,1085,793],[1795,1787,1502],[1806,1802,1805],[1819,1788,1791],[1067,1798,1784],[1790,1794,1778],[1795,1502,1124],[1801,1805,1787],[1807,1791,1802],[1807,1819,1791],[1819,1792,1788],[1799,1128,1796],[994,645,661],[684,1085,1728],[684,1718,1085],[1699,1623,1726],[1801,1787,1795],[1808,1789,1792],[1808,1796,1789],[1799,1793,1128],[1809,1797,1793],[1809,1803,1797],[1803,1800,1797],[1067,1794,1798],[774,255,1778],[1673,1671,1679],[879,1669,888],[19,1807,1802],[1810,1619,1800],[879,994,1669],[1794,774,1778],[1723,1772,148],[1804,1773,1772],[1814,1795,1124],[1649,1814,1124],[1814,1801,1795],[1812,1806,1805],[19,1802,1806],[19,1819,1807],[1810,1800,1803],[1804,624,1773],[1714,1131,824],[1801,1812,1805],[1812,19,1806],[1808,1792,1819],[1799,1809,1793],[1821,1810,1803],[1717,739,1813],[1061,1619,1822],[1794,1817,774],[79,1482,144],[1815,1801,1814],[23,1819,19],[589,1028,1775],[1817,1823,774],[1689,1719,1713],[1824,1814,1649],[1827,1818,1801],[1818,1812,1801],[1818,19,1812],[1818,20,19],[1816,1809,1799],[1821,1803,1809],[1822,1619,1810],[124,708,608],[1663,10,1715],[1815,1827,1801],[1820,1808,1819],[23,1820,1819],[603,1810,1821],[603,1822,1810],[1085,1697,793],[1628,1690,11],[1527,1704,1624],[1730,1072,1729],[1526,1444,1704],[1526,1680,1444],[1704,1444,1701],[1816,1821,1809],[1722,67,68],[317,272,1823],[1716,1713,1721],[16,1628,1767],[1527,1526,1704],[1824,1826,1814],[1814,1826,1815],[1818,21,20],[1835,1808,1820],[603,570,1822],[226,1070,1778],[1013,1181,1179],[1721,679,1664],[1717,1813,1811],[1828,1827,1815],[22,1820,23],[22,1835,1820],[1830,603,1821],[719,1659,5],[643,567,1657],[1717,794,739],[1825,1826,1824],[1828,1815,1826],[1829,21,1818],[1808,1835,13],[4,719,5],[10,1662,1715],[1828,1832,1827],[1832,1818,1827],[12,1833,1816],[1833,1821,1816],[1833,1830,1821],[14,1146,1701],[1186,1829,1818],[1280,603,1830],[14,1700,1146],[1667,1728,1130],[1825,1834,1826],[1834,1828,1826],[1832,1186,1818],[1836,13,1835],[1624,1711,1570],[778,1624,1570],[1719,1725,1721],[1002,1825,1831],[1002,1834,1825],[1834,1832,1828],[1186,21,1829],[1836,1835,22],[1837,1833,12],[1280,1830,1833],[1667,1275,1728],[16,1767,1084],[589,1765,1838],[1765,1781,1838],[1781,1737,1838],[1737,982,1838],[982,1053,1838],[1053,816,1838],[816,589,1838]] | |
},{}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({normals:[function(require,module,exports){var EPSILON=1e-6;exports.vertexNormals=function(faces,positions){var N=positions.length;var normals=new Array(N);for(var i=0;i<N;++i){normals[i]=[0,0,0]}for(var i=0;i<faces.length;++i){var f=faces[i];var p=0;var c=f[f.length-1];var n=f[0];for(var j=0;j<f.length;++j){p=c;c=n;n=f[(j+1)%f.length];var v0=positions[p];var v1=positions[c];var v2=positions[n];var d01=new Array(3);var m01=0;var d21=new Array(3);var m21=0;for(var k=0;k<3;++k){d01[k]=v0[k]-v1[k];m01+=d01[k]*d01[k];d21[k]=v2[k]-v1[k];m21+=d21[k]*d21[k]}if(m01*m21>EPSILON){var norm=normals[c];var w=1/Math.sqrt(m01*m21);for(var k=0;k<3;++k){var u=(k+1)%3;var v=(k+2)%3;norm[k]+=w*(d21[u]*d01[v]-d21[v]*d01[u])}}}}for(var i=0;i<N;++i){var norm=normals[i];var m=0;for(var k=0;k<3;++k){m+=norm[k]*norm[k]}if(m>EPSILON){var w=1/Math.sqrt(m);for(var k=0;k<3;++k){norm[k]*=w}}else{for(var k=0;k<3;++k){norm[k]=0}}}return normals};exports.faceNormals=function(faces,positions){var N=faces.length;var normals=new Array(N);for(var i=0;i<N;++i){var f=faces[i];var pos=new Array(3);for(var j=0;j<3;++j){pos[j]=positions[f[j]]}var d01=new Array(3);var d21=new Array(3);for(var j=0;j<3;++j){d01[j]=pos[1][j]-pos[0][j];d21[j]=pos[2][j]-pos[0][j]}var n=new Array(3);var l=0;for(var j=0;j<3;++j){var u=(j+1)%3;var v=(j+2)%3;n[j]=d01[u]*d21[v]-d01[v]*d21[u];l+=n[j]*n[j]}if(l>EPSILON){l=1/Math.sqrt(l)}else{l=0}for(var j=0;j<3;++j){n[j]*=l}normals[i]=n}return normals}},{}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){var base64=require("base64-js");var ieee754=require("ieee754");var isArray=require("is-array");exports.Buffer=Buffer;exports.SlowBuffer=SlowBuffer;exports.INSPECT_MAX_BYTES=50;Buffer.poolSize=8192;var kMaxLength=1073741823;var rootParent={};Buffer.TYPED_ARRAY_SUPPORT=function(){try{var buf=new ArrayBuffer(0);var arr=new Uint8Array(buf);arr.foo=function(){return 42};return 42===arr.foo()&&typeof arr.subarray==="function"&&new Uint8Array(1).subarray(1,1).byteLength===0}catch(e){return false}}();function Buffer(subject,encoding,noZero){if(!(this instanceof Buffer))return new Buffer(subject,encoding,noZero);var type=typeof subject;var length;if(type==="number")length=subject>0?subject>>>0:0;else if(type==="string"){length=Buffer.byteLength(subject,encoding)}else if(type==="object"&&subject!==null){if(subject.type==="Buffer"&&isArray(subject.data))subject=subject.data;length=+subject.length>0?Math.floor(+subject.length):0}else throw new TypeError("must start with number, buffer, array or string");if(length>kMaxLength)throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+kMaxLength.toString(16)+" bytes");var buf;if(Buffer.TYPED_ARRAY_SUPPORT){buf=Buffer._augment(new Uint8Array(length))}else{buf=this;buf.length=length;buf._isBuffer=true}var i;if(Buffer.TYPED_ARRAY_SUPPORT&&typeof subject.byteLength==="number"){buf._set(subject)}else if(isArrayish(subject)){if(Buffer.isBuffer(subject)){for(i=0;i<length;i++)buf[i]=subject.readUInt8(i)}else{for(i=0;i<length;i++)buf[i]=(subject[i]%256+256)%256}}else if(type==="string"){buf.write(subject,0,encoding)}else if(type==="number"&&!Buffer.TYPED_ARRAY_SUPPORT&&!noZero){for(i=0;i<length;i++){buf[i]=0}}if(length>0&&length<=Buffer.poolSize)buf.parent=rootParent;return buf}function SlowBuffer(subject,encoding,noZero){if(!(this instanceof SlowBuffer))return new SlowBuffer(subject,encoding,noZero);var buf=new Buffer(subject,encoding,noZero);delete buf.parent;return buf}Buffer.isBuffer=function(b){return!!(b!=null&&b._isBuffer)};Buffer.compare=function(a,b){if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b))throw new TypeError("Arguments must be Buffers");var x=a.length;var y=b.length;for(var i=0,len=Math.min(x,y);i<len&&a[i]===b[i];i++){}if(i!==len){x=a[i];y=b[i]}if(x<y)return-1;if(y<x)return 1;return 0};Buffer.isEncoding=function(encoding){switch(String(encoding).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return true;default:return false}};Buffer.concat=function(list,totalLength){if(!isArray(list))throw new TypeError("Usage: Buffer.concat(list[, length])");if(list.length===0){return new Buffer(0)}else if(list.length===1){return list[0]}var i;if(totalLength===undefined){totalLength=0;for(i=0;i<list.length;i++){totalLength+=list[i].length}}var buf=new Buffer(totalLength);var pos=0;for(i=0;i<list.length;i++){var item=list[i];item.copy(buf,pos);pos+=item.length}return buf};Buffer.byteLength=function(str,encoding){var ret;str=str+"";switch(encoding||"utf8"){case"ascii":case"binary":case"raw":ret=str.length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":ret=str.length*2;break;case"hex":ret=str.length>>>1;break;case"utf8":case"utf-8":ret=utf8ToBytes(str).length;break;case"base64":ret=base64ToBytes(str).length;break;default:ret=str.length}return ret};Buffer.prototype.length=undefined;Buffer.prototype.parent=undefined;Buffer.prototype.toString=function(encoding,start,end){var loweredCase=false;start=start>>>0;end=end===undefined||end===Infinity?this.length:end>>>0;if(!encoding)encoding="utf8";if(start<0)start=0;if(end>this.length)end=this.length;if(end<=start)return"";while(true){switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"binary":return binarySlice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase();loweredCase=true}}};Buffer.prototype.equals=function(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");return Buffer.compare(this,b)===0};Buffer.prototype.inspect=function(){var str="";var max=exports.INSPECT_MAX_BYTES;if(this.length>0){str=this.toString("hex",0,max).match(/.{2}/g).join(" ");if(this.length>max)str+=" ... "}return"<Buffer "+str+">"};Buffer.prototype.compare=function(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");return Buffer.compare(this,b)};Buffer.prototype.get=function(offset){console.log(".get() is deprecated. Access using array indexes instead.");return this.readUInt8(offset)};Buffer.prototype.set=function(v,offset){console.log(".set() is deprecated. Access using array indexes instead.");return this.writeUInt8(v,offset)};function hexWrite(buf,string,offset,length){offset=Number(offset)||0;var remaining=buf.length-offset;if(!length){length=remaining}else{length=Number(length);if(length>remaining){length=remaining}}var strLen=string.length;if(strLen%2!==0)throw new Error("Invalid hex string");if(length>strLen/2){length=strLen/2}for(var i=0;i<length;i++){var byte=parseInt(string.substr(i*2,2),16);if(isNaN(byte))throw new Error("Invalid hex string");buf[offset+i]=byte}return i}function utf8Write(buf,string,offset,length){var charsWritten=blitBuffer(utf8ToBytes(string,buf.length-offset),buf,offset,length);return charsWritten}function asciiWrite(buf,string,offset,length){var charsWritten=blitBuffer(asciiToBytes(string),buf,offset,length);return charsWritten}function binaryWrite(buf,string,offset,length){return asciiWrite(buf,string,offset,length)}function base64Write(buf,string,offset,length){var charsWritten=blitBuffer(base64ToBytes(string),buf,offset,length);return charsWritten}function utf16leWrite(buf,string,offset,length){var charsWritten=blitBuffer(utf16leToBytes(string,buf.length-offset),buf,offset,length,2);return charsWritten}Buffer.prototype.write=function(string,offset,length,encoding){if(isFinite(offset)){if(!isFinite(length)){encoding=length;length=undefined}}else{var swap=encoding;encoding=offset;offset=length;length=swap}offset=Number(offset)||0;if(length<0||offset<0||offset>this.length)throw new RangeError("attempt to write outside buffer bounds");var remaining=this.length-offset;if(!length){length=remaining}else{length=Number(length);if(length>remaining){length=remaining}}encoding=String(encoding||"utf8").toLowerCase();var ret;switch(encoding){case"hex":ret=hexWrite(this,string,offset,length);break;case"utf8":case"utf-8":ret=utf8Write(this,string,offset,length);break;case"ascii":ret=asciiWrite(this,string,offset,length);break;case"binary":ret=binaryWrite(this,string,offset,length);break;case"base64":ret=base64Write(this,string,offset,length);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":ret=utf16leWrite(this,string,offset,length);break;default:throw new TypeError("Unknown encoding: "+encoding)}return ret};Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function base64Slice(buf,start,end){if(start===0&&end===buf.length){return base64.fromByteArray(buf)}else{return base64.fromByteArray(buf.slice(start,end))}}function utf8Slice(buf,start,end){var res="";var tmp="";end=Math.min(buf.length,end);for(var i=start;i<end;i++){if(buf[i]<=127){res+=decodeUtf8Char(tmp)+String.fromCharCode(buf[i]);tmp=""}else{tmp+="%"+buf[i].toString(16)}}return res+decodeUtf8Char(tmp)}function asciiSlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;i++){ret+=String.fromCharCode(buf[i]&127)}return ret}function binarySlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;i++){ret+=String.fromCharCode(buf[i])}return ret}function hexSlice(buf,start,end){var len=buf.length;if(!start||start<0)start=0;if(!end||end<0||end>len)end=len;var out="";for(var i=start;i<end;i++){out+=toHex(buf[i])}return out}function utf16leSlice(buf,start,end){var bytes=buf.slice(start,end);var res="";for(var i=0;i<bytes.length;i+=2){res+=String.fromCharCode(bytes[i]+bytes[i+1]*256)}return res}Buffer.prototype.slice=function(start,end){var len=this.length;start=~~start;end=end===undefined?len:~~end;if(start<0){start+=len;if(start<0)start=0}else if(start>len){start=len}if(end<0){end+=len;if(end<0)end=0}else if(end>len){end=len}if(end<start)end=start;var newBuf;if(Buffer.TYPED_ARRAY_SUPPORT){newBuf=Buffer._augment(this.subarray(start,end))}else{var sliceLen=end-start;newBuf=new Buffer(sliceLen,undefined,true);for(var i=0;i<sliceLen;i++){newBuf[i]=this[i+start]}}if(newBuf.length)newBuf.parent=this.parent||this;return newBuf};function checkOffset(offset,ext,length){if(offset%1!==0||offset<0)throw new RangeError("offset is not uint");if(offset+ext>length)throw new RangeError("Trying to access beyond buffer length")}Buffer.prototype.readUIntLE=function(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i<byteLength&&(mul*=256))val+=this[offset+i]*mul;return val};Buffer.prototype.readUIntBE=function(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset+--byteLength];var mul=1;while(byteLength>0&&(mul*=256))val+=this[offset+--byteLength]*mul;return val};Buffer.prototype.readUInt8=function(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);return this[offset]};Buffer.prototype.readUInt16LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]|this[offset+1]<<8};Buffer.prototype.readUInt16BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]<<8|this[offset+1]};Buffer.prototype.readUInt32LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+this[offset+3]*16777216};Buffer.prototype.readUInt32BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]*16777216+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])};Buffer.prototype.readIntLE=function(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i<byteLength&&(mul*=256))val+=this[offset+i]*mul;mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readIntBE=function(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var i=byteLength;var mul=1;var val=this[offset+--i];while(i>0&&(mul*=256))val+=this[offset+--i]*mul;mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readInt8=function(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);if(!(this[offset]&128))return this[offset];return(255-this[offset]+1)*-1};Buffer.prototype.readInt16LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt16BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt32LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24};Buffer.prototype.readInt32BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]};Buffer.prototype.readFloatLE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,true,23,4)};Buffer.prototype.readFloatBE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,false,23,4)};Buffer.prototype.readDoubleLE=function(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,true,52,8)};Buffer.prototype.readDoubleBE=function(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,false,52,8)};function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError("buffer must be a Buffer instance");if(value>max||value<min)throw new RangeError("value is out of bounds");if(offset+ext>buf.length)throw new RangeError("index out of range")}Buffer.prototype.writeUIntLE=function(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength),0);var mul=1;var i=0;this[offset]=value&255;while(++i<byteLength&&(mul*=256))this[offset+i]=value/mul>>>0&255;return offset+byteLength};Buffer.prototype.writeUIntBE=function(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength),0);var i=byteLength-1;var mul=1;this[offset+i]=value&255;while(--i>=0&&(mul*=256))this[offset+i]=value/mul>>>0&255;return offset+byteLength};Buffer.prototype.writeUInt8=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,1,255,0);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);this[offset]=value;return offset+1};function objectWriteUInt16(buf,value,offset,littleEndian){if(value<0)value=65535+value+1;for(var i=0,j=Math.min(buf.length-offset,2);i<j;i++){buf[offset+i]=(value&255<<8*(littleEndian?i:1-i))>>>(littleEndian?i:1-i)*8}}Buffer.prototype.writeUInt16LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value;this[offset+1]=value>>>8}else objectWriteUInt16(this,value,offset,true);return offset+2};Buffer.prototype.writeUInt16BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value}else objectWriteUInt16(this,value,offset,false);return offset+2};function objectWriteUInt32(buf,value,offset,littleEndian){if(value<0)value=4294967295+value+1;for(var i=0,j=Math.min(buf.length-offset,4);i<j;i++){buf[offset+i]=value>>>(littleEndian?i:3-i)*8&255}}Buffer.prototype.writeUInt32LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset+3]=value>>>24;this[offset+2]=value>>>16;this[offset+1]=value>>>8;this[offset]=value}else objectWriteUInt32(this,value,offset,true);return offset+4};Buffer.prototype.writeUInt32BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value}else objectWriteUInt32(this,value,offset,false);return offset+4};Buffer.prototype.writeIntLE=function(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;if(!noAssert){checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength-1)-1,-Math.pow(2,8*byteLength-1))}var i=0;var mul=1;var sub=value<0?1:0;this[offset]=value&255;while(++i<byteLength&&(mul*=256))this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength};Buffer.prototype.writeIntBE=function(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;if(!noAssert){checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength-1)-1,-Math.pow(2,8*byteLength-1))}var i=byteLength-1;var mul=1;var sub=value<0?1:0;this[offset+i]=value&255;while(--i>=0&&(mul*=256))this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength};Buffer.prototype.writeInt8=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,1,127,-128);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);if(value<0)value=255+value+1;this[offset]=value;return offset+1};Buffer.prototype.writeInt16LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value;this[offset+1]=value>>>8}else objectWriteUInt16(this,value,offset,true);return offset+2};Buffer.prototype.writeInt16BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value}else objectWriteUInt16(this,value,offset,false);return offset+2};Buffer.prototype.writeInt32LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value;this[offset+1]=value>>>8;this[offset+2]=value>>>16;this[offset+3]=value>>>24}else objectWriteUInt32(this,value,offset,true);return offset+4};Buffer.prototype.writeInt32BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(value<0)value=4294967295+value+1;if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value}else objectWriteUInt32(this,value,offset,false);return offset+4};function checkIEEE754(buf,value,offset,ext,max,min){if(value>max||value<min)throw new RangeError("value is out of bounds");if(offset+ext>buf.length)throw new RangeError("index out of range");if(offset<0)throw new RangeError("index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){if(!noAssert)checkIEEE754(buf,value,offset,4,3.4028234663852886e38,-3.4028234663852886e38);ieee754.write(buf,value,offset,littleEndian,23,4);return offset+4}Buffer.prototype.writeFloatLE=function(value,offset,noAssert){return writeFloat(this,value,offset,true,noAssert)};Buffer.prototype.writeFloatBE=function(value,offset,noAssert){return writeFloat(this,value,offset,false,noAssert)};function writeDouble(buf,value,offset,littleEndian,noAssert){if(!noAssert)checkIEEE754(buf,value,offset,8,1.7976931348623157e308,-1.7976931348623157e308);ieee754.write(buf,value,offset,littleEndian,52,8);return offset+8}Buffer.prototype.writeDoubleLE=function(value,offset,noAssert){return writeDouble(this,value,offset,true,noAssert)};Buffer.prototype.writeDoubleBE=function(value,offset,noAssert){return writeDouble(this,value,offset,false,noAssert)};Buffer.prototype.copy=function(target,target_start,start,end){var source=this;if(!start)start=0;if(!end&&end!==0)end=this.length;if(target_start>=target.length)target_start=target.length;if(!target_start)target_start=0;if(end>0&&end<start)end=start;if(end===start)return 0;if(target.length===0||source.length===0)return 0;if(target_start<0)throw new RangeError("targetStart out of bounds");if(start<0||start>=source.length)throw new RangeError("sourceStart out of bounds");if(end<0)throw new RangeError("sourceEnd out of bounds");if(end>this.length)end=this.length;if(target.length-target_start<end-start)end=target.length-target_start+start;var len=end-start;if(len<1e3||!Buffer.TYPED_ARRAY_SUPPORT){for(var i=0;i<len;i++){target[i+target_start]=this[i+start]}}else{target._set(this.subarray(start,start+len),target_start)}return len};Buffer.prototype.fill=function(value,start,end){if(!value)value=0;if(!start)start=0;if(!end)end=this.length;if(end<start)throw new RangeError("end < start");if(end===start)return;if(this.length===0)return;if(start<0||start>=this.length)throw new RangeError("start out of bounds");if(end<0||end>this.length)throw new RangeError("end out of bounds");var i;if(typeof value==="number"){for(i=start;i<end;i++){this[i]=value}}else{var bytes=utf8ToBytes(value.toString());var len=bytes.length;for(i=start;i<end;i++){this[i]=bytes[i%len]}}return this};Buffer.prototype.toArrayBuffer=function(){if(typeof Uint8Array!=="undefined"){if(Buffer.TYPED_ARRAY_SUPPORT){return new Buffer(this).buffer}else{var buf=new Uint8Array(this.length);for(var i=0,len=buf.length;i<len;i+=1){buf[i]=this[i]}return buf.buffer}}else{throw new TypeError("Buffer.toArrayBuffer not supported in this browser")}};var BP=Buffer.prototype;Buffer._augment=function(arr){arr.constructor=Buffer;arr._isBuffer=true;arr._get=arr.get;arr._set=arr.set;arr.get=BP.get;arr.set=BP.set;arr.write=BP.write;arr.toString=BP.toString;arr.toLocaleString=BP.toString;arr.toJSON=BP.toJSON;arr.equals=BP.equals;arr.compare=BP.compare;arr.copy=BP.copy;arr.slice=BP.slice;arr.readUIntLE=BP.readUIntLE;arr.readUIntBE=BP.readUIntBE;arr.readUInt8=BP.readUInt8;arr.readUInt16LE=BP.readUInt16LE;arr.readUInt16BE=BP.readUInt16BE;arr.readUInt32LE=BP.readUInt32LE;arr.readUInt32BE=BP.readUInt32BE;arr.readIntLE=BP.readIntLE;arr.readIntBE=BP.readIntBE;arr.readInt8=BP.readInt8;arr.readInt16LE=BP.readInt16LE;arr.readInt16BE=BP.readInt16BE;arr.readInt32LE=BP.readInt32LE;arr.readInt32BE=BP.readInt32BE;arr.readFloatLE=BP.readFloatLE;arr.readFloatBE=BP.readFloatBE;arr.readDoubleLE=BP.readDoubleLE;arr.readDoubleBE=BP.readDoubleBE;arr.writeUInt8=BP.writeUInt8;arr.writeUIntLE=BP.writeUIntLE;arr.writeUIntBE=BP.writeUIntBE;arr.writeUInt16LE=BP.writeUInt16LE;arr.writeUInt16BE=BP.writeUInt16BE;arr.writeUInt32LE=BP.writeUInt32LE;arr.writeUInt32BE=BP.writeUInt32BE;arr.writeIntLE=BP.writeIntLE;arr.writeIntBE=BP.writeIntBE;arr.writeInt8=BP.writeInt8;arr.writeInt16LE=BP.writeInt16LE;arr.writeInt16BE=BP.writeInt16BE;arr.writeInt32LE=BP.writeInt32LE;arr.writeInt32BE=BP.writeInt32BE;arr.writeFloatLE=BP.writeFloatLE;arr.writeFloatBE=BP.writeFloatBE;arr.writeDoubleLE=BP.writeDoubleLE;arr.writeDoubleBE=BP.writeDoubleBE;arr.fill=BP.fill;arr.inspect=BP.inspect;arr.toArrayBuffer=BP.toArrayBuffer;return arr};var INVALID_BASE64_RE=/[^+\/0-9A-z\-]/g;function base64clean(str){str=stringtrim(str).replace(INVALID_BASE64_RE,"");if(str.length<2)return"";while(str.length%4!==0){str=str+"="}return str}function stringtrim(str){if(str.trim)return str.trim();return str.replace(/^\s+|\s+$/g,"")}function isArrayish(subject){return isArray(subject)||Buffer.isBuffer(subject)||subject&&typeof subject==="object"&&typeof subject.length==="number"}function toHex(n){if(n<16)return"0"+n.toString(16);return n.toString(16)}function utf8ToBytes(string,units){var codePoint,length=string.length;var leadSurrogate=null;units=units||Infinity;var bytes=[];var i=0;for(;i<length;i++){codePoint=string.charCodeAt(i);if(codePoint>55295&&codePoint<57344){if(leadSurrogate){if(codePoint<56320){if((units-=3)>-1)bytes.push(239,191,189);leadSurrogate=codePoint;continue}else{codePoint=leadSurrogate-55296<<10|codePoint-56320|65536;leadSurrogate=null}}else{if(codePoint>56319){if((units-=3)>-1)bytes.push(239,191,189);continue}else if(i+1===length){if((units-=3)>-1)bytes.push(239,191,189);continue}else{leadSurrogate=codePoint;continue}}}else if(leadSurrogate){if((units-=3)>-1)bytes.push(239,191,189);leadSurrogate=null}if(codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,codePoint&63|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,codePoint&63|128)}else if(codePoint<2097152){if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,codePoint&63|128)}else{throw new Error("Invalid code point")}}return bytes}function asciiToBytes(str){var byteArray=[];for(var i=0;i<str.length;i++){byteArray.push(str.charCodeAt(i)&255)}return byteArray}function utf16leToBytes(str,units){var c,hi,lo;var byteArray=[];for(var i=0;i<str.length;i++){if((units-=2)<0)break;c=str.charCodeAt(i);hi=c>>8;lo=c%256;byteArray.push(lo);byteArray.push(hi)}return byteArray}function base64ToBytes(str){return base64.toByteArray(base64clean(str))}function blitBuffer(src,dst,offset,length,unitSize){if(unitSize)length-=length%unitSize;for(var i=0;i<length;i++){if(i+offset>=dst.length||i>=src.length)break;dst[i+offset]=src[i]}return i}function decodeUtf8Char(str){try{return decodeURIComponent(str)}catch(err){return String.fromCharCode(65533)}}},{"base64-js":2,ieee754:3,"is-array":4}],2:[function(require,module,exports){var lookup="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";(function(exports){"use strict";var Arr=typeof Uint8Array!=="undefined"?Uint8Array:Array;var PLUS="+".charCodeAt(0);var SLASH="/".charCodeAt(0);var NUMBER="0".charCodeAt(0);var LOWER="a".charCodeAt(0);var UPPER="A".charCodeAt(0);var PLUS_URL_SAFE="-".charCodeAt(0);var SLASH_URL_SAFE="_".charCodeAt(0);function decode(elt){var code=elt.charCodeAt(0);if(code===PLUS||code===PLUS_URL_SAFE)return 62;if(code===SLASH||code===SLASH_URL_SAFE)return 63;if(code<NUMBER)return-1;if(code<NUMBER+10)return code-NUMBER+26+26;if(code<UPPER+26)return code-UPPER;if(code<LOWER+26)return code-LOWER+26}function b64ToByteArray(b64){var i,j,l,tmp,placeHolders,arr;if(b64.length%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}var len=b64.length;placeHolders="="===b64.charAt(len-2)?2:"="===b64.charAt(len-1)?1:0;arr=new Arr(b64.length*3/4-placeHolders);l=placeHolders>0?b64.length-4:b64.length;var L=0;function push(v){arr[L++]=v}for(i=0,j=0;i<l;i+=4,j+=3){tmp=decode(b64.charAt(i))<<18|decode(b64.charAt(i+1))<<12|decode(b64.charAt(i+2))<<6|decode(b64.charAt(i+3));push((tmp&16711680)>>16);push((tmp&65280)>>8);push(tmp&255)}if(placeHolders===2){tmp=decode(b64.charAt(i))<<2|decode(b64.charAt(i+1))>>4;push(tmp&255)}else if(placeHolders===1){tmp=decode(b64.charAt(i))<<10|decode(b64.charAt(i+1))<<4|decode(b64.charAt(i+2))>>2;push(tmp>>8&255);push(tmp&255)}return arr}function uint8ToBase64(uint8){var i,extraBytes=uint8.length%3,output="",temp,length;function encode(num){return lookup.charAt(num)}function tripletToBase64(num){return encode(num>>18&63)+encode(num>>12&63)+encode(num>>6&63)+encode(num&63)}for(i=0,length=uint8.length-extraBytes;i<length;i+=3){temp=(uint8[i]<<16)+(uint8[i+1]<<8)+uint8[i+2];output+=tripletToBase64(temp)}switch(extraBytes){case 1:temp=uint8[uint8.length-1];output+=encode(temp>>2);output+=encode(temp<<4&63);output+="==";break;case 2:temp=(uint8[uint8.length-2]<<8)+uint8[uint8.length-1];output+=encode(temp>>10);output+=encode(temp>>4&63);output+=encode(temp<<2&63);output+="=";break}return output}exports.toByteArray=b64ToByteArray;exports.fromByteArray=uint8ToBase64})(typeof exports==="undefined"?this.base64js={}:exports)},{}],3:[function(require,module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m,eLen=nBytes*8-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,nBits=-7,i=isLE?nBytes-1:0,d=isLE?-1:1,s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8);m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8);if(e===0){e=1-eBias}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity}else{m=m+Math.pow(2,mLen);e=e-eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c,eLen=nBytes*8-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0,i=isLE?0:nBytes-1,d=isLE?1:-1,s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2}if(e+eBias>=1){value+=rt/c}else{value+=rt*Math.pow(2,1-eBias)}if(value*c>=2){e++;c/=2}if(e+eBias>=eMax){m=0;e=eMax}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0}}for(;mLen>=8;buffer[offset+i]=m&255,i+=d,m/=256,mLen-=8);e=e<<mLen|m;eLen+=mLen;for(;eLen>0;buffer[offset+i]=e&255,i+=d,e/=256,eLen-=8);buffer[offset+i-d]|=s*128}},{}],4:[function(require,module,exports){var isArray=Array.isArray;var str=Object.prototype.toString;module.exports=isArray||function(val){return!!val&&"[object Array]"==str.call(val)}},{}],5:[function(require,module,exports){var dtype=require("dtype");module.exports=pack;function pack(arr,type){type=type||"float32";if(!arr[0]||!arr[0].length){return arr}var Arr=typeof type==="string"?dtype(type):type;var dim=arr[0].length;var out=new Arr(arr.length*dim);var k=0;for(var i=0;i<arr.length;i++)for(var j=0;j<dim;j++){out[k++]=arr[i][j]}return out}},{dtype:6}],6:[function(require,module,exports){module.exports=function(dtype){switch(dtype){case"int8":return Int8Array;case"int16":return Int16Array;case"int32":return Int32Array;case"uint8":return Uint8Array;case"uint16":return Uint16Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;case"array":return Array}}},{}],7:[function(require,module,exports){"use strict";var pool=require("typedarray-pool");var ops=require("ndarray-ops");var ndarray=require("ndarray");var webglew=require("webglew");var SUPPORTED_TYPES=["uint8","uint8_clamped","uint16","uint32","int8","int16","int32","float32"];function GLBuffer(gl,type,handle,length,usage){this.gl=gl;this.type=type;this.handle=handle;this.length=length;this.usage=usage}var proto=GLBuffer.prototype;proto.bind=function(){this.gl.bindBuffer(this.type,this.handle)};proto.unbind=function(){this.gl.bindBuffer(this.type,null)};proto.dispose=function(){this.gl.deleteBuffer(this.handle) | |
};function updateTypeArray(gl,type,len,usage,data,offset){var dataLen=data.length*data.BYTES_PER_ELEMENT;if(offset<0){gl.bufferData(type,data,usage);return dataLen}if(dataLen+offset>len){throw new Error("gl-buffer: If resizing buffer, must not specify offset")}gl.bufferSubData(type,offset,data);return len}function makeScratchTypeArray(array,dtype){var res=pool.malloc(array.length,dtype);var n=array.length;for(var i=0;i<n;++i){res[i]=array[i]}return res}function isPacked(shape,stride){var n=1;for(var i=stride.length-1;i>=0;--i){if(stride[i]!==n){return false}n*=shape[i]}return true}proto.update=function(array,offset){if(typeof offset!=="number"){offset=-1}this.bind();if(typeof array==="object"&&typeof array.shape!=="undefined"){var dtype=array.dtype;if(SUPPORTED_TYPES.indexOf(dtype)<0){dtype="float32"}if(this.type===this.gl.ELEMENT_ARRAY_BUFFER){var wgl=webglew(this.gl);var ext=wgl.OES_element_index_uint;if(ext&&dtype!=="uint16"){dtype="uint32"}else{dtype="uint16"}}if(dtype===array.dtype&&isPacked(array.shape,array.stride)){if(array.offset===0&&array.data.length===array.shape[0]){this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,array.data,offset)}else{this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,array.data.subarray(array.offset,array.shape[0]),offset)}}else{var tmp=pool.malloc(array.size,dtype);var ndt=ndarray(tmp,array.shape);ops.assign(ndt,array);if(offset<0){this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,tmp,offset)}else{this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,tmp.subarray(0,array.size),offset)}pool.free(tmp)}}else if(Array.isArray(array)){var t;if(this.type===this.gl.ELEMENT_ARRAY_BUFFER){t=makeScratchTypeArray(array,"uint16")}else{t=makeScratchTypeArray(array,"float32")}if(offset<0){this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,t,offset)}else{this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,t.subarray(0,array.length),offset)}pool.free(t)}else if(typeof array==="object"&&typeof array.length==="number"){this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,array,offset)}else if(typeof array==="number"||array===undefined){if(offset>=0){throw new Error("gl-buffer: Cannot specify offset when resizing buffer")}array=array|0;if(array<=0){array=1}this.gl.bufferData(this.type,array|0,this.usage);this.length=array}else{throw new Error("gl-buffer: Invalid data type")}};function createBuffer(gl,data,type,usage){webglew(gl);type=type||gl.ARRAY_BUFFER;usage=usage||gl.DYNAMIC_DRAW;if(type!==gl.ARRAY_BUFFER&&type!==gl.ELEMENT_ARRAY_BUFFER){throw new Error("gl-buffer: Invalid type for webgl buffer, must be either gl.ARRAY_BUFFER or gl.ELEMENT_ARRAY_BUFFER")}if(usage!==gl.DYNAMIC_DRAW&&usage!==gl.STATIC_DRAW&&usage!==gl.STREAM_DRAW){throw new Error("gl-buffer: Invalid usage for buffer, must be either gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW")}var handle=gl.createBuffer();var result=new GLBuffer(gl,type,handle,0,usage);result.update(data);return result}module.exports=createBuffer},{ndarray:13,"ndarray-ops":8,"typedarray-pool":17,webglew:19}],8:[function(require,module,exports){"use strict";var compile=require("cwise-compiler");var EmptyProc={body:"",args:[],thisVars:[],localVars:[]};function fixup(x){if(!x){return EmptyProc}for(var i=0;i<x.args.length;++i){var a=x.args[i];if(i===0){x.args[i]={name:a,lvalue:true,rvalue:!!x.rvalue,count:x.count||1}}else{x.args[i]={name:a,lvalue:false,rvalue:true,count:1}}}if(!x.thisVars){x.thisVars=[]}if(!x.localVars){x.localVars=[]}return x}function pcompile(user_args){return compile({args:user_args.args,pre:fixup(user_args.pre),body:fixup(user_args.body),post:fixup(user_args.proc),funcName:user_args.funcName})}function makeOp(user_args){var args=[];for(var i=0;i<user_args.args.length;++i){args.push("a"+i)}var wrapper=new Function("P",["return function ",user_args.funcName,"_ndarrayops(",args.join(","),") {P(",args.join(","),");return a0}"].join(""));return wrapper(pcompile(user_args))}var assign_ops={add:"+",sub:"-",mul:"*",div:"/",mod:"%",band:"&",bor:"|",bxor:"^",lshift:"<<",rshift:">>",rrshift:">>>"};(function(){for(var id in assign_ops){var op=assign_ops[id];exports[id]=makeOp({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+op+"c"},funcName:id});exports[id+"eq"]=makeOp({args:["array","array"],body:{args:["a","b"],body:"a"+op+"=b"},rvalue:true,funcName:id+"eq"});exports[id+"s"]=makeOp({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+op+"s"},funcName:id+"s"});exports[id+"seq"]=makeOp({args:["array","scalar"],body:{args:["a","s"],body:"a"+op+"=s"},rvalue:true,funcName:id+"seq"})}})();var unary_ops={not:"!",bnot:"~",neg:"-",recip:"1.0/"};(function(){for(var id in unary_ops){var op=unary_ops[id];exports[id]=makeOp({args:["array","array"],body:{args:["a","b"],body:"a="+op+"b"},funcName:id});exports[id+"eq"]=makeOp({args:["array"],body:{args:["a"],body:"a="+op+"a"},rvalue:true,count:2,funcName:id+"eq"})}})();var binary_ops={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};(function(){for(var id in binary_ops){var op=binary_ops[id];exports[id]=makeOp({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+op+"c"},funcName:id});exports[id+"s"]=makeOp({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+op+"s"},funcName:id+"s"});exports[id+"eq"]=makeOp({args:["array","array"],body:{args:["a","b"],body:"a=a"+op+"b"},rvalue:true,count:2,funcName:id+"eq"});exports[id+"seq"]=makeOp({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+op+"s"},rvalue:true,count:2,funcName:id+"seq"})}})();var math_unary=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];(function(){for(var i=0;i<math_unary.length;++i){var f=math_unary[i];exports[f]=makeOp({args:["array","array"],pre:{args:[],body:"this_f=Math."+f,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b)",thisVars:["this_f"]},funcName:f});exports[f+"eq"]=makeOp({args:["array"],pre:{args:[],body:"this_f=Math."+f,thisVars:["this_f"]},body:{args:["a"],body:"a=this_f(a)",thisVars:["this_f"]},rvalue:true,count:2,funcName:f+"eq"})}})();var math_comm=["max","min","atan2","pow"];(function(){for(var i=0;i<math_comm.length;++i){var f=math_comm[i];exports[f]=makeOp({args:["array","array","array"],pre:{args:[],body:"this_f=Math."+f,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(b,c)",thisVars:["this_f"]},funcName:f});exports[f+"s"]=makeOp({args:["array","array","scalar"],pre:{args:[],body:"this_f=Math."+f,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(b,c)",thisVars:["this_f"]},funcName:f+"s"});exports[f+"eq"]=makeOp({args:["array","array"],pre:{args:[],body:"this_f=Math."+f,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(a,b)",thisVars:["this_f"]},rvalue:true,count:2,funcName:f+"eq"});exports[f+"seq"]=makeOp({args:["array","scalar"],pre:{args:[],body:"this_f=Math."+f,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(a,b)",thisVars:["this_f"]},rvalue:true,count:2,funcName:f+"seq"})}})();var math_noncomm=["atan2","pow"];(function(){for(var i=0;i<math_noncomm.length;++i){var f=math_noncomm[i];exports[f+"op"]=makeOp({args:["array","array","array"],pre:{args:[],body:"this_f=Math."+f,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(c,b)",thisVars:["this_f"]},funcName:f+"op"});exports[f+"ops"]=makeOp({args:["array","array","scalar"],pre:{args:[],body:"this_f=Math."+f,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(c,b)",thisVars:["this_f"]},funcName:f+"ops"});exports[f+"opeq"]=makeOp({args:["array","array"],pre:{args:[],body:"this_f=Math."+f,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b,a)",thisVars:["this_f"]},rvalue:true,count:2,funcName:f+"opeq"});exports[f+"opseq"]=makeOp({args:["array","scalar"],pre:{args:[],body:"this_f=Math."+f,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b,a)",thisVars:["this_f"]},rvalue:true,count:2,funcName:f+"opseq"})}})();exports.any=compile({args:["array"],pre:EmptyProc,body:{args:[{name:"a",lvalue:false,rvalue:true,count:1}],body:"if(a){return true}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return false"},funcName:"any"});exports.all=compile({args:["array"],pre:EmptyProc,body:{args:[{name:"x",lvalue:false,rvalue:true,count:1}],body:"if(!x){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"all"});exports.sum=compile({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:false,rvalue:true,count:1}],body:"this_s+=a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"sum"});exports.prod=compile({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=1"},body:{args:[{name:"a",lvalue:false,rvalue:true,count:1}],body:"this_s*=a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"prod"});exports.norm2squared=compile({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:false,rvalue:true,count:2}],body:"this_s+=a*a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm2squared"});exports.norm2=compile({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:false,rvalue:true,count:2}],body:"this_s+=a*a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return Math.sqrt(this_s)"},funcName:"norm2"});exports.norminf=compile({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:false,rvalue:true,count:4}],body:"if(-a>this_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"});exports.norm1=compile({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:false,rvalue:true,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"});exports.sup=compile({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:false,rvalue:true,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}});exports.inf=compile({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_<this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:false,rvalue:true,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}});exports.argmin=compile({args:["index","array","shape"],pre:{body:"{this_v=Infinity;this_i=_inline_0_arg2_.slice(0)}",args:[{name:"_inline_0_arg0_",lvalue:false,rvalue:false,count:0},{name:"_inline_0_arg1_",lvalue:false,rvalue:false,count:0},{name:"_inline_0_arg2_",lvalue:false,rvalue:true,count:1}],thisVars:["this_i","this_v"],localVars:[]},body:{body:"{if(_inline_1_arg1_<this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:false,rvalue:true,count:2},{name:"_inline_1_arg1_",lvalue:false,rvalue:true,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}});exports.argmax=compile({args:["index","array","shape"],pre:{body:"{this_v=-Infinity;this_i=_inline_0_arg2_.slice(0)}",args:[{name:"_inline_0_arg0_",lvalue:false,rvalue:false,count:0},{name:"_inline_0_arg1_",lvalue:false,rvalue:false,count:0},{name:"_inline_0_arg2_",lvalue:false,rvalue:true,count:1}],thisVars:["this_i","this_v"],localVars:[]},body:{body:"{if(_inline_1_arg1_>this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:false,rvalue:true,count:2},{name:"_inline_1_arg1_",lvalue:false,rvalue:true,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}});exports.random=makeOp({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"});exports.assign=makeOp({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"});exports.assigns=makeOp({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"});exports.equals=compile({args:["array","array"],pre:EmptyProc,body:{args:[{name:"x",lvalue:false,rvalue:true,count:1},{name:"y",lvalue:false,rvalue:true,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":9}],9:[function(require,module,exports){"use strict";var createThunk=require("./lib/thunk.js");function Procedure(){this.argTypes=[];this.shimArgs=[];this.arrayArgs=[];this.scalarArgs=[];this.offsetArgs=[];this.offsetArgIndex=[];this.indexArgs=[];this.shapeArgs=[];this.funcName="";this.pre=null;this.body=null;this.post=null;this.debug=false}function compileCwise(user_args){var proc=new Procedure;proc.pre=user_args.pre;proc.body=user_args.body;proc.post=user_args.post;var proc_args=user_args.args.slice(0);proc.argTypes=proc_args;for(var i=0;i<proc_args.length;++i){var arg_type=proc_args[i];if(arg_type==="array"){proc.arrayArgs.push(i);proc.shimArgs.push("array"+i);if(i<proc.pre.args.length&&proc.pre.args[i].count>0){throw new Error("cwise: pre() block may not reference array args")}if(i<proc.post.args.length&&proc.post.args[i].count>0){throw new Error("cwise: post() block may not reference array args")}}else if(arg_type==="scalar"){proc.scalarArgs.push(i);proc.shimArgs.push("scalar"+i)}else if(arg_type==="index"){proc.indexArgs.push(i);if(i<proc.pre.args.length&&proc.pre.args[i].count>0){throw new Error("cwise: pre() block may not reference array index")}if(i<proc.body.args.length&&proc.body.args[i].lvalue){throw new Error("cwise: body() block may not write to array index")}if(i<proc.post.args.length&&proc.post.args[i].count>0){throw new Error("cwise: post() block may not reference array index")}}else if(arg_type==="shape"){proc.shapeArgs.push(i);if(i<proc.pre.args.length&&proc.pre.args[i].lvalue){throw new Error("cwise: pre() block may not write to array shape")}if(i<proc.body.args.length&&proc.body.args[i].lvalue){throw new Error("cwise: body() block may not write to array shape")}if(i<proc.post.args.length&&proc.post.args[i].lvalue){throw new Error("cwise: post() block may not write to array shape")}}else if(typeof arg_type==="object"&&arg_type.offset){proc.argTypes[i]="offset";proc.offsetArgs.push({array:arg_type.array,offset:arg_type.offset});proc.offsetArgIndex.push(i)}else{throw new Error("cwise: Unknown argument type "+proc_args[i])}}if(proc.arrayArgs.length<=0){throw new Error("cwise: No array arguments specified")}if(proc.pre.args.length>proc_args.length){throw new Error("cwise: Too many arguments in pre() block")}if(proc.body.args.length>proc_args.length){throw new Error("cwise: Too many arguments in body() block")}if(proc.post.args.length>proc_args.length){throw new Error("cwise: Too many arguments in post() block")}proc.debug=!!user_args.printCode||!!user_args.debug;proc.funcName=user_args.funcName||"cwise";proc.blockSize=user_args.blockSize||64;return createThunk(proc)}module.exports=compileCwise},{"./lib/thunk.js":11}],10:[function(require,module,exports){"use strict";var uniq=require("uniq");function innerFill(order,proc,body){var dimension=order.length,nargs=proc.arrayArgs.length,has_index=proc.indexArgs.length>0,code=[],vars=[],idx=0,pidx=0,i,j;for(i=0;i<dimension;++i){vars.push(["i",i,"=0"].join(""))}for(j=0;j<nargs;++j){for(i=0;i<dimension;++i){pidx=idx;idx=order[i];if(i===0){vars.push(["d",j,"s",i,"=t",j,"p",idx].join(""))}else{vars.push(["d",j,"s",i,"=(t",j,"p",idx,"-s",pidx,"*t",j,"p",pidx,")"].join(""))}}}code.push("var "+vars.join(","));for(i=dimension-1;i>=0;--i){idx=order[i];code.push(["for(i",i,"=0;i",i,"<s",idx,";++i",i,"){"].join(""))}code.push(body);for(i=0;i<dimension;++i){pidx=idx;idx=order[i];for(j=0;j<nargs;++j){code.push(["p",j,"+=d",j,"s",i].join(""))}if(has_index){if(i>0){code.push(["index[",pidx,"]-=s",pidx].join(""))}code.push(["++index[",idx,"]"].join(""))}code.push("}")}return code.join("\n")}function outerFill(matched,order,proc,body){var dimension=order.length,nargs=proc.arrayArgs.length,blockSize=proc.blockSize,has_index=proc.indexArgs.length>0,code=[];for(var i=0;i<nargs;++i){code.push(["var offset",i,"=p",i].join(""))}for(var i=matched;i<dimension;++i){code.push(["for(var j"+i+"=SS[",order[i],"]|0;j",i,">0;){"].join(""));code.push(["if(j",i,"<",blockSize,"){"].join(""));code.push(["s",order[i],"=j",i].join(""));code.push(["j",i,"=0"].join(""));code.push(["}else{s",order[i],"=",blockSize].join(""));code.push(["j",i,"-=",blockSize,"}"].join(""));if(has_index){code.push(["index[",order[i],"]=j",i].join(""))}}for(var i=0;i<nargs;++i){var indexStr=["offset"+i];for(var j=matched;j<dimension;++j){indexStr.push(["j",j,"*t",i,"p",order[j]].join(""))}code.push(["p",i,"=(",indexStr.join("+"),")"].join(""))}code.push(innerFill(order,proc,body));for(var i=matched;i<dimension;++i){code.push("}")}return code.join("\n")}function countMatches(orders){var matched=0,dimension=orders[0].length;while(matched<dimension){for(var j=1;j<orders.length;++j){if(orders[j][matched]!==orders[0][matched]){return matched}}++matched}return matched}function processBlock(block,proc,dtypes){var code=block.body;var pre=[];var post=[];for(var i=0;i<block.args.length;++i){var carg=block.args[i];if(carg.count<=0){continue}var re=new RegExp(carg.name,"g");var ptrStr="";var arrNum=proc.arrayArgs.indexOf(i);switch(proc.argTypes[i]){case"offset":var offArgIndex=proc.offsetArgIndex.indexOf(i);var offArg=proc.offsetArgs[offArgIndex];arrNum=offArg.array;ptrStr="+q"+offArgIndex;case"array":ptrStr="p"+arrNum+ptrStr;var localStr="l"+i;var arrStr="a"+arrNum;if(carg.count===1){if(dtypes[arrNum]==="generic"){if(carg.lvalue){pre.push(["var ",localStr,"=",arrStr,".get(",ptrStr,")"].join(""));code=code.replace(re,localStr);post.push([arrStr,".set(",ptrStr,",",localStr,")"].join(""))}else{code=code.replace(re,[arrStr,".get(",ptrStr,")"].join(""))}}else{code=code.replace(re,[arrStr,"[",ptrStr,"]"].join(""))}}else if(dtypes[arrNum]==="generic"){pre.push(["var ",localStr,"=",arrStr,".get(",ptrStr,")"].join(""));code=code.replace(re,localStr);if(carg.lvalue){post.push([arrStr,".set(",ptrStr,",",localStr,")"].join(""))}}else{pre.push(["var ",localStr,"=",arrStr,"[",ptrStr,"]"].join(""));code=code.replace(re,localStr);if(carg.lvalue){post.push([arrStr,"[",ptrStr,"]=",localStr].join(""))}}break;case"scalar":code=code.replace(re,"Y"+proc.scalarArgs.indexOf(i));break;case"index":code=code.replace(re,"index");break;case"shape":code=code.replace(re,"shape");break}}return[pre.join("\n"),code,post.join("\n")].join("\n").trim()}function typeSummary(dtypes){var summary=new Array(dtypes.length);var allEqual=true;for(var i=0;i<dtypes.length;++i){var t=dtypes[i];var digits=t.match(/\d+/);if(!digits){digits=""}else{digits=digits[0]}if(t.charAt(0)===0){summary[i]="u"+t.charAt(1)+digits}else{summary[i]=t.charAt(0)+digits}if(i>0){allEqual=allEqual&&summary[i]===summary[i-1]}}if(allEqual){return summary[0]}return summary.join("")}function generateCWiseOp(proc,typesig){var dimension=typesig[1].length|0;var orders=new Array(proc.arrayArgs.length);var dtypes=new Array(proc.arrayArgs.length);var arglist=["SS"];var code=["'use strict'"];var vars=[];for(var j=0;j<dimension;++j){vars.push(["s",j,"=SS[",j,"]"].join(""))}for(var i=0;i<proc.arrayArgs.length;++i){arglist.push("a"+i);arglist.push("t"+i);arglist.push("p"+i);dtypes[i]=typesig[2*i];orders[i]=typesig[2*i+1];for(var j=0;j<dimension;++j){vars.push(["t",i,"p",j,"=t",i,"[",j,"]"].join(""))}}for(var i=0;i<proc.scalarArgs.length;++i){arglist.push("Y"+i)}if(proc.shapeArgs.length>0){vars.push("shape=SS.slice(0)")}if(proc.indexArgs.length>0){var zeros=new Array(dimension);for(var i=0;i<dimension;++i){zeros[i]="0"}vars.push(["index=[",zeros.join(","),"]"].join(""))}for(var i=0;i<proc.offsetArgs.length;++i){var off_arg=proc.offsetArgs[i];var init_string=[];for(var j=0;j<off_arg.offset.length;++j){if(off_arg.offset[j]===0){continue}else if(off_arg.offset[j]===1){init_string.push(["t",off_arg.array,"p",j].join(""))}else{init_string.push([off_arg.offset[j],"*t",off_arg.array,"p",j].join(""))}}if(init_string.length===0){vars.push("q"+i+"=0")}else{vars.push(["q",i,"=",init_string.join("+")].join(""))}}var thisVars=uniq([].concat(proc.pre.thisVars).concat(proc.body.thisVars).concat(proc.post.thisVars));vars=vars.concat(thisVars);code.push("var "+vars.join(","));for(var i=0;i<proc.arrayArgs.length;++i){code.push("p"+i+"|=0")}if(proc.pre.body.length>3){code.push(processBlock(proc.pre,proc,dtypes))}var body=processBlock(proc.body,proc,dtypes);var matched=countMatches(orders);if(matched<dimension){code.push(outerFill(matched,orders[0],proc,body))}else{code.push(innerFill(orders[0],proc,body))}if(proc.post.body.length>3){code.push(processBlock(proc.post,proc,dtypes))}if(proc.debug){console.log("Generated cwise routine for ",typesig,":\n\n",code.join("\n"))}var loopName=[proc.funcName||"unnamed","_cwise_loop_",orders[0].join("s"),"m",matched,typeSummary(dtypes)].join("");var f=new Function(["function ",loopName,"(",arglist.join(","),"){",code.join("\n"),"} return ",loopName].join(""));return f()}module.exports=generateCWiseOp},{uniq:12}],11:[function(require,module,exports){"use strict";var compile=require("./compile.js");function createThunk(proc){var code=["'use strict'","var CACHED={}"];var vars=[];var thunkName=proc.funcName+"_cwise_thunk";code.push(["return function ",thunkName,"(",proc.shimArgs.join(","),"){"].join(""));var typesig=[];var string_typesig=[];var proc_args=[["array",proc.arrayArgs[0],".shape"].join("")];for(var i=0;i<proc.arrayArgs.length;++i){var j=proc.arrayArgs[i];vars.push(["t",j,"=array",j,".dtype,","r",j,"=array",j,".order"].join(""));typesig.push("t"+j);typesig.push("r"+j);string_typesig.push("t"+j);string_typesig.push("r"+j+".join()");proc_args.push("array"+j+".data");proc_args.push("array"+j+".stride");proc_args.push("array"+j+".offset|0")}for(var i=0;i<proc.scalarArgs.length;++i){proc_args.push("scalar"+proc.scalarArgs[i])}vars.push(["type=[",string_typesig.join(","),"].join()"].join(""));vars.push("proc=CACHED[type]");code.push("var "+vars.join(","));code.push(["if(!proc){","CACHED[type]=proc=compile([",typesig.join(","),"])}","return proc(",proc_args.join(","),")}"].join(""));if(proc.debug){console.log("Generated thunk:",code.join("\n"))}var thunk=new Function("compile",code.join("\n"));return thunk(compile.bind(undefined,proc))}module.exports=createThunk},{"./compile.js":10}],12:[function(require,module,exports){"use strict";function unique_pred(list,compare){var ptr=1,len=list.length,a=list[0],b=list[0];for(var i=1;i<len;++i){b=a;a=list[i];if(compare(a,b)){if(i===ptr){ptr++;continue}list[ptr++]=a}}list.length=ptr;return list}function unique_eq(list){var ptr=1,len=list.length,a=list[0],b=list[0];for(var i=1;i<len;++i,b=a){b=a;a=list[i];if(a!==b){if(i===ptr){ptr++;continue}list[ptr++]=a}}list.length=ptr;return list}function unique(list,compare,sorted){if(list.length===0){return list}if(compare){if(!sorted){list.sort(compare)}return unique_pred(list,compare)}if(!sorted){list.sort()}return unique_eq(list)}module.exports=unique},{}],13:[function(require,module,exports){(function(Buffer){var iota=require("iota-array");var hasTypedArrays=typeof Float64Array!=="undefined";var hasBuffer=typeof Buffer!=="undefined";function compare1st(a,b){return a[0]-b[0]}function order(){var stride=this.stride;var terms=new Array(stride.length);var i;for(i=0;i<terms.length;++i){terms[i]=[Math.abs(stride[i]),i]}terms.sort(compare1st);var result=new Array(terms.length);for(i=0;i<result.length;++i){result[i]=terms[i][1]}return result}function compileConstructor(dtype,dimension){var className=["View",dimension,"d",dtype].join("");if(dimension<0){className="View_Nil"+dtype}var useGetters=dtype==="generic";if(dimension===-1){var code="function "+className+"(a){this.data=a;};var proto="+className+".prototype;proto.dtype='"+dtype+"';proto.index=function(){return -1};proto.size=0;proto.dimension=-1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function(){return new "+className+"(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_"+className+"(a){return new "+className+"(a);}";var procedure=new Function(code);return procedure()}else if(dimension===0){var code="function "+className+"(a,d) {this.data = a;this.offset = d};var proto="+className+".prototype;proto.dtype='"+dtype+"';proto.index=function(){return this.offset};proto.dimension=0;proto.size=1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function "+className+"_copy() {return new "+className+"(this.data,this.offset)};proto.pick=function "+className+"_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function "+className+"_get(){return "+(useGetters?"this.data.get(this.offset)":"this.data[this.offset]")+"};proto.set=function "+className+"_set(v){return "+(useGetters?"this.data.set(this.offset,v)":"this.data[this.offset]=v")+"};return function construct_"+className+"(a,b,c,d){return new "+className+"(a,d)}";var procedure=new Function("TrivialArray",code);return procedure(CACHED_CONSTRUCTORS[dtype][0])}var code=["'use strict'"];var indices=iota(dimension);var args=indices.map(function(i){return"i"+i});var index_str="this.offset+"+indices.map(function(i){return"this.stride["+i+"]*i"+i}).join("+");var shapeArg=indices.map(function(i){return"b"+i}).join(",");var strideArg=indices.map(function(i){return"c"+i}).join(",");code.push("function "+className+"(a,"+shapeArg+","+strideArg+",d){this.data=a","this.shape=["+shapeArg+"]","this.stride=["+strideArg+"]","this.offset=d|0}","var proto="+className+".prototype","proto.dtype='"+dtype+"'","proto.dimension="+dimension);code.push("Object.defineProperty(proto,'size',{get:function "+className+"_size(){return "+indices.map(function(i){return"this.shape["+i+"]"}).join("*"),"}})");if(dimension===1){code.push("proto.order=[0]")}else{code.push("Object.defineProperty(proto,'order',{get:");if(dimension<4){code.push("function "+className+"_order(){");if(dimension===2){code.push("return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})")}else if(dimension===3){code.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")}}else{code.push("ORDER})")}}code.push("proto.set=function "+className+"_set("+args.join(",")+",v){");if(useGetters){code.push("return this.data.set("+index_str+",v)}")}else{code.push("return this.data["+index_str+"]=v}")}code.push("proto.get=function "+className+"_get("+args.join(",")+"){");if(useGetters){code.push("return this.data.get("+index_str+")}")}else{code.push("return this.data["+index_str+"]}")}code.push("proto.index=function "+className+"_index(",args.join(),"){return "+index_str+"}");code.push("proto.hi=function "+className+"_hi("+args.join(",")+"){return new "+className+"(this.data,"+indices.map(function(i){return["(typeof i",i,"!=='number'||i",i,"<0)?this.shape[",i,"]:i",i,"|0"].join("")}).join(",")+","+indices.map(function(i){return"this.stride["+i+"]"}).join(",")+",this.offset)}");var a_vars=indices.map(function(i){return"a"+i+"=this.shape["+i+"]"});var c_vars=indices.map(function(i){return"c"+i+"=this.stride["+i+"]"});code.push("proto.lo=function "+className+"_lo("+args.join(",")+"){var b=this.offset,d=0,"+a_vars.join(",")+","+c_vars.join(","));for(var i=0;i<dimension;++i){code.push("if(typeof i"+i+"==='number'&&i"+i+">=0){d=i"+i+"|0;b+=c"+i+"*d;a"+i+"-=d}")}code.push("return new "+className+"(this.data,"+indices.map(function(i){return"a"+i}).join(",")+","+indices.map(function(i){return"c"+i}).join(",")+",b)}");code.push("proto.step=function "+className+"_step("+args.join(",")+"){var "+indices.map(function(i){return"a"+i+"=this.shape["+i+"]"}).join(",")+","+indices.map(function(i){return"b"+i+"=this.stride["+i+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var i=0;i<dimension;++i){code.push("if(typeof i"+i+"==='number'){d=i"+i+"|0;if(d<0){c+=b"+i+"*(a"+i+"-1);a"+i+"=ceil(-a"+i+"/d)}else{a"+i+"=ceil(a"+i+"/d)}b"+i+"*=d}")}code.push("return new "+className+"(this.data,"+indices.map(function(i){return"a"+i}).join(",")+","+indices.map(function(i){return"b"+i}).join(",")+",c)}");var tShape=new Array(dimension);var tStride=new Array(dimension);for(var i=0;i<dimension;++i){tShape[i]="a[i"+i+"]";tStride[i]="b[i"+i+"]"}code.push("proto.transpose=function "+className+"_transpose("+args+"){"+args.map(function(n,idx){return n+"=("+n+"===undefined?"+idx+":"+n+"|0)"}).join(";"),"var a=this.shape,b=this.stride;return new "+className+"(this.data,"+tShape.join(",")+","+tStride.join(",")+",this.offset)}");code.push("proto.pick=function "+className+"_pick("+args+"){var a=[],b=[],c=this.offset");for(var i=0;i<dimension;++i){code.push("if(typeof i"+i+"==='number'&&i"+i+">=0){c=(c+this.stride["+i+"]*i"+i+")|0}else{a.push(this.shape["+i+"]);b.push(this.stride["+i+"])}")}code.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}");code.push("return function construct_"+className+"(data,shape,stride,offset){return new "+className+"(data,"+indices.map(function(i){return"shape["+i+"]"}).join(",")+","+indices.map(function(i){return"stride["+i+"]"}).join(",")+",offset)}");var procedure=new Function("CTOR_LIST","ORDER",code.join("\n"));return procedure(CACHED_CONSTRUCTORS[dtype],order)}function arrayDType(data){if(hasBuffer){if(Buffer.isBuffer(data)){return"buffer"}}if(hasTypedArrays){switch(Object.prototype.toString.call(data)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped"}}if(Array.isArray(data)){return"array"}return"generic"}var CACHED_CONSTRUCTORS={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],buffer:[],generic:[]};(function(){for(var id in CACHED_CONSTRUCTORS){CACHED_CONSTRUCTORS[id].push(compileConstructor(id,-1))}});function wrappedNDArrayCtor(data,shape,stride,offset){if(data===undefined){var ctor=CACHED_CONSTRUCTORS.array[0];return ctor([])}else if(typeof data==="number"){data=[data]}if(shape===undefined){shape=[data.length]}var d=shape.length;if(stride===undefined){stride=new Array(d);for(var i=d-1,sz=1;i>=0;--i){stride[i]=sz;sz*=shape[i]}}if(offset===undefined){offset=0;for(var i=0;i<d;++i){if(stride[i]<0){offset-=(shape[i]-1)*stride[i]}}}var dtype=arrayDType(data);var ctor_list=CACHED_CONSTRUCTORS[dtype];while(ctor_list.length<=d+1){ctor_list.push(compileConstructor(dtype,ctor_list.length-1))}var ctor=ctor_list[d+1];return ctor(data,shape,stride,offset)}module.exports=wrappedNDArrayCtor | |
}).call(this,require("buffer").Buffer)},{buffer:1,"iota-array":14}],14:[function(require,module,exports){"use strict";function iota(n){var result=new Array(n);for(var i=0;i<n;++i){result[i]=i}return result}module.exports=iota},{}],15:[function(require,module,exports){"use strict";"use restrict";var INT_BITS=32;exports.INT_BITS=INT_BITS;exports.INT_MAX=2147483647;exports.INT_MIN=-1<<INT_BITS-1;exports.sign=function(v){return(v>0)-(v<0)};exports.abs=function(v){var mask=v>>INT_BITS-1;return(v^mask)-mask};exports.min=function(x,y){return y^(x^y)&-(x<y)};exports.max=function(x,y){return x^(x^y)&-(x<y)};exports.isPow2=function(v){return!(v&v-1)&&!!v};exports.log2=function(v){var r,shift;r=(v>65535)<<4;v>>>=r;shift=(v>255)<<3;v>>>=shift;r|=shift;shift=(v>15)<<2;v>>>=shift;r|=shift;shift=(v>3)<<1;v>>>=shift;r|=shift;return r|v>>1};exports.log10=function(v){return v>=1e9?9:v>=1e8?8:v>=1e7?7:v>=1e6?6:v>=1e5?5:v>=1e4?4:v>=1e3?3:v>=100?2:v>=10?1:0};exports.popCount=function(v){v=v-(v>>>1&1431655765);v=(v&858993459)+(v>>>2&858993459);return(v+(v>>>4)&252645135)*16843009>>>24};function countTrailingZeros(v){var c=32;v&=-v;if(v)c--;if(v&65535)c-=16;if(v&16711935)c-=8;if(v&252645135)c-=4;if(v&858993459)c-=2;if(v&1431655765)c-=1;return c}exports.countTrailingZeros=countTrailingZeros;exports.nextPow2=function(v){v+=v===0;--v;v|=v>>>1;v|=v>>>2;v|=v>>>4;v|=v>>>8;v|=v>>>16;return v+1};exports.prevPow2=function(v){v|=v>>>1;v|=v>>>2;v|=v>>>4;v|=v>>>8;v|=v>>>16;return v-(v>>>1)};exports.parity=function(v){v^=v>>>16;v^=v>>>8;v^=v>>>4;v&=15;return 27030>>>v&1};var REVERSE_TABLE=new Array(256);(function(tab){for(var i=0;i<256;++i){var v=i,r=i,s=7;for(v>>>=1;v;v>>>=1){r<<=1;r|=v&1;--s}tab[i]=r<<s&255}})(REVERSE_TABLE);exports.reverse=function(v){return REVERSE_TABLE[v&255]<<24|REVERSE_TABLE[v>>>8&255]<<16|REVERSE_TABLE[v>>>16&255]<<8|REVERSE_TABLE[v>>>24&255]};exports.interleave2=function(x,y){x&=65535;x=(x|x<<8)&16711935;x=(x|x<<4)&252645135;x=(x|x<<2)&858993459;x=(x|x<<1)&1431655765;y&=65535;y=(y|y<<8)&16711935;y=(y|y<<4)&252645135;y=(y|y<<2)&858993459;y=(y|y<<1)&1431655765;return x|y<<1};exports.deinterleave2=function(v,n){v=v>>>n&1431655765;v=(v|v>>>1)&858993459;v=(v|v>>>2)&252645135;v=(v|v>>>4)&16711935;v=(v|v>>>16)&65535;return v<<16>>16};exports.interleave3=function(x,y,z){x&=1023;x=(x|x<<16)&4278190335;x=(x|x<<8)&251719695;x=(x|x<<4)&3272356035;x=(x|x<<2)&1227133513;y&=1023;y=(y|y<<16)&4278190335;y=(y|y<<8)&251719695;y=(y|y<<4)&3272356035;y=(y|y<<2)&1227133513;x|=y<<1;z&=1023;z=(z|z<<16)&4278190335;z=(z|z<<8)&251719695;z=(z|z<<4)&3272356035;z=(z|z<<2)&1227133513;return x|z<<2};exports.deinterleave3=function(v,n){v=v>>>n&1227133513;v=(v|v>>>2)&3272356035;v=(v|v>>>4)&251719695;v=(v|v>>>8)&4278190335;v=(v|v>>>16)&1023;return v<<22>>22};exports.nextCombination=function(v){var t=v|v-1;return t+1|(~t&-~t)-1>>>countTrailingZeros(v)+1}},{}],16:[function(require,module,exports){"use strict";function dupe_array(count,value,i){var c=count[i]|0;if(c<=0){return[]}var result=new Array(c),j;if(i===count.length-1){for(j=0;j<c;++j){result[j]=value}}else{for(j=0;j<c;++j){result[j]=dupe_array(count,value,i+1)}}return result}function dupe_number(count,value){var result,i;result=new Array(count);for(i=0;i<count;++i){result[i]=value}return result}function dupe(count,value){if(typeof value==="undefined"){value=0}switch(typeof count){case"number":if(count>0){return dupe_number(count|0,value)}break;case"object":if(typeof count.length==="number"){return dupe_array(count,value,0)}break}return[]}module.exports=dupe},{}],17:[function(require,module,exports){(function(global,Buffer){"use strict";var bits=require("bit-twiddle");var dup=require("dup");if(!global.__TYPEDARRAY_POOL){global.__TYPEDARRAY_POOL={UINT8:dup([32,0]),UINT16:dup([32,0]),UINT32:dup([32,0]),INT8:dup([32,0]),INT16:dup([32,0]),INT32:dup([32,0]),FLOAT:dup([32,0]),DOUBLE:dup([32,0]),DATA:dup([32,0]),UINT8C:dup([32,0]),BUFFER:dup([32,0])}}var hasUint8C=typeof Uint8ClampedArray!=="undefined";var POOL=global.__TYPEDARRAY_POOL;if(!POOL.UINT8C){POOL.UINT8C=dup([32,0])}if(!POOL.BUFFER){POOL.BUFFER=dup([32,0])}var DATA=POOL.DATA,BUFFER=POOL.BUFFER;exports.free=function free(array){if(Buffer.isBuffer(array)){BUFFER[bits.log2(array.length)].push(array)}else{if(Object.prototype.toString.call(array)!=="[object ArrayBuffer]"){array=array.buffer}if(!array){return}var n=array.length||array.byteLength;var log_n=bits.log2(n)|0;DATA[log_n].push(array)}};function freeArrayBuffer(buffer){if(!buffer){return}var n=buffer.length||buffer.byteLength;var log_n=bits.log2(n);DATA[log_n].push(buffer)}function freeTypedArray(array){freeArrayBuffer(array.buffer)}exports.freeUint8=exports.freeUint16=exports.freeUint32=exports.freeInt8=exports.freeInt16=exports.freeInt32=exports.freeFloat32=exports.freeFloat=exports.freeFloat64=exports.freeDouble=exports.freeUint8Clamped=exports.freeDataView=freeTypedArray;exports.freeArrayBuffer=freeArrayBuffer;exports.freeBuffer=function freeBuffer(array){BUFFER[bits.log2(array.length)].push(array)};exports.malloc=function malloc(n,dtype){if(dtype===undefined||dtype==="arraybuffer"){return mallocArrayBuffer(n)}else{switch(dtype){case"uint8":return mallocUint8(n);case"uint16":return mallocUint16(n);case"uint32":return mallocUint32(n);case"int8":return mallocInt8(n);case"int16":return mallocInt16(n);case"int32":return mallocInt32(n);case"float":case"float32":return mallocFloat(n);case"double":case"float64":return mallocDouble(n);case"uint8_clamped":return mallocUint8Clamped(n);case"buffer":return mallocBuffer(n);case"data":case"dataview":return mallocDataView(n);default:return null}}return null};function mallocArrayBuffer(n){var n=bits.nextPow2(n);var log_n=bits.log2(n);var d=DATA[log_n];if(d.length>0){return d.pop()}return new ArrayBuffer(n)}exports.mallocArrayBuffer=mallocArrayBuffer;function mallocUint8(n){return new Uint8Array(mallocArrayBuffer(n),0,n)}exports.mallocUint8=mallocUint8;function mallocUint16(n){return new Uint16Array(mallocArrayBuffer(2*n),0,n)}exports.mallocUint16=mallocUint16;function mallocUint32(n){return new Uint32Array(mallocArrayBuffer(4*n),0,n)}exports.mallocUint32=mallocUint32;function mallocInt8(n){return new Int8Array(mallocArrayBuffer(n),0,n)}exports.mallocInt8=mallocInt8;function mallocInt16(n){return new Int16Array(mallocArrayBuffer(2*n),0,n)}exports.mallocInt16=mallocInt16;function mallocInt32(n){return new Int32Array(mallocArrayBuffer(4*n),0,n)}exports.mallocInt32=mallocInt32;function mallocFloat(n){return new Float32Array(mallocArrayBuffer(4*n),0,n)}exports.mallocFloat32=exports.mallocFloat=mallocFloat;function mallocDouble(n){return new Float64Array(mallocArrayBuffer(8*n),0,n)}exports.mallocFloat64=exports.mallocDouble=mallocDouble;function mallocUint8Clamped(n){if(hasUint8C){return new Uint8ClampedArray(mallocArrayBuffer(n),0,n)}else{return mallocUint8(n)}}exports.mallocUint8Clamped=mallocUint8Clamped;function mallocDataView(n){return new DataView(mallocArrayBuffer(n),0,n)}exports.mallocDataView=mallocDataView;function mallocBuffer(n){n=bits.nextPow2(n);var log_n=bits.log2(n);var cache=BUFFER[log_n];if(cache.length>0){return cache.pop()}return new Buffer(n)}exports.mallocBuffer=mallocBuffer;exports.clearCache=function clearCache(){for(var i=0;i<32;++i){POOL.UINT8[i].length=0;POOL.UINT16[i].length=0;POOL.UINT32[i].length=0;POOL.INT8[i].length=0;POOL.INT16[i].length=0;POOL.INT32[i].length=0;POOL.FLOAT[i].length=0;POOL.DOUBLE[i].length=0;POOL.UINT8C[i].length=0;DATA[i].length=0;BUFFER[i].length=0}}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},require("buffer").Buffer)},{"bit-twiddle":15,buffer:1,dup:16}],18:[function(require,module,exports){(function WeakMapModule(){"use strict";if(typeof ses!=="undefined"&&ses.ok&&!ses.ok()){return}function weakMapPermitHostObjects(map){if(map.permitHostObjects___){map.permitHostObjects___(weakMapPermitHostObjects)}}if(typeof ses!=="undefined"){ses.weakMapPermitHostObjects=weakMapPermitHostObjects}var doubleWeakMapCheckSilentFailure=false;if(typeof WeakMap==="function"){var HostWeakMap=WeakMap;if(typeof navigator!=="undefined"&&/Firefox/.test(navigator.userAgent)){}else{var testMap=new HostWeakMap;var testObject=Object.freeze({});testMap.set(testObject,1);if(testMap.get(testObject)!==1){doubleWeakMapCheckSilentFailure=true}else{module.exports=WeakMap;return}}}var hop=Object.prototype.hasOwnProperty;var gopn=Object.getOwnPropertyNames;var defProp=Object.defineProperty;var isExtensible=Object.isExtensible;var HIDDEN_NAME_PREFIX="weakmap:";var HIDDEN_NAME=HIDDEN_NAME_PREFIX+"ident:"+Math.random()+"___";if(typeof crypto!=="undefined"&&typeof crypto.getRandomValues==="function"&&typeof ArrayBuffer==="function"&&typeof Uint8Array==="function"){var ab=new ArrayBuffer(25);var u8s=new Uint8Array(ab);crypto.getRandomValues(u8s);HIDDEN_NAME=HIDDEN_NAME_PREFIX+"rand:"+Array.prototype.map.call(u8s,function(u8){return(u8%36).toString(36)}).join("")+"___"}function isNotHiddenName(name){return!(name.substr(0,HIDDEN_NAME_PREFIX.length)==HIDDEN_NAME_PREFIX&&name.substr(name.length-3)==="___")}defProp(Object,"getOwnPropertyNames",{value:function fakeGetOwnPropertyNames(obj){return gopn(obj).filter(isNotHiddenName)}});if("getPropertyNames"in Object){var originalGetPropertyNames=Object.getPropertyNames;defProp(Object,"getPropertyNames",{value:function fakeGetPropertyNames(obj){return originalGetPropertyNames(obj).filter(isNotHiddenName)}})}function getHiddenRecord(key){if(key!==Object(key)){throw new TypeError("Not an object: "+key)}var hiddenRecord=key[HIDDEN_NAME];if(hiddenRecord&&hiddenRecord.key===key){return hiddenRecord}if(!isExtensible(key)){return void 0}hiddenRecord={key:key};try{defProp(key,HIDDEN_NAME,{value:hiddenRecord,writable:false,enumerable:false,configurable:false});return hiddenRecord}catch(error){return void 0}}(function(){var oldFreeze=Object.freeze;defProp(Object,"freeze",{value:function identifyingFreeze(obj){getHiddenRecord(obj);return oldFreeze(obj)}});var oldSeal=Object.seal;defProp(Object,"seal",{value:function identifyingSeal(obj){getHiddenRecord(obj);return oldSeal(obj)}});var oldPreventExtensions=Object.preventExtensions;defProp(Object,"preventExtensions",{value:function identifyingPreventExtensions(obj){getHiddenRecord(obj);return oldPreventExtensions(obj)}})})();function constFunc(func){func.prototype=null;return Object.freeze(func)}var calledAsFunctionWarningDone=false;function calledAsFunctionWarning(){if(!calledAsFunctionWarningDone&&typeof console!=="undefined"){calledAsFunctionWarningDone=true;console.warn("WeakMap should be invoked as new WeakMap(), not "+"WeakMap(). This will be an error in the future.")}}var nextId=0;var OurWeakMap=function(){if(!(this instanceof OurWeakMap)){calledAsFunctionWarning()}var keys=[];var values=[];var id=nextId++;function get___(key,opt_default){var index;var hiddenRecord=getHiddenRecord(key);if(hiddenRecord){return id in hiddenRecord?hiddenRecord[id]:opt_default}else{index=keys.indexOf(key);return index>=0?values[index]:opt_default}}function has___(key){var hiddenRecord=getHiddenRecord(key);if(hiddenRecord){return id in hiddenRecord}else{return keys.indexOf(key)>=0}}function set___(key,value){var index;var hiddenRecord=getHiddenRecord(key);if(hiddenRecord){hiddenRecord[id]=value}else{index=keys.indexOf(key);if(index>=0){values[index]=value}else{index=keys.length;values[index]=value;keys[index]=key}}return this}function delete___(key){var hiddenRecord=getHiddenRecord(key);var index,lastIndex;if(hiddenRecord){return id in hiddenRecord&&delete hiddenRecord[id]}else{index=keys.indexOf(key);if(index<0){return false}lastIndex=keys.length-1;keys[index]=void 0;values[index]=values[lastIndex];keys[index]=keys[lastIndex];keys.length=lastIndex;values.length=lastIndex;return true}}return Object.create(OurWeakMap.prototype,{get___:{value:constFunc(get___)},has___:{value:constFunc(has___)},set___:{value:constFunc(set___)},delete___:{value:constFunc(delete___)}})};OurWeakMap.prototype=Object.create(Object.prototype,{get:{value:function get(key,opt_default){return this.get___(key,opt_default)},writable:true,configurable:true},has:{value:function has(key){return this.has___(key)},writable:true,configurable:true},set:{value:function set(key,value){return this.set___(key,value)},writable:true,configurable:true},"delete":{value:function remove(key){return this.delete___(key)},writable:true,configurable:true}});if(typeof HostWeakMap==="function"){(function(){if(doubleWeakMapCheckSilentFailure&&typeof Proxy!=="undefined"){Proxy=undefined}function DoubleWeakMap(){if(!(this instanceof OurWeakMap)){calledAsFunctionWarning()}var hmap=new HostWeakMap;var omap=undefined;var enableSwitching=false;function dget(key,opt_default){if(omap){return hmap.has(key)?hmap.get(key):omap.get___(key,opt_default)}else{return hmap.get(key,opt_default)}}function dhas(key){return hmap.has(key)||(omap?omap.has___(key):false)}var dset;if(doubleWeakMapCheckSilentFailure){dset=function(key,value){hmap.set(key,value);if(!hmap.has(key)){if(!omap){omap=new OurWeakMap}omap.set(key,value)}return this}}else{dset=function(key,value){if(enableSwitching){try{hmap.set(key,value)}catch(e){if(!omap){omap=new OurWeakMap}omap.set___(key,value)}}else{hmap.set(key,value)}return this}}function ddelete(key){var result=!!hmap["delete"](key);if(omap){return omap.delete___(key)||result}return result}return Object.create(OurWeakMap.prototype,{get___:{value:constFunc(dget)},has___:{value:constFunc(dhas)},set___:{value:constFunc(dset)},delete___:{value:constFunc(ddelete)},permitHostObjects___:{value:constFunc(function(token){if(token===weakMapPermitHostObjects){enableSwitching=true}else{throw new Error("bogus call to permitHostObjects___")}})}})}DoubleWeakMap.prototype=OurWeakMap.prototype;module.exports=DoubleWeakMap;Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:false,configurable:true,writable:true})})()}else{if(typeof Proxy!=="undefined"){Proxy=undefined}module.exports=OurWeakMap}})()},{}],19:[function(require,module,exports){"use strict";var weakMap=typeof WeakMap==="undefined"?require("weak-map"):WeakMap;var WebGLEWStruct=new weakMap;function baseName(ext_name){return ext_name.replace(/^[A-Z]+_/,"")}function initWebGLEW(gl){var struct=WebGLEWStruct.get(gl);if(struct){return struct}var extensions={};var supported=gl.getSupportedExtensions();for(var i=0;i<supported.length;++i){var extName=supported[i];if(extName.indexOf("MOZ_")===0){continue}var ext=gl.getExtension(supported[i]);if(!ext){continue}while(true){extensions[extName]=ext;var base=baseName(extName);if(base===extName){break}extName=base}}WebGLEWStruct.set(gl,extensions);return extensions}module.exports=initWebGLEW},{"weak-map":18}],20:[function(require,module,exports){"use strict";function doBind(gl,elements,attributes){if(elements){elements.bind()}else{gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER,null)}var nattribs=gl.getParameter(gl.MAX_VERTEX_ATTRIBS)|0;if(attributes){if(attributes.length>nattribs){throw new Error("gl-vao: Too many vertex attributes")}for(var i=0;i<attributes.length;++i){var attrib=attributes[i];if(attrib.buffer){var buffer=attrib.buffer;var size=attrib.size||4;var type=attrib.type||gl.FLOAT;var normalized=!!attrib.normalized;var stride=attrib.stride||0;var offset=attrib.offset||0;buffer.bind();gl.enableVertexAttribArray(i);gl.vertexAttribPointer(i,size,type,normalized,stride,offset)}else{if(typeof attrib==="number"){gl.vertexAttrib1f(i,attrib)}else if(attrib.length===1){gl.vertexAttrib1f(i,attrib[0])}else if(attrib.length===2){gl.vertexAttrib2f(i,attrib[0],attrib[1])}else if(attrib.length===3){gl.vertexAttrib3f(i,attrib[0],attrib[1],attrib[2])}else if(attrib.length===4){gl.vertexAttrib4f(i,attrib[0],attrib[1],attrib[2],attrib[3])}else{throw new Error("gl-vao: Invalid vertex attribute")}gl.disableVertexAttribArray(i)}}for(;i<nattribs;++i){gl.disableVertexAttribArray(i)}}else{gl.bindBuffer(gl.ARRAY_BUFFER,null);for(var i=0;i<nattribs;++i){gl.disableVertexAttribArray(i)}}}module.exports=doBind},{}],21:[function(require,module,exports){"use strict";var bindAttribs=require("./do-bind.js");function VAOEmulated(gl){this.gl=gl;this._elements=null;this._attributes=null;this._elementsType=gl.UNSIGNED_SHORT}VAOEmulated.prototype.bind=function(){bindAttribs(this.gl,this._elements,this._attributes)};VAOEmulated.prototype.update=function(attributes,elements,elementsType){this._elements=elements;this._attributes=attributes;this._elementsType=elementsType||this.gl.UNSIGNED_SHORT};VAOEmulated.prototype.dispose=function(){};VAOEmulated.prototype.unbind=function(){};VAOEmulated.prototype.draw=function(mode,count,offset){offset=offset||0;var gl=this.gl;if(this._elements){gl.drawElements(mode,count,this._elementsType,offset)}else{gl.drawArrays(mode,offset,count)}};function createVAOEmulated(gl){return new VAOEmulated(gl)}module.exports=createVAOEmulated},{"./do-bind.js":20}],22:[function(require,module,exports){"use strict";var bindAttribs=require("./do-bind.js");function VertexAttribute(location,dimension,a,b,c,d){this.location=location;this.dimension=dimension;this.a=a;this.b=b;this.c=c;this.d=d}VertexAttribute.prototype.bind=function(gl){switch(this.dimension){case 1:gl.vertexAttrib1f(this.location,this.a);break;case 2:gl.vertexAttrib2f(this.location,this.a,this.b);break;case 3:gl.vertexAttrib3f(this.location,this.a,this.b,this.c);break;case 4:gl.vertexAttrib4f(this.location,this.a,this.b,this.c,this.d);break}};function VAONative(gl,ext,handle){this.gl=gl;this._ext=ext;this.handle=handle;this._attribs=[];this._useElements=false;this._elementsType=gl.UNSIGNED_SHORT}VAONative.prototype.bind=function(){this._ext.bindVertexArrayOES(this.handle);for(var i=0;i<this._attribs.length;++i){this._attribs[i].bind(this.gl)}};VAONative.prototype.unbind=function(){this._ext.bindVertexArrayOES(null)};VAONative.prototype.dispose=function(){this._ext.deleteVertexArrayOES(this.handle)};VAONative.prototype.update=function(attributes,elements,elementsType){this.bind();bindAttribs(this.gl,elements,attributes);this.unbind();this._attribs.length=0;if(attributes)for(var i=0;i<attributes.length;++i){var a=attributes[i];if(typeof a==="number"){this._attribs.push(new VertexAttribute(i,1,a))}else if(Array.isArray(a)){this._attribs.push(new VertexAttribute(i,a.length,a[0],a[1],a[2],a[3]))}}this._useElements=!!elements;this._elementsType=elementsType||this.gl.UNSIGNED_SHORT};VAONative.prototype.draw=function(mode,count,offset){offset=offset||0;var gl=this.gl;if(this._useElements){gl.drawElements(mode,count,this._elementsType,offset)}else{gl.drawArrays(mode,offset,count)}};function createVAONative(gl,ext){return new VAONative(gl,ext,ext.createVertexArrayOES())}module.exports=createVAONative},{"./do-bind.js":20}],23:[function(require,module,exports){arguments[4][18][0].apply(exports,arguments)},{dup:18}],24:[function(require,module,exports){arguments[4][19][0].apply(exports,arguments)},{dup:19,"weak-map":23}],25:[function(require,module,exports){"use strict";var webglew=require("webglew");var createVAONative=require("./lib/vao-native.js");var createVAOEmulated=require("./lib/vao-emulated.js");function createVAO(gl,attributes,elements,elementsType){var ext=webglew(gl).OES_vertex_array_object;var vao;if(ext){vao=createVAONative(gl,ext)}else{vao=createVAOEmulated(gl)}vao.update(attributes,elements,elementsType);return vao}module.exports=createVAO},{"./lib/vao-emulated.js":21,"./lib/vao-native.js":22,webglew:24}],26:[function(require,module,exports){module.exports=isTypedArray;isTypedArray.strict=isStrictTypedArray;isTypedArray.loose=isLooseTypedArray;var toString=Object.prototype.toString;var names={"[object Int8Array]":true,"[object Int16Array]":true,"[object Int32Array]":true,"[object Uint8Array]":true,"[object Uint16Array]":true,"[object Uint32Array]":true,"[object Float32Array]":true,"[object Float64Array]":true};function isTypedArray(arr){return isStrictTypedArray(arr)||isLooseTypedArray(arr)}function isStrictTypedArray(arr){return arr instanceof Int8Array||arr instanceof Int16Array||arr instanceof Int32Array||arr instanceof Uint8Array||arr instanceof Uint16Array||arr instanceof Uint32Array||arr instanceof Float32Array||arr instanceof Float64Array}function isLooseTypedArray(arr){return names[toString.call(arr)]}},{}],27:[function(require,module,exports){module.exports=function(arr){if(!arr)return false;if(!arr.dtype)return false;var re=new RegExp("function View[0-9]+d(:?"+arr.dtype+")+");return re.test(String(arr.constructor))}},{}],28:[function(require,module,exports){var pack=require("array-pack-2d");var ista=require("is-typedarray");var createBuffer=require("gl-buffer");var isnd=require("isndarray");var dtype=require("dtype");module.exports=normalize;function normalize(gl,attr,size,mode,type){if(Array.isArray(attr)&&Array.isArray(attr[0])){return{buffer:createBuffer(gl,pack(attr,type),mode),length:attr.length}}if(Array.isArray(attr)){return{buffer:createBuffer(gl,new(dtype(type))(attr),mode),length:attr.length/size}}if(attr.handle instanceof WebGLBuffer){return{buffer:attr,length:attr.length/size/4}}if(attr.cells&&attr.positions){return{length:attr.cells.length*size,buffer:createBuffer(gl,pack(attr.positions,type),mode),index:createBuffer(gl,pack(attr.cells,"uint16"),gl.ELEMENT_ARRAY_BUFFER)}}if(isnd(attr)){return{buffer:createBuffer(gl,attr,mode),length:ndlength(attr.shape)/size}}if(ista(attr)){if(type&&!(attr instanceof dtype(type))){attr=convert(attr,dtype(type))}return{buffer:createBuffer(gl,attr,mode),length:attr.length/size}}}function ndlength(shape){var length=1;for(var i=0;i<shape.length;i++)length*=shape[i];return length}function convert(a,b){b=new b(a.length);for(var i=0;i<a.length;i++)b[i]=a[i];return b}},{"array-pack-2d":5,dtype:6,"gl-buffer":7,"is-typedarray":26,isndarray:27}],"gl-geometry":[function(require,module,exports){var normalize=require("./normalize");var createVAO=require("gl-vao");module.exports=GLGeometry;function GLGeometry(gl){if(!(this instanceof GLGeometry))return new GLGeometry(gl);this._attributes=[];this._dirty=true;this._length=0;this._index=null;this._vao=null;this._keys=[];this.gl=gl}GLGeometry.prototype.dispose=function(){for(var i=0;i<this._attributes.length;i++){this._attributes[i].buffer.dispose()}this._attributes=[];if(this._index){this._index.dispose();this._index=null}if(this._vao){this._vao.dispose();this._vao=null}};GLGeometry.prototype.faces=function faces(attr,opts){var size=opts&&opts.size||3;attr=attr.cells?attr.cells:attr;this._dirty=true;if(this._index){this._index.dispose()}this._index=normalize(this.gl,attr,size,this.gl.ELEMENT_ARRAY_BUFFER,"uint16");this._length=this._index.length*size;this._index=this._index.buffer;return this};GLGeometry.prototype.attr=function attr(name,attr,opts){opts=opts||{};this._dirty=true;var gl=this.gl;var first=!this._attributes.length;var size=opts.size||3;var attribute=normalize(gl,attr,size,gl.ARRAY_BUFFER,"float32");if(!attribute){throw new Error("Unexpected attribute format: needs an ndarray, array, typed array, "+"gl-buffer or simplicial complex")}var buffer=attribute.buffer;var length=attribute.length;var index=attribute.index;this._keys.push(name);this._attributes.push({size:size,buffer:buffer});if(first){this._length=length}if(first&&index){this._index=index}return this};GLGeometry.prototype.bind=function bind(shader){this.update();this._vao.bind();if(!shader)return;shader.bind();if(!this._keys)return;for(var i=0;i<this._keys.length;i++){var attr=shader.attributes[this._keys[i]];if(attr)attr.location=i}};GLGeometry.prototype.draw=function draw(mode){this.update();this._vao.draw(typeof mode==="undefined"?this.gl.TRIANGLES:mode,this._length)};GLGeometry.prototype.unbind=function unbind(){this.update();this._vao.unbind()};GLGeometry.prototype.update=function update(){if(!this._dirty)return;this._dirty=false;if(this._vao)this._vao.dispose();this._vao=createVAO(this.gl,this._attributes,this._index)}},{"./normalize":28,"gl-vao":25}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){"use strict";module.exports=createAttributeWrapper;function ShaderAttribute(gl,wrapper,index,locations,dimension,constFunc){this._gl=gl;this._wrapper=wrapper;this._index=index;this._locations=locations;this._dimension=dimension;this._constFunc=constFunc}var proto=ShaderAttribute.prototype;proto.pointer=function setAttribPointer(type,normalized,stride,offset){var self=this;var gl=self._gl;var location=self._locations[self._index];gl.vertexAttribPointer(location,self._dimension,type||gl.FLOAT,!!normalized,stride||0,offset||0);gl.enableVertexAttribArray(location)};proto.set=function(x0,x1,x2,x3){return this._constFunc(this._locations[this._index],x0,x1,x2,x3)};Object.defineProperty(proto,"location",{get:function(){return this._locations[this._index]},set:function(v){if(v!==this._locations[this._index]){this._locations[this._index]=v|0;this._wrapper.program=null}return v|0}});function addVectorAttribute(gl,wrapper,index,locations,dimension,obj,name){var constFuncArgs=["gl","v"];var varNames=[];for(var i=0;i<dimension;++i){constFuncArgs.push("x"+i);varNames.push("x"+i)}constFuncArgs.push("if(x0.length===void 0){return gl.vertexAttrib"+dimension+"f(v,"+varNames.join()+")}else{return gl.vertexAttrib"+dimension+"fv(v,x0)}");var constFunc=Function.apply(null,constFuncArgs);var attr=new ShaderAttribute(gl,wrapper,index,locations,dimension,constFunc);Object.defineProperty(obj,name,{set:function(x){gl.disableVertexAttribArray(locations[index]);constFunc(gl,locations[index],x);return x},get:function(){return attr},enumerable:true})}function addMatrixAttribute(gl,wrapper,index,locations,dimension,obj,name){var parts=new Array(dimension);var attrs=new Array(dimension);for(var i=0;i<dimension;++i){addVectorAttribute(gl,wrapper,index[i],locations,dimension,parts,i);attrs[i]=parts[i]}Object.defineProperty(parts,"location",{set:function(v){if(Array.isArray){for(var i=0;i<dimension;++i){attrs[i].location=v[i]}}else{for(var i=0;i<dimension;++i){result[i]=attrs[i].location=v+i}}return v},get:function(){var result=new Array(dimension);for(var i=0;i<dimension;++i){result[i]=locations[index[i]]}return result},enumerable:true});parts.pointer=function(type,normalized,stride,offset){type=type||gl.FLOAT;normalized=!!normalized;stride=stride||dimension*dimension;offset=offset||0;for(var i=0;i<dimension;++i){var location=locations[index[i]];gl.vertexAttribPointer(location,dimension,type,normalized,stride,offset+i*dimension);gl.enableVertexAttribArray(location)}};var scratch=new Array(dimension);var vertexAttrib=gl["vertexAttrib"+dimension+"fv"];Object.defineProperty(obj,name,{set:function(x){for(var i=0;i<dimension;++i){var loc=locations[index[i]];gl.disableVertexAttribArray(loc);if(Array.isArray(x[0])){vertexAttrib.call(gl,loc,x[i])}else{for(var j=0;j<dimension;++j){scratch[j]=x[dimension*i+j]}vertexAttrib.call(gl,loc,scratch)}}return x},get:function(){return parts},enumerable:true})}function createAttributeWrapper(gl,wrapper,attributes,locations){var obj={};for(var i=0,n=attributes.length;i<n;++i){var a=attributes[i];var name=a.name;var type=a.type;var locs=a.locations;switch(type){case"bool":case"int":case"float":addVectorAttribute(gl,wrapper,locs[0],locations,1,obj,name);break;default:if(type.indexOf("vec")>=0){var d=type.charCodeAt(type.length-1)-48;if(d<2||d>4){throw new Error("gl-shader: Invalid data type for attribute "+name+": "+type)}addVectorAttribute(gl,wrapper,locs[0],locations,d,obj,name)}else if(type.indexOf("mat")>=0){var d=type.charCodeAt(type.length-1)-48;if(d<2||d>4){throw new Error("gl-shader: Invalid data type for attribute "+name+": "+type)}addMatrixAttribute(gl,wrapper,locs,locations,d,obj,name)}else{throw new Error("gl-shader: Unknown data type for attribute "+name+": "+type)}break}}return obj}},{}],2:[function(require,module,exports){"use strict";var dup=require("dup");var coallesceUniforms=require("./reflect");module.exports=createUniformWrapper;function identity(x){var c=new Function("y","return function(){return y}");return c(x)}function createUniformWrapper(gl,wrapper,uniforms,locations){function makeGetter(index){var proc=new Function("gl","wrapper","locations","return function(){return gl.getUniform(wrapper.program,locations["+index+"])}");return proc(gl,wrapper,locations)}function makePropSetter(path,index,type){switch(type){case"bool":case"int":case"sampler2D":case"samplerCube":return"gl.uniform1i(locations["+index+"],obj"+path+")";case"float":return"gl.uniform1f(locations["+index+"],obj"+path+")";default:var vidx=type.indexOf("vec");if(0<=vidx&&vidx<=1&&type.length===4+vidx){var d=type.charCodeAt(type.length-1)-48;if(d<2||d>4){throw new Error("gl-shader: Invalid data type")}switch(type.charAt(0)){case"b":case"i":return"gl.uniform"+d+"iv(locations["+index+"],obj"+path+")";case"v":return"gl.uniform"+d+"fv(locations["+index+"],obj"+path+")";default:throw new Error("gl-shader: Unrecognized data type for vector "+name+": "+type)}}else if(type.indexOf("mat")===0&&type.length===4){var d=type.charCodeAt(type.length-1)-48;if(d<2||d>4){throw new Error("gl-shader: Invalid uniform dimension type for matrix "+name+": "+type)}return"gl.uniformMatrix"+d+"fv(locations["+index+"],false,obj"+path+")"}else{throw new Error("gl-shader: Unknown uniform data type for "+name+": "+type)}break}}function enumerateIndices(prefix,type){if(typeof type!=="object"){return[[prefix,type]]}var indices=[];for(var id in type){var prop=type[id];var tprefix=prefix;if(parseInt(id)+""===id){tprefix+="["+id+"]"}else{tprefix+="."+id}if(typeof prop==="object"){indices.push.apply(indices,enumerateIndices(tprefix,prop))}else{indices.push([tprefix,prop])}}return indices}function makeSetter(type){var code=["return function updateProperty(obj){"];var indices=enumerateIndices("",type);for(var i=0;i<indices.length;++i){var item=indices[i];var path=item[0];var idx=item[1];if(locations[idx]){code.push(makePropSetter(path,idx,uniforms[idx].type))}}code.push("return obj}");var proc=new Function("gl","locations",code.join("\n"));return proc(gl,locations)}function defaultValue(type){switch(type){case"bool":return false;case"int":case"sampler2D":case"samplerCube":return 0;case"float":return 0;default:var vidx=type.indexOf("vec");if(0<=vidx&&vidx<=1&&type.length===4+vidx){var d=type.charCodeAt(type.length-1)-48;if(d<2||d>4){throw new Error("gl-shader: Invalid data type")}if(type.charAt(0)==="b"){return dup(d,false)}return dup(d)}else if(type.indexOf("mat")===0&&type.length===4){var d=type.charCodeAt(type.length-1)-48;if(d<2||d>4){throw new Error("gl-shader: Invalid uniform dimension type for matrix "+name+": "+type)}return dup(d*d)}else{throw new Error("gl-shader: Unknown uniform data type for "+name+": "+type)}break}}function storeProperty(obj,prop,type){if(typeof type==="object"){var child=processObject(type);Object.defineProperty(obj,prop,{get:identity(child),set:makeSetter(type),enumerable:true,configurable:false})}else{if(locations[type]){Object.defineProperty(obj,prop,{get:makeGetter(type),set:makeSetter(type),enumerable:true,configurable:false})}else{obj[prop]=defaultValue(uniforms[type].type)}}}function processObject(obj){var result;if(Array.isArray(obj)){result=new Array(obj.length);for(var i=0;i<obj.length;++i){storeProperty(result,i,obj[i])}}else{result={};for(var id in obj){storeProperty(result,id,obj[id])}}return result}var coallesced=coallesceUniforms(uniforms,true);return{get:identity(processObject(coallesced)),set:makeSetter(coallesced),enumerable:true,configurable:true}}},{"./reflect":3,dup:6}],3:[function(require,module,exports){"use strict"; | |
module.exports=makeReflectTypes;function makeReflectTypes(uniforms,useIndex){var obj={};for(var i=0;i<uniforms.length;++i){var n=uniforms[i].name;var parts=n.split(".");var o=obj;for(var j=0;j<parts.length;++j){var x=parts[j].split("[");if(x.length>1){if(!(x[0]in o)){o[x[0]]=[]}o=o[x[0]];for(var k=1;k<x.length;++k){var y=parseInt(x[k]);if(k<x.length-1||j<parts.length-1){if(!(y in o)){if(k<x.length-1){o[y]=[]}else{o[y]={}}}o=o[y]}else{if(useIndex){o[y]=i}else{o[y]=uniforms[i].type}}}}else if(j<parts.length-1){if(!(x[0]in o)){o[x[0]]={}}o=o[x[0]]}else{if(useIndex){o[x[0]]=i}else{o[x[0]]=uniforms[i].type}}}}return obj}},{}],4:[function(require,module,exports){"use strict";exports.uniforms=runtimeUniforms;exports.attributes=runtimeAttributes;var GL_TO_GLSL_TYPES={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube"};var GL_TABLE=null;function getType(gl,type){if(!GL_TABLE){var typeNames=Object.keys(GL_TO_GLSL_TYPES);GL_TABLE={};for(var i=0;i<typeNames.length;++i){var tn=typeNames[i];GL_TABLE[gl[tn]]=GL_TO_GLSL_TYPES[tn]}}return GL_TABLE[type]}function runtimeUniforms(gl,program){var numUniforms=gl.getProgramParameter(program,gl.ACTIVE_UNIFORMS);var result=[];for(var i=0;i<numUniforms;++i){var info=gl.getActiveUniform(program,i);if(info){result.push({name:info.name,type:getType(gl,info.type)})}}return result}function runtimeAttributes(gl,program){var numAttributes=gl.getProgramParameter(program,gl.ACTIVE_ATTRIBUTES);var result=[];for(var i=0;i<numAttributes;++i){var info=gl.getActiveAttrib(program,i);if(info){result.push({name:info.name,type:getType(gl,info.type)})}}return result}},{}],5:[function(require,module,exports){"use strict";exports.shader=getShaderReference;exports.program=createProgram;var weakMap=typeof WeakMap==="undefined"?require("weakmap-shim"):WeakMap;var CACHE=new weakMap;var SHADER_COUNTER=0;function ShaderReference(id,src,type,shader,programs,count,cache){this.id=id;this.src=src;this.type=type;this.shader=shader;this.count=count;this.programs=[];this.cache=cache}ShaderReference.prototype.dispose=function(){if(--this.count===0){var cache=this.cache;var gl=cache.gl;var programs=this.programs;for(var i=0,n=programs.length;i<n;++i){var p=cache.programs[programs[i]];if(p){delete cache.programs[i];gl.deleteProgram(p)}}gl.deleteShader(this.shader);delete cache.shaders[this.type===gl.FRAGMENT_SHADER|0][this.src]}};function ContextCache(gl){this.gl=gl;this.shaders=[{},{}];this.programs={}}var proto=ContextCache.prototype;function compileShader(gl,type,src){var shader=gl.createShader(type);gl.shaderSource(shader,src);gl.compileShader(shader);if(!gl.getShaderParameter(shader,gl.COMPILE_STATUS)){var errLog=gl.getShaderInfoLog(shader);console.error("gl-shader: Error compiling shader:",errLog);throw new Error("gl-shader: Error compiling shader:"+errLog)}return shader}proto.getShaderReference=function(type,src){var gl=this.gl;var shaders=this.shaders[type===gl.FRAGMENT_SHADER|0];var shader=shaders[src];if(!shader){var shaderObj=compileShader(gl,type,src);shader=shaders[src]=new ShaderReference(SHADER_COUNTER++,src,type,shaderObj,[],1,this)}else{shader.count+=1}return shader};function linkProgram(gl,vshader,fshader,attribs,locations){var program=gl.createProgram();gl.attachShader(program,vshader);gl.attachShader(program,fshader);for(var i=0;i<attribs.length;++i){gl.bindAttribLocation(program,locations[i],attribs[i])}gl.linkProgram(program);if(!gl.getProgramParameter(program,gl.LINK_STATUS)){var errLog=gl.getProgramInfoLog(program);console.error("gl-shader: Error linking program:",errLog);throw new Error("gl-shader: Error linking program:"+errLog)}return program}proto.getProgram=function(vref,fref,attribs,locations){var token=[vref.id,fref.id,attribs.join(":"),locations.join(":")].join("@");var prog=this.programs[token];if(!prog){this.programs[token]=prog=linkProgram(this.gl,vref.shader,fref.shader,attribs,locations);vref.programs.push(token);fref.programs.push(token)}return prog};function getCache(gl){var ctxCache=CACHE.get(gl);if(!ctxCache){ctxCache=new ContextCache(gl);CACHE.set(gl,ctxCache)}return ctxCache}function getShaderReference(gl,type,src){return getCache(gl).getShaderReference(type,src)}function createProgram(gl,vref,fref,attribs,locations){return getCache(gl).getProgram(vref,fref,attribs,locations)}},{"weakmap-shim":9}],6:[function(require,module,exports){"use strict";function dupe_array(count,value,i){var c=count[i]|0;if(c<=0){return[]}var result=new Array(c),j;if(i===count.length-1){for(j=0;j<c;++j){result[j]=value}}else{for(j=0;j<c;++j){result[j]=dupe_array(count,value,i+1)}}return result}function dupe_number(count,value){var result,i;result=new Array(count);for(i=0;i<count;++i){result[i]=value}return result}function dupe(count,value){if(typeof value==="undefined"){value=0}switch(typeof count){case"number":if(count>0){return dupe_number(count|0,value)}break;case"object":if(typeof count.length==="number"){return dupe_array(count,value,0)}break}return[]}module.exports=dupe},{}],7:[function(require,module,exports){var hiddenStore=require("./hidden-store.js");module.exports=createStore;function createStore(){var key={};return function(obj){if((typeof obj!=="object"||obj===null)&&typeof obj!=="function"){throw new Error("Weakmap-shim: Key must be object")}var store=obj.valueOf(key);return store&&store.identity===key?store:hiddenStore(obj,key)}}},{"./hidden-store.js":8}],8:[function(require,module,exports){module.exports=hiddenStore;function hiddenStore(obj,key){var store={identity:key};var valueOf=obj.valueOf;Object.defineProperty(obj,"valueOf",{value:function(value){return value!==key?valueOf.apply(this,arguments):store},writable:true});return store}},{}],9:[function(require,module,exports){var createStore=require("./create-store.js");module.exports=weakMap;function weakMap(){var privates=createStore();return{get:function(key,fallback){var store=privates(key);return store.hasOwnProperty("value")?store.value:fallback},set:function(key,value){privates(key).value=value},has:function(key){return"value"in privates(key)},"delete":function(key){return delete privates(key).value}}}},{"./create-store.js":7}],"gl-shader":[function(require,module,exports){"use strict";var createUniformWrapper=require("./lib/create-uniforms");var createAttributeWrapper=require("./lib/create-attributes");var makeReflect=require("./lib/reflect");var shaderCache=require("./lib/shader-cache");var runtime=require("./lib/runtime-reflect");function Shader(gl){this.gl=gl;this._vref=this._fref=this._relink=this.vertShader=this.fragShader=this.program=this.attributes=this.uniforms=this.types=null}var proto=Shader.prototype;proto.bind=function(){if(!this.program){this._relink()}this.gl.useProgram(this.program)};proto.dispose=function(){if(this._fref){this._fref.dispose()}if(this._vref){this._vref.dispose()}this.attributes=this.types=this.vertShader=this.fragShader=this.program=this._relink=this._fref=this._vref=null};function compareAttributes(a,b){if(a.name<b.name){return-1}return 1}proto.update=function(vertSource,fragSource,uniforms,attributes){if(!fragSource||arguments.length===1){var obj=vertSource;vertSource=obj.vertex;fragSource=obj.fragment;uniforms=obj.uniforms;attributes=obj.attributes}var wrapper=this;var gl=wrapper.gl;var pvref=wrapper._vref;wrapper._vref=shaderCache.shader(gl,gl.VERTEX_SHADER,vertSource);if(pvref){pvref.dispose()}wrapper.vertShader=wrapper._vref.shader;var pfref=this._fref;wrapper._fref=shaderCache.shader(gl,gl.FRAGMENT_SHADER,fragSource);if(pfref){pfref.dispose()}wrapper.fragShader=wrapper._fref.shader;if(!uniforms||!attributes){var testProgram=gl.createProgram();gl.attachShader(testProgram,wrapper.fragShader);gl.attachShader(testProgram,wrapper.vertShader);gl.linkProgram(testProgram);if(!gl.getProgramParameter(testProgram,gl.LINK_STATUS)){var errLog=gl.getProgramInfoLog(testProgram);console.error("gl-shader: Error linking program:",errLog);throw new Error("gl-shader: Error linking program:"+errLog)}uniforms=uniforms||runtime.uniforms(gl,testProgram);attributes=attributes||runtime.attributes(gl,testProgram);gl.deleteProgram(testProgram)}attributes=attributes.slice();attributes.sort(compareAttributes);var attributeUnpacked=[];var attributeNames=[];var attributeLocations=[];for(var i=0;i<attributes.length;++i){var attr=attributes[i];if(attr.type.indexOf("mat")>=0){var size=attr.type.charAt(attr.type.length-1)|0;var locVector=new Array(size);for(var j=0;j<size;++j){locVector[j]=attributeLocations.length;attributeNames.push(attr.name+"["+j+"]");if(typeof attr.location==="number"){attributeLocations.push(attr.location+j)}else if(Array.isArray(attr.location)&&attr.location.length===size&&typeof attr.location[j]==="number"){attributeLocations.push(attr.location[j]|0)}else{attributeLocations.push(-1)}}attributeUnpacked.push({name:attr.name,type:attr.type,locations:locVector})}else{attributeUnpacked.push({name:attr.name,type:attr.type,locations:[attributeLocations.length]});attributeNames.push(attr.name);if(typeof attr.location==="number"){attributeLocations.push(attr.location|0)}else{attributeLocations.push(-1)}}}var curLocation=0;for(var i=0;i<attributeLocations.length;++i){if(attributeLocations[i]<0){while(attributeLocations.indexOf(curLocation)>=0){curLocation+=1}attributeLocations[i]=curLocation}}var uniformLocations=new Array(uniforms.length);function relink(){wrapper.program=shaderCache.program(gl,wrapper._vref,wrapper._fref,attributeNames,attributeLocations);for(var i=0;i<uniforms.length;++i){uniformLocations[i]=gl.getUniformLocation(wrapper.program,uniforms[i].name)}}relink();wrapper._relink=relink;wrapper.types={uniforms:makeReflect(uniforms),attributes:makeReflect(attributes)};wrapper.attributes=createAttributeWrapper(gl,wrapper,attributeUnpacked,attributeLocations);Object.defineProperty(wrapper,"uniforms",createUniformWrapper(gl,wrapper,uniforms,uniformLocations))};function createShader(gl,vertSource,fragSource,uniforms,attributes){var shader=new Shader(gl);shader.update(vertSource,fragSource,uniforms,attributes);return shader}module.exports=createShader},{"./lib/create-attributes":1,"./lib/create-uniforms":2,"./lib/reflect":3,"./lib/runtime-reflect":4,"./lib/shader-cache":5}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({"gl-matrix":[function(require,module,exports){(function(){"use strict";var shim={};if(typeof exports==="undefined"){if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){shim.exports={};define(function(){return shim.exports})}else{shim.exports=window}}else{shim.exports=exports}(function(exports){if(!GLMAT_EPSILON){var GLMAT_EPSILON=1e-6}if(!GLMAT_ARRAY_TYPE){var GLMAT_ARRAY_TYPE=typeof Float32Array!=="undefined"?Float32Array:Array}var glMatrix={};glMatrix.setMatrixArrayType=function(type){GLMAT_ARRAY_TYPE=type};if(typeof exports!=="undefined"){exports.glMatrix=glMatrix}var vec2={};vec2.create=function(){var out=new GLMAT_ARRAY_TYPE(2);out[0]=0;out[1]=0;return out};vec2.clone=function(a){var out=new GLMAT_ARRAY_TYPE(2);out[0]=a[0];out[1]=a[1];return out};vec2.fromValues=function(x,y){var out=new GLMAT_ARRAY_TYPE(2);out[0]=x;out[1]=y;return out};vec2.copy=function(out,a){out[0]=a[0];out[1]=a[1];return out};vec2.set=function(out,x,y){out[0]=x;out[1]=y;return out};vec2.add=function(out,a,b){out[0]=a[0]+b[0];out[1]=a[1]+b[1];return out};vec2.subtract=function(out,a,b){out[0]=a[0]-b[0];out[1]=a[1]-b[1];return out};vec2.sub=vec2.subtract;vec2.multiply=function(out,a,b){out[0]=a[0]*b[0];out[1]=a[1]*b[1];return out};vec2.mul=vec2.multiply;vec2.divide=function(out,a,b){out[0]=a[0]/b[0];out[1]=a[1]/b[1];return out};vec2.div=vec2.divide;vec2.min=function(out,a,b){out[0]=Math.min(a[0],b[0]);out[1]=Math.min(a[1],b[1]);return out};vec2.max=function(out,a,b){out[0]=Math.max(a[0],b[0]);out[1]=Math.max(a[1],b[1]);return out};vec2.scale=function(out,a,b){out[0]=a[0]*b;out[1]=a[1]*b;return out};vec2.distance=function(a,b){var x=b[0]-a[0],y=b[1]-a[1];return Math.sqrt(x*x+y*y)};vec2.dist=vec2.distance;vec2.squaredDistance=function(a,b){var x=b[0]-a[0],y=b[1]-a[1];return x*x+y*y};vec2.sqrDist=vec2.squaredDistance;vec2.length=function(a){var x=a[0],y=a[1];return Math.sqrt(x*x+y*y)};vec2.len=vec2.length;vec2.squaredLength=function(a){var x=a[0],y=a[1];return x*x+y*y};vec2.sqrLen=vec2.squaredLength;vec2.negate=function(out,a){out[0]=-a[0];out[1]=-a[1];return out};vec2.normalize=function(out,a){var x=a[0],y=a[1];var len=x*x+y*y;if(len>0){len=1/Math.sqrt(len);out[0]=a[0]*len;out[1]=a[1]*len}return out};vec2.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]};vec2.cross=function(out,a,b){var z=a[0]*b[1]-a[1]*b[0];out[0]=out[1]=0;out[2]=z;return out};vec2.lerp=function(out,a,b,t){var ax=a[0],ay=a[1];out[0]=ax+t*(b[0]-ax);out[1]=ay+t*(b[1]-ay);return out};vec2.transformMat2=function(out,a,m){var x=a[0],y=a[1];out[0]=m[0]*x+m[2]*y;out[1]=m[1]*x+m[3]*y;return out};vec2.transformMat2d=function(out,a,m){var x=a[0],y=a[1];out[0]=m[0]*x+m[2]*y+m[4];out[1]=m[1]*x+m[3]*y+m[5];return out};vec2.transformMat3=function(out,a,m){var x=a[0],y=a[1];out[0]=m[0]*x+m[3]*y+m[6];out[1]=m[1]*x+m[4]*y+m[7];return out};vec2.transformMat4=function(out,a,m){var x=a[0],y=a[1];out[0]=m[0]*x+m[4]*y+m[12];out[1]=m[1]*x+m[5]*y+m[13];return out};vec2.forEach=function(){var vec=vec2.create();return function(a,stride,offset,count,fn,arg){var i,l;if(!stride){stride=2}if(!offset){offset=0}if(count){l=Math.min(count*stride+offset,a.length)}else{l=a.length}for(i=offset;i<l;i+=stride){vec[0]=a[i];vec[1]=a[i+1];fn(vec,vec,arg);a[i]=vec[0];a[i+1]=vec[1]}return a}}();vec2.str=function(a){return"vec2("+a[0]+", "+a[1]+")"};if(typeof exports!=="undefined"){exports.vec2=vec2}var vec3={};vec3.create=function(){var out=new GLMAT_ARRAY_TYPE(3);out[0]=0;out[1]=0;out[2]=0;return out};vec3.clone=function(a){var out=new GLMAT_ARRAY_TYPE(3);out[0]=a[0];out[1]=a[1];out[2]=a[2];return out};vec3.fromValues=function(x,y,z){var out=new GLMAT_ARRAY_TYPE(3);out[0]=x;out[1]=y;out[2]=z;return out};vec3.copy=function(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];return out};vec3.set=function(out,x,y,z){out[0]=x;out[1]=y;out[2]=z;return out};vec3.add=function(out,a,b){out[0]=a[0]+b[0];out[1]=a[1]+b[1];out[2]=a[2]+b[2];return out};vec3.subtract=function(out,a,b){out[0]=a[0]-b[0];out[1]=a[1]-b[1];out[2]=a[2]-b[2];return out};vec3.sub=vec3.subtract;vec3.multiply=function(out,a,b){out[0]=a[0]*b[0];out[1]=a[1]*b[1];out[2]=a[2]*b[2];return out};vec3.mul=vec3.multiply;vec3.divide=function(out,a,b){out[0]=a[0]/b[0];out[1]=a[1]/b[1];out[2]=a[2]/b[2];return out};vec3.div=vec3.divide;vec3.min=function(out,a,b){out[0]=Math.min(a[0],b[0]);out[1]=Math.min(a[1],b[1]);out[2]=Math.min(a[2],b[2]);return out};vec3.max=function(out,a,b){out[0]=Math.max(a[0],b[0]);out[1]=Math.max(a[1],b[1]);out[2]=Math.max(a[2],b[2]);return out};vec3.scale=function(out,a,b){out[0]=a[0]*b;out[1]=a[1]*b;out[2]=a[2]*b;return out};vec3.distance=function(a,b){var x=b[0]-a[0],y=b[1]-a[1],z=b[2]-a[2];return Math.sqrt(x*x+y*y+z*z)};vec3.dist=vec3.distance;vec3.squaredDistance=function(a,b){var x=b[0]-a[0],y=b[1]-a[1],z=b[2]-a[2];return x*x+y*y+z*z};vec3.sqrDist=vec3.squaredDistance;vec3.length=function(a){var x=a[0],y=a[1],z=a[2];return Math.sqrt(x*x+y*y+z*z)};vec3.len=vec3.length;vec3.squaredLength=function(a){var x=a[0],y=a[1],z=a[2];return x*x+y*y+z*z};vec3.sqrLen=vec3.squaredLength;vec3.negate=function(out,a){out[0]=-a[0];out[1]=-a[1];out[2]=-a[2];return out};vec3.normalize=function(out,a){var x=a[0],y=a[1],z=a[2];var len=x*x+y*y+z*z;if(len>0){len=1/Math.sqrt(len);out[0]=a[0]*len;out[1]=a[1]*len;out[2]=a[2]*len}return out};vec3.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]};vec3.cross=function(out,a,b){var ax=a[0],ay=a[1],az=a[2],bx=b[0],by=b[1],bz=b[2];out[0]=ay*bz-az*by;out[1]=az*bx-ax*bz;out[2]=ax*by-ay*bx;return out};vec3.lerp=function(out,a,b,t){var ax=a[0],ay=a[1],az=a[2];out[0]=ax+t*(b[0]-ax);out[1]=ay+t*(b[1]-ay);out[2]=az+t*(b[2]-az);return out};vec3.transformMat4=function(out,a,m){var x=a[0],y=a[1],z=a[2];out[0]=m[0]*x+m[4]*y+m[8]*z+m[12];out[1]=m[1]*x+m[5]*y+m[9]*z+m[13];out[2]=m[2]*x+m[6]*y+m[10]*z+m[14];return out};vec3.transformQuat=function(out,a,q){var x=a[0],y=a[1],z=a[2],qx=q[0],qy=q[1],qz=q[2],qw=q[3],ix=qw*x+qy*z-qz*y,iy=qw*y+qz*x-qx*z,iz=qw*z+qx*y-qy*x,iw=-qx*x-qy*y-qz*z;out[0]=ix*qw+iw*-qx+iy*-qz-iz*-qy;out[1]=iy*qw+iw*-qy+iz*-qx-ix*-qz;out[2]=iz*qw+iw*-qz+ix*-qy-iy*-qx;return out};vec3.forEach=function(){var vec=vec3.create();return function(a,stride,offset,count,fn,arg){var i,l;if(!stride){stride=3}if(!offset){offset=0}if(count){l=Math.min(count*stride+offset,a.length)}else{l=a.length}for(i=offset;i<l;i+=stride){vec[0]=a[i];vec[1]=a[i+1];vec[2]=a[i+2];fn(vec,vec,arg);a[i]=vec[0];a[i+1]=vec[1];a[i+2]=vec[2]}return a}}();vec3.str=function(a){return"vec3("+a[0]+", "+a[1]+", "+a[2]+")"};if(typeof exports!=="undefined"){exports.vec3=vec3}var vec4={};vec4.create=function(){var out=new GLMAT_ARRAY_TYPE(4);out[0]=0;out[1]=0;out[2]=0;out[3]=0;return out};vec4.clone=function(a){var out=new GLMAT_ARRAY_TYPE(4);out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];return out};vec4.fromValues=function(x,y,z,w){var out=new GLMAT_ARRAY_TYPE(4);out[0]=x;out[1]=y;out[2]=z;out[3]=w;return out};vec4.copy=function(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];return out};vec4.set=function(out,x,y,z,w){out[0]=x;out[1]=y;out[2]=z;out[3]=w;return out};vec4.add=function(out,a,b){out[0]=a[0]+b[0];out[1]=a[1]+b[1];out[2]=a[2]+b[2];out[3]=a[3]+b[3];return out};vec4.subtract=function(out,a,b){out[0]=a[0]-b[0];out[1]=a[1]-b[1];out[2]=a[2]-b[2];out[3]=a[3]-b[3];return out};vec4.sub=vec4.subtract;vec4.multiply=function(out,a,b){out[0]=a[0]*b[0];out[1]=a[1]*b[1];out[2]=a[2]*b[2];out[3]=a[3]*b[3];return out};vec4.mul=vec4.multiply;vec4.divide=function(out,a,b){out[0]=a[0]/b[0];out[1]=a[1]/b[1];out[2]=a[2]/b[2];out[3]=a[3]/b[3];return out};vec4.div=vec4.divide;vec4.min=function(out,a,b){out[0]=Math.min(a[0],b[0]);out[1]=Math.min(a[1],b[1]);out[2]=Math.min(a[2],b[2]);out[3]=Math.min(a[3],b[3]);return out};vec4.max=function(out,a,b){out[0]=Math.max(a[0],b[0]);out[1]=Math.max(a[1],b[1]);out[2]=Math.max(a[2],b[2]);out[3]=Math.max(a[3],b[3]);return out};vec4.scale=function(out,a,b){out[0]=a[0]*b;out[1]=a[1]*b;out[2]=a[2]*b;out[3]=a[3]*b;return out};vec4.distance=function(a,b){var x=b[0]-a[0],y=b[1]-a[1],z=b[2]-a[2],w=b[3]-a[3];return Math.sqrt(x*x+y*y+z*z+w*w)};vec4.dist=vec4.distance;vec4.squaredDistance=function(a,b){var x=b[0]-a[0],y=b[1]-a[1],z=b[2]-a[2],w=b[3]-a[3];return x*x+y*y+z*z+w*w};vec4.sqrDist=vec4.squaredDistance;vec4.length=function(a){var x=a[0],y=a[1],z=a[2],w=a[3];return Math.sqrt(x*x+y*y+z*z+w*w)};vec4.len=vec4.length;vec4.squaredLength=function(a){var x=a[0],y=a[1],z=a[2],w=a[3];return x*x+y*y+z*z+w*w};vec4.sqrLen=vec4.squaredLength;vec4.negate=function(out,a){out[0]=-a[0];out[1]=-a[1];out[2]=-a[2];out[3]=-a[3];return out};vec4.normalize=function(out,a){var x=a[0],y=a[1],z=a[2],w=a[3];var len=x*x+y*y+z*z+w*w;if(len>0){len=1/Math.sqrt(len);out[0]=a[0]*len;out[1]=a[1]*len;out[2]=a[2]*len;out[3]=a[3]*len}return out};vec4.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]};vec4.lerp=function(out,a,b,t){var ax=a[0],ay=a[1],az=a[2],aw=a[3];out[0]=ax+t*(b[0]-ax);out[1]=ay+t*(b[1]-ay);out[2]=az+t*(b[2]-az);out[3]=aw+t*(b[3]-aw);return out};vec4.transformMat4=function(out,a,m){var x=a[0],y=a[1],z=a[2],w=a[3];out[0]=m[0]*x+m[4]*y+m[8]*z+m[12]*w;out[1]=m[1]*x+m[5]*y+m[9]*z+m[13]*w;out[2]=m[2]*x+m[6]*y+m[10]*z+m[14]*w;out[3]=m[3]*x+m[7]*y+m[11]*z+m[15]*w;return out};vec4.transformQuat=function(out,a,q){var x=a[0],y=a[1],z=a[2],qx=q[0],qy=q[1],qz=q[2],qw=q[3],ix=qw*x+qy*z-qz*y,iy=qw*y+qz*x-qx*z,iz=qw*z+qx*y-qy*x,iw=-qx*x-qy*y-qz*z;out[0]=ix*qw+iw*-qx+iy*-qz-iz*-qy;out[1]=iy*qw+iw*-qy+iz*-qx-ix*-qz;out[2]=iz*qw+iw*-qz+ix*-qy-iy*-qx;return out};vec4.forEach=function(){var vec=vec4.create();return function(a,stride,offset,count,fn,arg){var i,l;if(!stride){stride=4}if(!offset){offset=0}if(count){l=Math.min(count*stride+offset,a.length)}else{l=a.length}for(i=offset;i<l;i+=stride){vec[0]=a[i];vec[1]=a[i+1];vec[2]=a[i+2];vec[3]=a[i+3];fn(vec,vec,arg);a[i]=vec[0];a[i+1]=vec[1];a[i+2]=vec[2];a[i+3]=vec[3]}return a}}();vec4.str=function(a){return"vec4("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"};if(typeof exports!=="undefined"){exports.vec4=vec4}var mat2={};var mat2Identity=new Float32Array([1,0,0,1]);mat2.create=function(){var out=new GLMAT_ARRAY_TYPE(4);out[0]=1;out[1]=0;out[2]=0;out[3]=1;return out};mat2.clone=function(a){var out=new GLMAT_ARRAY_TYPE(4);out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];return out};mat2.copy=function(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];return out};mat2.identity=function(out){out[0]=1;out[1]=0;out[2]=0;out[3]=1;return out};mat2.transpose=function(out,a){if(out===a){var a1=a[1];out[1]=a[2];out[2]=a1}else{out[0]=a[0];out[1]=a[2];out[2]=a[1];out[3]=a[3]}return out};mat2.invert=function(out,a){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],det=a0*a3-a2*a1;if(!det){return null}det=1/det;out[0]=a3*det;out[1]=-a1*det;out[2]=-a2*det;out[3]=a0*det;return out};mat2.adjoint=function(out,a){var a0=a[0];out[0]=a[3];out[1]=-a[1];out[2]=-a[2];out[3]=a0;return out};mat2.determinant=function(a){return a[0]*a[3]-a[2]*a[1]};mat2.multiply=function(out,a,b){var a0=a[0],a1=a[1],a2=a[2],a3=a[3];var b0=b[0],b1=b[1],b2=b[2],b3=b[3];out[0]=a0*b0+a1*b2;out[1]=a0*b1+a1*b3;out[2]=a2*b0+a3*b2;out[3]=a2*b1+a3*b3;return out};mat2.mul=mat2.multiply;mat2.rotate=function(out,a,rad){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],s=Math.sin(rad),c=Math.cos(rad);out[0]=a0*c+a1*s;out[1]=a0*-s+a1*c;out[2]=a2*c+a3*s;out[3]=a2*-s+a3*c;return out};mat2.scale=function(out,a,v){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],v0=v[0],v1=v[1];out[0]=a0*v0;out[1]=a1*v1;out[2]=a2*v0;out[3]=a3*v1;return out};mat2.str=function(a){return"mat2("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"};if(typeof exports!=="undefined"){exports.mat2=mat2}var mat2d={};var mat2dIdentity=new Float32Array([1,0,0,1,0,0]);mat2d.create=function(){var out=new GLMAT_ARRAY_TYPE(6);out[0]=1;out[1]=0;out[2]=0;out[3]=1;out[4]=0;out[5]=0;return out};mat2d.clone=function(a){var out=new GLMAT_ARRAY_TYPE(6);out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];return out};mat2d.copy=function(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];return out};mat2d.identity=function(out){out[0]=1;out[1]=0;out[2]=0;out[3]=1;out[4]=0;out[5]=0;return out};mat2d.invert=function(out,a){var aa=a[0],ab=a[1],ac=a[2],ad=a[3],atx=a[4],aty=a[5];var det=aa*ad-ab*ac;if(!det){return null}det=1/det;out[0]=ad*det;out[1]=-ab*det;out[2]=-ac*det;out[3]=aa*det;out[4]=(ac*aty-ad*atx)*det;out[5]=(ab*atx-aa*aty)*det;return out};mat2d.determinant=function(a){return a[0]*a[3]-a[1]*a[2]};mat2d.multiply=function(out,a,b){var aa=a[0],ab=a[1],ac=a[2],ad=a[3],atx=a[4],aty=a[5],ba=b[0],bb=b[1],bc=b[2],bd=b[3],btx=b[4],bty=b[5];out[0]=aa*ba+ab*bc;out[1]=aa*bb+ab*bd;out[2]=ac*ba+ad*bc;out[3]=ac*bb+ad*bd;out[4]=ba*atx+bc*aty+btx;out[5]=bb*atx+bd*aty+bty;return out};mat2d.mul=mat2d.multiply;mat2d.rotate=function(out,a,rad){var aa=a[0],ab=a[1],ac=a[2],ad=a[3],atx=a[4],aty=a[5],st=Math.sin(rad),ct=Math.cos(rad);out[0]=aa*ct+ab*st;out[1]=-aa*st+ab*ct;out[2]=ac*ct+ad*st;out[3]=-ac*st+ct*ad;out[4]=ct*atx+st*aty;out[5]=ct*aty-st*atx;return out};mat2d.scale=function(out,a,v){var vx=v[0],vy=v[1];out[0]=a[0]*vx;out[1]=a[1]*vy;out[2]=a[2]*vx;out[3]=a[3]*vy;out[4]=a[4]*vx;out[5]=a[5]*vy;return out};mat2d.translate=function(out,a,v){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4]+v[0];out[5]=a[5]+v[1];return out};mat2d.str=function(a){return"mat2d("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+")"};if(typeof exports!=="undefined"){exports.mat2d=mat2d}var mat3={};var mat3Identity=new Float32Array([1,0,0,0,1,0,0,0,1]);mat3.create=function(){var out=new GLMAT_ARRAY_TYPE(9);out[0]=1;out[1]=0;out[2]=0;out[3]=0;out[4]=1;out[5]=0;out[6]=0;out[7]=0;out[8]=1;return out};mat3.clone=function(a){var out=new GLMAT_ARRAY_TYPE(9);out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];out[6]=a[6];out[7]=a[7];out[8]=a[8];return out};mat3.copy=function(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];out[6]=a[6];out[7]=a[7];out[8]=a[8];return out};mat3.identity=function(out){out[0]=1;out[1]=0;out[2]=0;out[3]=0;out[4]=1;out[5]=0;out[6]=0;out[7]=0;out[8]=1;return out};mat3.transpose=function(out,a){if(out===a){var a01=a[1],a02=a[2],a12=a[5];out[1]=a[3];out[2]=a[6];out[3]=a01;out[5]=a[7];out[6]=a02;out[7]=a12}else{out[0]=a[0];out[1]=a[3];out[2]=a[6];out[3]=a[1];out[4]=a[4];out[5]=a[7];out[6]=a[2];out[7]=a[5];out[8]=a[8]}return out};mat3.invert=function(out,a){var a00=a[0],a01=a[1],a02=a[2],a10=a[3],a11=a[4],a12=a[5],a20=a[6],a21=a[7],a22=a[8],b01=a22*a11-a12*a21,b11=-a22*a10+a12*a20,b21=a21*a10-a11*a20,det=a00*b01+a01*b11+a02*b21;if(!det){return null}det=1/det;out[0]=b01*det;out[1]=(-a22*a01+a02*a21)*det;out[2]=(a12*a01-a02*a11)*det;out[3]=b11*det;out[4]=(a22*a00-a02*a20)*det;out[5]=(-a12*a00+a02*a10)*det;out[6]=b21*det;out[7]=(-a21*a00+a01*a20)*det;out[8]=(a11*a00-a01*a10)*det;return out};mat3.adjoint=function(out,a){var a00=a[0],a01=a[1],a02=a[2],a10=a[3],a11=a[4],a12=a[5],a20=a[6],a21=a[7],a22=a[8];out[0]=a11*a22-a12*a21;out[1]=a02*a21-a01*a22;out[2]=a01*a12-a02*a11;out[3]=a12*a20-a10*a22;out[4]=a00*a22-a02*a20;out[5]=a02*a10-a00*a12;out[6]=a10*a21-a11*a20;out[7]=a01*a20-a00*a21;out[8]=a00*a11-a01*a10;return out};mat3.determinant=function(a){var a00=a[0],a01=a[1],a02=a[2],a10=a[3],a11=a[4],a12=a[5],a20=a[6],a21=a[7],a22=a[8];return a00*(a22*a11-a12*a21)+a01*(-a22*a10+a12*a20)+a02*(a21*a10-a11*a20)};mat3.multiply=function(out,a,b){var a00=a[0],a01=a[1],a02=a[2],a10=a[3],a11=a[4],a12=a[5],a20=a[6],a21=a[7],a22=a[8],b00=b[0],b01=b[1],b02=b[2],b10=b[3],b11=b[4],b12=b[5],b20=b[6],b21=b[7],b22=b[8];out[0]=b00*a00+b01*a10+b02*a20;out[1]=b00*a01+b01*a11+b02*a21;out[2]=b00*a02+b01*a12+b02*a22;out[3]=b10*a00+b11*a10+b12*a20;out[4]=b10*a01+b11*a11+b12*a21;out[5]=b10*a02+b11*a12+b12*a22;out[6]=b20*a00+b21*a10+b22*a20;out[7]=b20*a01+b21*a11+b22*a21;out[8]=b20*a02+b21*a12+b22*a22;return out};mat3.mul=mat3.multiply;mat3.translate=function(out,a,v){var a00=a[0],a01=a[1],a02=a[2],a10=a[3],a11=a[4],a12=a[5],a20=a[6],a21=a[7],a22=a[8],x=v[0],y=v[1];out[0]=a00;out[1]=a01;out[2]=a02;out[3]=a10;out[4]=a11;out[5]=a12;out[6]=x*a00+y*a10+a20;out[7]=x*a01+y*a11+a21;out[8]=x*a02+y*a12+a22;return out};mat3.rotate=function(out,a,rad){var a00=a[0],a01=a[1],a02=a[2],a10=a[3],a11=a[4],a12=a[5],a20=a[6],a21=a[7],a22=a[8],s=Math.sin(rad),c=Math.cos(rad);out[0]=c*a00+s*a10;out[1]=c*a01+s*a11;out[2]=c*a02+s*a12;out[3]=c*a10-s*a00;out[4]=c*a11-s*a01;out[5]=c*a12-s*a02;out[6]=a20;out[7]=a21;out[8]=a22;return out};mat3.scale=function(out,a,v){var x=v[0],y=v[2];out[0]=x*a[0];out[1]=x*a[1];out[2]=x*a[2];out[3]=y*a[3];out[4]=y*a[4];out[5]=y*a[5];out[6]=a[6];out[7]=a[7];out[8]=a[8];return out};mat3.fromMat2d=function(out,a){out[0]=a[0];out[1]=a[1];out[2]=0;out[3]=a[2];out[4]=a[3];out[5]=0;out[6]=a[4];out[7]=a[5];out[8]=1;return out};mat3.fromQuat=function(out,q){var x=q[0],y=q[1],z=q[2],w=q[3],x2=x+x,y2=y+y,z2=z+z,xx=x*x2,xy=x*y2,xz=x*z2,yy=y*y2,yz=y*z2,zz=z*z2,wx=w*x2,wy=w*y2,wz=w*z2;out[0]=1-(yy+zz);out[1]=xy+wz;out[2]=xz-wy;out[3]=xy-wz;out[4]=1-(xx+zz);out[5]=yz+wx;out[6]=xz+wy;out[7]=yz-wx;out[8]=1-(xx+yy);return out};mat3.str=function(a){return"mat3("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+")"};if(typeof exports!=="undefined"){exports.mat3=mat3}var mat4={};var mat4Identity=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);mat4.create=function(){var out=new GLMAT_ARRAY_TYPE(16);out[0]=1;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=1;out[6]=0;out[7]=0;out[8]=0;out[9]=0;out[10]=1;out[11]=0;out[12]=0;out[13]=0;out[14]=0;out[15]=1;return out};mat4.clone=function(a){var out=new GLMAT_ARRAY_TYPE(16);out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];out[6]=a[6];out[7]=a[7];out[8]=a[8];out[9]=a[9];out[10]=a[10];out[11]=a[11];out[12]=a[12];out[13]=a[13];out[14]=a[14];out[15]=a[15];return out};mat4.copy=function(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];out[6]=a[6];out[7]=a[7];out[8]=a[8];out[9]=a[9];out[10]=a[10];out[11]=a[11];out[12]=a[12];out[13]=a[13];out[14]=a[14];out[15]=a[15];return out};mat4.identity=function(out){out[0]=1;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=1;out[6]=0;out[7]=0;out[8]=0;out[9]=0;out[10]=1;out[11]=0;out[12]=0;out[13]=0;out[14]=0;out[15]=1;return out};mat4.transpose=function(out,a){if(out===a){var a01=a[1],a02=a[2],a03=a[3],a12=a[6],a13=a[7],a23=a[11];out[1]=a[4];out[2]=a[8];out[3]=a[12];out[4]=a01;out[6]=a[9];out[7]=a[13];out[8]=a02;out[9]=a12;out[11]=a[14];out[12]=a03;out[13]=a13;out[14]=a23}else{out[0]=a[0];out[1]=a[4];out[2]=a[8];out[3]=a[12];out[4]=a[1];out[5]=a[5];out[6]=a[9];out[7]=a[13];out[8]=a[2];out[9]=a[6];out[10]=a[10];out[11]=a[14];out[12]=a[3];out[13]=a[7];out[14]=a[11];out[15]=a[15]}return out};mat4.invert=function(out,a){var a00=a[0],a01=a[1],a02=a[2],a03=a[3],a10=a[4],a11=a[5],a12=a[6],a13=a[7],a20=a[8],a21=a[9],a22=a[10],a23=a[11],a30=a[12],a31=a[13],a32=a[14],a33=a[15],b00=a00*a11-a01*a10,b01=a00*a12-a02*a10,b02=a00*a13-a03*a10,b03=a01*a12-a02*a11,b04=a01*a13-a03*a11,b05=a02*a13-a03*a12,b06=a20*a31-a21*a30,b07=a20*a32-a22*a30,b08=a20*a33-a23*a30,b09=a21*a32-a22*a31,b10=a21*a33-a23*a31,b11=a22*a33-a23*a32,det=b00*b11-b01*b10+b02*b09+b03*b08-b04*b07+b05*b06;if(!det){return null}det=1/det;out[0]=(a11*b11-a12*b10+a13*b09)*det;out[1]=(a02*b10-a01*b11-a03*b09)*det;out[2]=(a31*b05-a32*b04+a33*b03)*det;out[3]=(a22*b04-a21*b05-a23*b03)*det;out[4]=(a12*b08-a10*b11-a13*b07)*det;out[5]=(a00*b11-a02*b08+a03*b07)*det;out[6]=(a32*b02-a30*b05-a33*b01)*det;out[7]=(a20*b05-a22*b02+a23*b01)*det;out[8]=(a10*b10-a11*b08+a13*b06)*det;out[9]=(a01*b08-a00*b10-a03*b06)*det;out[10]=(a30*b04-a31*b02+a33*b00)*det;out[11]=(a21*b02-a20*b04-a23*b00)*det;out[12]=(a11*b07-a10*b09-a12*b06)*det;out[13]=(a00*b09-a01*b07+a02*b06)*det;out[14]=(a31*b01-a30*b03-a32*b00)*det;out[15]=(a20*b03-a21*b01+a22*b00)*det;return out};mat4.adjoint=function(out,a){var a00=a[0],a01=a[1],a02=a[2],a03=a[3],a10=a[4],a11=a[5],a12=a[6],a13=a[7],a20=a[8],a21=a[9],a22=a[10],a23=a[11],a30=a[12],a31=a[13],a32=a[14],a33=a[15];out[0]=a11*(a22*a33-a23*a32)-a21*(a12*a33-a13*a32)+a31*(a12*a23-a13*a22);out[1]=-(a01*(a22*a33-a23*a32)-a21*(a02*a33-a03*a32)+a31*(a02*a23-a03*a22));out[2]=a01*(a12*a33-a13*a32)-a11*(a02*a33-a03*a32)+a31*(a02*a13-a03*a12);out[3]=-(a01*(a12*a23-a13*a22)-a11*(a02*a23-a03*a22)+a21*(a02*a13-a03*a12));out[4]=-(a10*(a22*a33-a23*a32)-a20*(a12*a33-a13*a32)+a30*(a12*a23-a13*a22));out[5]=a00*(a22*a33-a23*a32)-a20*(a02*a33-a03*a32)+a30*(a02*a23-a03*a22);out[6]=-(a00*(a12*a33-a13*a32)-a10*(a02*a33-a03*a32)+a30*(a02*a13-a03*a12));out[7]=a00*(a12*a23-a13*a22)-a10*(a02*a23-a03*a22)+a20*(a02*a13-a03*a12);out[8]=a10*(a21*a33-a23*a31)-a20*(a11*a33-a13*a31)+a30*(a11*a23-a13*a21);out[9]=-(a00*(a21*a33-a23*a31)-a20*(a01*a33-a03*a31)+a30*(a01*a23-a03*a21));out[10]=a00*(a11*a33-a13*a31)-a10*(a01*a33-a03*a31)+a30*(a01*a13-a03*a11);out[11]=-(a00*(a11*a23-a13*a21)-a10*(a01*a23-a03*a21)+a20*(a01*a13-a03*a11));out[12]=-(a10*(a21*a32-a22*a31)-a20*(a11*a32-a12*a31)+a30*(a11*a22-a12*a21));out[13]=a00*(a21*a32-a22*a31)-a20*(a01*a32-a02*a31)+a30*(a01*a22-a02*a21);out[14]=-(a00*(a11*a32-a12*a31)-a10*(a01*a32-a02*a31)+a30*(a01*a12-a02*a11)); | |
out[15]=a00*(a11*a22-a12*a21)-a10*(a01*a22-a02*a21)+a20*(a01*a12-a02*a11);return out};mat4.determinant=function(a){var a00=a[0],a01=a[1],a02=a[2],a03=a[3],a10=a[4],a11=a[5],a12=a[6],a13=a[7],a20=a[8],a21=a[9],a22=a[10],a23=a[11],a30=a[12],a31=a[13],a32=a[14],a33=a[15],b00=a00*a11-a01*a10,b01=a00*a12-a02*a10,b02=a00*a13-a03*a10,b03=a01*a12-a02*a11,b04=a01*a13-a03*a11,b05=a02*a13-a03*a12,b06=a20*a31-a21*a30,b07=a20*a32-a22*a30,b08=a20*a33-a23*a30,b09=a21*a32-a22*a31,b10=a21*a33-a23*a31,b11=a22*a33-a23*a32;return b00*b11-b01*b10+b02*b09+b03*b08-b04*b07+b05*b06};mat4.multiply=function(out,a,b){var a00=a[0],a01=a[1],a02=a[2],a03=a[3],a10=a[4],a11=a[5],a12=a[6],a13=a[7],a20=a[8],a21=a[9],a22=a[10],a23=a[11],a30=a[12],a31=a[13],a32=a[14],a33=a[15];var b0=b[0],b1=b[1],b2=b[2],b3=b[3];out[0]=b0*a00+b1*a10+b2*a20+b3*a30;out[1]=b0*a01+b1*a11+b2*a21+b3*a31;out[2]=b0*a02+b1*a12+b2*a22+b3*a32;out[3]=b0*a03+b1*a13+b2*a23+b3*a33;b0=b[4];b1=b[5];b2=b[6];b3=b[7];out[4]=b0*a00+b1*a10+b2*a20+b3*a30;out[5]=b0*a01+b1*a11+b2*a21+b3*a31;out[6]=b0*a02+b1*a12+b2*a22+b3*a32;out[7]=b0*a03+b1*a13+b2*a23+b3*a33;b0=b[8];b1=b[9];b2=b[10];b3=b[11];out[8]=b0*a00+b1*a10+b2*a20+b3*a30;out[9]=b0*a01+b1*a11+b2*a21+b3*a31;out[10]=b0*a02+b1*a12+b2*a22+b3*a32;out[11]=b0*a03+b1*a13+b2*a23+b3*a33;b0=b[12];b1=b[13];b2=b[14];b3=b[15];out[12]=b0*a00+b1*a10+b2*a20+b3*a30;out[13]=b0*a01+b1*a11+b2*a21+b3*a31;out[14]=b0*a02+b1*a12+b2*a22+b3*a32;out[15]=b0*a03+b1*a13+b2*a23+b3*a33;return out};mat4.mul=mat4.multiply;mat4.translate=function(out,a,v){var x=v[0],y=v[1],z=v[2],a00,a01,a02,a03,a10,a11,a12,a13,a20,a21,a22,a23;if(a===out){out[12]=a[0]*x+a[4]*y+a[8]*z+a[12];out[13]=a[1]*x+a[5]*y+a[9]*z+a[13];out[14]=a[2]*x+a[6]*y+a[10]*z+a[14];out[15]=a[3]*x+a[7]*y+a[11]*z+a[15]}else{a00=a[0];a01=a[1];a02=a[2];a03=a[3];a10=a[4];a11=a[5];a12=a[6];a13=a[7];a20=a[8];a21=a[9];a22=a[10];a23=a[11];out[0]=a00;out[1]=a01;out[2]=a02;out[3]=a03;out[4]=a10;out[5]=a11;out[6]=a12;out[7]=a13;out[8]=a20;out[9]=a21;out[10]=a22;out[11]=a23;out[12]=a00*x+a10*y+a20*z+a[12];out[13]=a01*x+a11*y+a21*z+a[13];out[14]=a02*x+a12*y+a22*z+a[14];out[15]=a03*x+a13*y+a23*z+a[15]}return out};mat4.scale=function(out,a,v){var x=v[0],y=v[1],z=v[2];out[0]=a[0]*x;out[1]=a[1]*x;out[2]=a[2]*x;out[3]=a[3]*x;out[4]=a[4]*y;out[5]=a[5]*y;out[6]=a[6]*y;out[7]=a[7]*y;out[8]=a[8]*z;out[9]=a[9]*z;out[10]=a[10]*z;out[11]=a[11]*z;out[12]=a[12];out[13]=a[13];out[14]=a[14];out[15]=a[15];return out};mat4.rotate=function(out,a,rad,axis){var x=axis[0],y=axis[1],z=axis[2],len=Math.sqrt(x*x+y*y+z*z),s,c,t,a00,a01,a02,a03,a10,a11,a12,a13,a20,a21,a22,a23,b00,b01,b02,b10,b11,b12,b20,b21,b22;if(Math.abs(len)<GLMAT_EPSILON){return null}len=1/len;x*=len;y*=len;z*=len;s=Math.sin(rad);c=Math.cos(rad);t=1-c;a00=a[0];a01=a[1];a02=a[2];a03=a[3];a10=a[4];a11=a[5];a12=a[6];a13=a[7];a20=a[8];a21=a[9];a22=a[10];a23=a[11];b00=x*x*t+c;b01=y*x*t+z*s;b02=z*x*t-y*s;b10=x*y*t-z*s;b11=y*y*t+c;b12=z*y*t+x*s;b20=x*z*t+y*s;b21=y*z*t-x*s;b22=z*z*t+c;out[0]=a00*b00+a10*b01+a20*b02;out[1]=a01*b00+a11*b01+a21*b02;out[2]=a02*b00+a12*b01+a22*b02;out[3]=a03*b00+a13*b01+a23*b02;out[4]=a00*b10+a10*b11+a20*b12;out[5]=a01*b10+a11*b11+a21*b12;out[6]=a02*b10+a12*b11+a22*b12;out[7]=a03*b10+a13*b11+a23*b12;out[8]=a00*b20+a10*b21+a20*b22;out[9]=a01*b20+a11*b21+a21*b22;out[10]=a02*b20+a12*b21+a22*b22;out[11]=a03*b20+a13*b21+a23*b22;if(a!==out){out[12]=a[12];out[13]=a[13];out[14]=a[14];out[15]=a[15]}return out};mat4.rotateX=function(out,a,rad){var s=Math.sin(rad),c=Math.cos(rad),a10=a[4],a11=a[5],a12=a[6],a13=a[7],a20=a[8],a21=a[9],a22=a[10],a23=a[11];if(a!==out){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[12]=a[12];out[13]=a[13];out[14]=a[14];out[15]=a[15]}out[4]=a10*c+a20*s;out[5]=a11*c+a21*s;out[6]=a12*c+a22*s;out[7]=a13*c+a23*s;out[8]=a20*c-a10*s;out[9]=a21*c-a11*s;out[10]=a22*c-a12*s;out[11]=a23*c-a13*s;return out};mat4.rotateY=function(out,a,rad){var s=Math.sin(rad),c=Math.cos(rad),a00=a[0],a01=a[1],a02=a[2],a03=a[3],a20=a[8],a21=a[9],a22=a[10],a23=a[11];if(a!==out){out[4]=a[4];out[5]=a[5];out[6]=a[6];out[7]=a[7];out[12]=a[12];out[13]=a[13];out[14]=a[14];out[15]=a[15]}out[0]=a00*c-a20*s;out[1]=a01*c-a21*s;out[2]=a02*c-a22*s;out[3]=a03*c-a23*s;out[8]=a00*s+a20*c;out[9]=a01*s+a21*c;out[10]=a02*s+a22*c;out[11]=a03*s+a23*c;return out};mat4.rotateZ=function(out,a,rad){var s=Math.sin(rad),c=Math.cos(rad),a00=a[0],a01=a[1],a02=a[2],a03=a[3],a10=a[4],a11=a[5],a12=a[6],a13=a[7];if(a!==out){out[8]=a[8];out[9]=a[9];out[10]=a[10];out[11]=a[11];out[12]=a[12];out[13]=a[13];out[14]=a[14];out[15]=a[15]}out[0]=a00*c+a10*s;out[1]=a01*c+a11*s;out[2]=a02*c+a12*s;out[3]=a03*c+a13*s;out[4]=a10*c-a00*s;out[5]=a11*c-a01*s;out[6]=a12*c-a02*s;out[7]=a13*c-a03*s;return out};mat4.fromRotationTranslation=function(out,q,v){var x=q[0],y=q[1],z=q[2],w=q[3],x2=x+x,y2=y+y,z2=z+z,xx=x*x2,xy=x*y2,xz=x*z2,yy=y*y2,yz=y*z2,zz=z*z2,wx=w*x2,wy=w*y2,wz=w*z2;out[0]=1-(yy+zz);out[1]=xy+wz;out[2]=xz-wy;out[3]=0;out[4]=xy-wz;out[5]=1-(xx+zz);out[6]=yz+wx;out[7]=0;out[8]=xz+wy;out[9]=yz-wx;out[10]=1-(xx+yy);out[11]=0;out[12]=v[0];out[13]=v[1];out[14]=v[2];out[15]=1;return out};mat4.fromQuat=function(out,q){var x=q[0],y=q[1],z=q[2],w=q[3],x2=x+x,y2=y+y,z2=z+z,xx=x*x2,xy=x*y2,xz=x*z2,yy=y*y2,yz=y*z2,zz=z*z2,wx=w*x2,wy=w*y2,wz=w*z2;out[0]=1-(yy+zz);out[1]=xy+wz;out[2]=xz-wy;out[3]=0;out[4]=xy-wz;out[5]=1-(xx+zz);out[6]=yz+wx;out[7]=0;out[8]=xz+wy;out[9]=yz-wx;out[10]=1-(xx+yy);out[11]=0;out[12]=0;out[13]=0;out[14]=0;out[15]=1;return out};mat4.frustum=function(out,left,right,bottom,top,near,far){var rl=1/(right-left),tb=1/(top-bottom),nf=1/(near-far);out[0]=near*2*rl;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=near*2*tb;out[6]=0;out[7]=0;out[8]=(right+left)*rl;out[9]=(top+bottom)*tb;out[10]=(far+near)*nf;out[11]=-1;out[12]=0;out[13]=0;out[14]=far*near*2*nf;out[15]=0;return out};mat4.perspective=function(out,fovy,aspect,near,far){var f=1/Math.tan(fovy/2),nf=1/(near-far);out[0]=f/aspect;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=f;out[6]=0;out[7]=0;out[8]=0;out[9]=0;out[10]=(far+near)*nf;out[11]=-1;out[12]=0;out[13]=0;out[14]=2*far*near*nf;out[15]=0;return out};mat4.ortho=function(out,left,right,bottom,top,near,far){var lr=1/(left-right),bt=1/(bottom-top),nf=1/(near-far);out[0]=-2*lr;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=-2*bt;out[6]=0;out[7]=0;out[8]=0;out[9]=0;out[10]=2*nf;out[11]=0;out[12]=(left+right)*lr;out[13]=(top+bottom)*bt;out[14]=(far+near)*nf;out[15]=1;return out};mat4.lookAt=function(out,eye,center,up){var x0,x1,x2,y0,y1,y2,z0,z1,z2,len,eyex=eye[0],eyey=eye[1],eyez=eye[2],upx=up[0],upy=up[1],upz=up[2],centerx=center[0],centery=center[1],centerz=center[2];if(Math.abs(eyex-centerx)<GLMAT_EPSILON&&Math.abs(eyey-centery)<GLMAT_EPSILON&&Math.abs(eyez-centerz)<GLMAT_EPSILON){return mat4.identity(out)}z0=eyex-centerx;z1=eyey-centery;z2=eyez-centerz;len=1/Math.sqrt(z0*z0+z1*z1+z2*z2);z0*=len;z1*=len;z2*=len;x0=upy*z2-upz*z1;x1=upz*z0-upx*z2;x2=upx*z1-upy*z0;len=Math.sqrt(x0*x0+x1*x1+x2*x2);if(!len){x0=0;x1=0;x2=0}else{len=1/len;x0*=len;x1*=len;x2*=len}y0=z1*x2-z2*x1;y1=z2*x0-z0*x2;y2=z0*x1-z1*x0;len=Math.sqrt(y0*y0+y1*y1+y2*y2);if(!len){y0=0;y1=0;y2=0}else{len=1/len;y0*=len;y1*=len;y2*=len}out[0]=x0;out[1]=y0;out[2]=z0;out[3]=0;out[4]=x1;out[5]=y1;out[6]=z1;out[7]=0;out[8]=x2;out[9]=y2;out[10]=z2;out[11]=0;out[12]=-(x0*eyex+x1*eyey+x2*eyez);out[13]=-(y0*eyex+y1*eyey+y2*eyez);out[14]=-(z0*eyex+z1*eyey+z2*eyez);out[15]=1;return out};mat4.str=function(a){return"mat4("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+", "+a[9]+", "+a[10]+", "+a[11]+", "+a[12]+", "+a[13]+", "+a[14]+", "+a[15]+")"};if(typeof exports!=="undefined"){exports.mat4=mat4}var quat={};var quatIdentity=new Float32Array([0,0,0,1]);quat.create=function(){var out=new GLMAT_ARRAY_TYPE(4);out[0]=0;out[1]=0;out[2]=0;out[3]=1;return out};quat.clone=vec4.clone;quat.fromValues=vec4.fromValues;quat.copy=vec4.copy;quat.set=vec4.set;quat.identity=function(out){out[0]=0;out[1]=0;out[2]=0;out[3]=1;return out};quat.setAxisAngle=function(out,axis,rad){rad=rad*.5;var s=Math.sin(rad);out[0]=s*axis[0];out[1]=s*axis[1];out[2]=s*axis[2];out[3]=Math.cos(rad);return out};quat.add=vec4.add;quat.multiply=function(out,a,b){var ax=a[0],ay=a[1],az=a[2],aw=a[3],bx=b[0],by=b[1],bz=b[2],bw=b[3];out[0]=ax*bw+aw*bx+ay*bz-az*by;out[1]=ay*bw+aw*by+az*bx-ax*bz;out[2]=az*bw+aw*bz+ax*by-ay*bx;out[3]=aw*bw-ax*bx-ay*by-az*bz;return out};quat.mul=quat.multiply;quat.scale=vec4.scale;quat.rotateX=function(out,a,rad){rad*=.5;var ax=a[0],ay=a[1],az=a[2],aw=a[3],bx=Math.sin(rad),bw=Math.cos(rad);out[0]=ax*bw+aw*bx;out[1]=ay*bw+az*bx;out[2]=az*bw-ay*bx;out[3]=aw*bw-ax*bx;return out};quat.rotateY=function(out,a,rad){rad*=.5;var ax=a[0],ay=a[1],az=a[2],aw=a[3],by=Math.sin(rad),bw=Math.cos(rad);out[0]=ax*bw-az*by;out[1]=ay*bw+aw*by;out[2]=az*bw+ax*by;out[3]=aw*bw-ay*by;return out};quat.rotateZ=function(out,a,rad){rad*=.5;var ax=a[0],ay=a[1],az=a[2],aw=a[3],bz=Math.sin(rad),bw=Math.cos(rad);out[0]=ax*bw+ay*bz;out[1]=ay*bw-ax*bz;out[2]=az*bw+aw*bz;out[3]=aw*bw-az*bz;return out};quat.calculateW=function(out,a){var x=a[0],y=a[1],z=a[2];out[0]=x;out[1]=y;out[2]=z;out[3]=-Math.sqrt(Math.abs(1-x*x-y*y-z*z));return out};quat.dot=vec4.dot;quat.lerp=vec4.lerp;quat.slerp=function(out,a,b,t){var ax=a[0],ay=a[1],az=a[2],aw=a[3],bx=b[0],by=b[1],bz=b[2],bw=b[3];var cosHalfTheta=ax*bx+ay*by+az*bz+aw*bw,halfTheta,sinHalfTheta,ratioA,ratioB;if(Math.abs(cosHalfTheta)>=1){if(out!==a){out[0]=ax;out[1]=ay;out[2]=az;out[3]=aw}return out}halfTheta=Math.acos(cosHalfTheta);sinHalfTheta=Math.sqrt(1-cosHalfTheta*cosHalfTheta);if(Math.abs(sinHalfTheta)<.001){out[0]=ax*.5+bx*.5;out[1]=ay*.5+by*.5;out[2]=az*.5+bz*.5;out[3]=aw*.5+bw*.5;return out}ratioA=Math.sin((1-t)*halfTheta)/sinHalfTheta;ratioB=Math.sin(t*halfTheta)/sinHalfTheta;out[0]=ax*ratioA+bx*ratioB;out[1]=ay*ratioA+by*ratioB;out[2]=az*ratioA+bz*ratioB;out[3]=aw*ratioA+bw*ratioB;return out};quat.invert=function(out,a){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],dot=a0*a0+a1*a1+a2*a2+a3*a3,invDot=dot?1/dot:0;out[0]=-a0*invDot;out[1]=-a1*invDot;out[2]=-a2*invDot;out[3]=a3*invDot;return out};quat.conjugate=function(out,a){out[0]=-a[0];out[1]=-a[1];out[2]=-a[2];out[3]=a[3];return out};quat.length=vec4.length;quat.len=quat.length;quat.squaredLength=vec4.squaredLength;quat.sqrLen=quat.squaredLength;quat.normalize=vec4.normalize;quat.fromMat3=function(){var s_iNext=[1,2,0];return function(out,m){var fTrace=m[0]+m[4]+m[8];var fRoot;if(fTrace>0){fRoot=Math.sqrt(fTrace+1);out[3]=.5*fRoot;fRoot=.5/fRoot;out[0]=(m[7]-m[5])*fRoot;out[1]=(m[2]-m[6])*fRoot;out[2]=(m[3]-m[1])*fRoot}else{var i=0;if(m[4]>m[0])i=1;if(m[8]>m[i*3+i])i=2;var j=s_iNext[i];var k=s_iNext[j];fRoot=Math.sqrt(m[i*3+i]-m[j*3+j]-m[k*3+k]+1);out[i]=.5*fRoot;fRoot=.5/fRoot;out[3]=(m[k*3+j]-m[j*3+k])*fRoot;out[j]=(m[j*3+i]+m[i*3+j])*fRoot;out[k]=(m[k*3+i]+m[i*3+k])*fRoot}return out}}();quat.str=function(a){return"quat("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"};if(typeof exports!=="undefined"){exports.quat=quat}})(shim.exports)})()},{}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){(function(global){"use strict";var numeric=typeof exports==="undefined"?function numeric(){}:exports;if(typeof global!=="undefined"){global.numeric=numeric}numeric.version="1.2.6";numeric.bench=function bench(f,interval){var t1,t2,n,i;if(typeof interval==="undefined"){interval=15}n=.5;t1=new Date;while(1){n*=2;for(i=n;i>3;i-=4){f();f();f();f()}while(i>0){f();i--}t2=new Date;if(t2-t1>interval)break}for(i=n;i>3;i-=4){f();f();f();f()}while(i>0){f();i--}t2=new Date;return 1e3*(3*n-1)/(t2-t1)};numeric._myIndexOf=function _myIndexOf(w){var n=this.length,k;for(k=0;k<n;++k)if(this[k]===w)return k;return-1};numeric.myIndexOf=Array.prototype.indexOf?Array.prototype.indexOf:numeric._myIndexOf;numeric.Function=Function;numeric.precision=4;numeric.largeArray=50;numeric.prettyPrint=function prettyPrint(x){function fmtnum(x){if(x===0){return"0"}if(isNaN(x)){return"NaN"}if(x<0){return"-"+fmtnum(-x)}if(isFinite(x)){var scale=Math.floor(Math.log(x)/Math.log(10));var normalized=x/Math.pow(10,scale);var basic=normalized.toPrecision(numeric.precision);if(parseFloat(basic)===10){scale++;normalized=1;basic=normalized.toPrecision(numeric.precision)}return parseFloat(basic).toString()+"e"+scale.toString()}return"Infinity"}var ret=[];function foo(x){var k;if(typeof x==="undefined"){ret.push(Array(numeric.precision+8).join(" "));return false}if(typeof x==="string"){ret.push('"'+x+'"');return false}if(typeof x==="boolean"){ret.push(x.toString());return false}if(typeof x==="number"){var a=fmtnum(x);var b=x.toPrecision(numeric.precision);var c=parseFloat(x.toString()).toString();var d=[a,b,c,parseFloat(b).toString(),parseFloat(c).toString()];for(k=1;k<d.length;k++){if(d[k].length<a.length)a=d[k]}ret.push(Array(numeric.precision+8-a.length).join(" ")+a);return false}if(x===null){ret.push("null");return false}if(typeof x==="function"){ret.push(x.toString());var flag=false;for(k in x){if(x.hasOwnProperty(k)){if(flag)ret.push(",\n");else ret.push("\n{");flag=true;ret.push(k);ret.push(": \n");foo(x[k])}}if(flag)ret.push("}\n");return true}if(x instanceof Array){if(x.length>numeric.largeArray){ret.push("...Large Array...");return true}var flag=false;ret.push("[");for(k=0;k<x.length;k++){if(k>0){ret.push(",");if(flag)ret.push("\n ")}flag=foo(x[k])}ret.push("]");return true}ret.push("{");var flag=false;for(k in x){if(x.hasOwnProperty(k)){if(flag)ret.push(",\n");flag=true;ret.push(k);ret.push(": \n");foo(x[k])}}ret.push("}");return true}foo(x);return ret.join("")};numeric.parseDate=function parseDate(d){function foo(d){if(typeof d==="string"){return Date.parse(d.replace(/-/g,"/"))}if(!(d instanceof Array)){throw new Error("parseDate: parameter must be arrays of strings")}var ret=[],k;for(k=0;k<d.length;k++){ret[k]=foo(d[k])}return ret}return foo(d)};numeric.parseFloat=function parseFloat_(d){function foo(d){if(typeof d==="string"){return parseFloat(d)}if(!(d instanceof Array)){throw new Error("parseFloat: parameter must be arrays of strings")}var ret=[],k;for(k=0;k<d.length;k++){ret[k]=foo(d[k])}return ret}return foo(d)};numeric.parseCSV=function parseCSV(t){var foo=t.split("\n");var j,k;var ret=[];var pat=/(([^'",]*)|('[^']*')|("[^"]*")),/g;var patnum=/^\s*(([+-]?[0-9]+(\.[0-9]*)?(e[+-]?[0-9]+)?)|([+-]?[0-9]*(\.[0-9]+)?(e[+-]?[0-9]+)?))\s*$/;var stripper=function(n){return n.substr(0,n.length-1)};var count=0;for(k=0;k<foo.length;k++){var bar=(foo[k]+",").match(pat),baz;if(bar.length>0){ret[count]=[];for(j=0;j<bar.length;j++){baz=stripper(bar[j]);if(patnum.test(baz)){ret[count][j]=parseFloat(baz)}else ret[count][j]=baz}count++}}return ret};numeric.toCSV=function toCSV(A){var s=numeric.dim(A);var i,j,m,n,row,ret;m=s[0];n=s[1];ret=[];for(i=0;i<m;i++){row=[];for(j=0;j<m;j++){row[j]=A[i][j].toString()}ret[i]=row.join(", ")}return ret.join("\n")+"\n"};numeric.getURL=function getURL(url){var client=new XMLHttpRequest;client.open("GET",url,false);client.send();return client};numeric.imageURL=function imageURL(img){function base64(A){var n=A.length,i,x,y,z,p,q,r,s;var key="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var ret="";for(i=0;i<n;i+=3){x=A[i];y=A[i+1];z=A[i+2];p=x>>2;q=((x&3)<<4)+(y>>4);r=((y&15)<<2)+(z>>6);s=z&63;if(i+1>=n){r=s=64}else if(i+2>=n){s=64}ret+=key.charAt(p)+key.charAt(q)+key.charAt(r)+key.charAt(s)}return ret}function crc32Array(a,from,to){if(typeof from==="undefined"){from=0}if(typeof to==="undefined"){to=a.length}var table=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];var crc=-1,y=0,n=a.length,i;for(i=from;i<to;i++){y=(crc^a[i])&255;crc=crc>>>8^table[y]}return crc^-1}var h=img[0].length,w=img[0][0].length,s1,s2,next,k,length,a,b,i,j,adler32,crc32;var stream=[137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,w>>24&255,w>>16&255,w>>8&255,w&255,h>>24&255,h>>16&255,h>>8&255,h&255,8,2,0,0,0,-1,-2,-3,-4,-5,-6,-7,-8,73,68,65,84,8,29];crc32=crc32Array(stream,12,29);stream[29]=crc32>>24&255;stream[30]=crc32>>16&255;stream[31]=crc32>>8&255;stream[32]=crc32&255;s1=1;s2=0;for(i=0;i<h;i++){if(i<h-1){stream.push(0)}else{stream.push(1)}a=3*w+1+(i===0)&255;b=3*w+1+(i===0)>>8&255;stream.push(a);stream.push(b);stream.push(~a&255);stream.push(~b&255);if(i===0)stream.push(0);for(j=0;j<w;j++){for(k=0;k<3;k++){a=img[k][i][j];if(a>255)a=255;else if(a<0)a=0;else a=Math.round(a);s1=(s1+a)%65521;s2=(s2+s1)%65521;stream.push(a)}}stream.push(0)}adler32=(s2<<16)+s1;stream.push(adler32>>24&255);stream.push(adler32>>16&255);stream.push(adler32>>8&255);stream.push(adler32&255);length=stream.length-41;stream[33]=length>>24&255;stream[34]=length>>16&255;stream[35]=length>>8&255;stream[36]=length&255;crc32=crc32Array(stream,37);stream.push(crc32>>24&255);stream.push(crc32>>16&255);stream.push(crc32>>8&255);stream.push(crc32&255);stream.push(0);stream.push(0);stream.push(0);stream.push(0);stream.push(73);stream.push(69);stream.push(78);stream.push(68);stream.push(174);stream.push(66);stream.push(96);stream.push(130);return"data:image/png;base64,"+base64(stream)};numeric._dim=function _dim(x){var ret=[];while(typeof x==="object"){ret.push(x.length);x=x[0]}return ret};numeric.dim=function dim(x){var y,z;if(typeof x==="object"){y=x[0];if(typeof y==="object"){z=y[0];if(typeof z==="object"){return numeric._dim(x)}return[x.length,y.length]}return[x.length]}return[]};numeric.mapreduce=function mapreduce(body,init){return Function("x","accum","_s","_k",'if(typeof accum === "undefined") accum = '+init+";\n"+'if(typeof x === "number") { var xi = x; '+body+"; return accum; }\n"+'if(typeof _s === "undefined") _s = numeric.dim(x);\n'+'if(typeof _k === "undefined") _k = 0;\n'+"var _n = _s[_k];\n"+"var i,xi;\n"+"if(_k < _s.length-1) {\n"+" for(i=_n-1;i>=0;i--) {\n"+" accum = arguments.callee(x[i],accum,_s,_k+1);\n"+" }"+" return accum;\n"+"}\n"+"for(i=_n-1;i>=1;i-=2) { \n"+" xi = x[i];\n"+" "+body+";\n"+" xi = x[i-1];\n"+" "+body+";\n"+"}\n"+"if(i === 0) {\n"+" xi = x[i];\n"+" "+body+"\n"+"}\n"+"return accum;")};numeric.mapreduce2=function mapreduce2(body,setup){return Function("x","var n = x.length;\n"+"var i,xi;\n"+setup+";\n"+"for(i=n-1;i!==-1;--i) { \n"+" xi = x[i];\n"+" "+body+";\n"+"}\n"+"return accum;")};numeric.same=function same(x,y){var i,n;if(!(x instanceof Array)||!(y instanceof Array)){return false}n=x.length;if(n!==y.length){return false}for(i=0;i<n;i++){if(x[i]===y[i]){continue}if(typeof x[i]==="object"){if(!same(x[i],y[i]))return false}else{return false}}return true};numeric.rep=function rep(s,v,k){if(typeof k==="undefined"){k=0}var n=s[k],ret=Array(n),i;if(k===s.length-1){for(i=n-2;i>=0;i-=2){ret[i+1]=v;ret[i]=v}if(i===-1){ret[0]=v}return ret}for(i=n-1;i>=0;i--){ret[i]=numeric.rep(s,v,k+1)}return ret};numeric.dotMMsmall=function dotMMsmall(x,y){var i,j,k,p,q,r,ret,foo,bar,woo,i0,k0,p0,r0;p=x.length;q=y.length;r=y[0].length;ret=Array(p);for(i=p-1;i>=0;i--){foo=Array(r);bar=x[i];for(k=r-1;k>=0;k--){woo=bar[q-1]*y[q-1][k];for(j=q-2;j>=1;j-=2){i0=j-1;woo+=bar[j]*y[j][k]+bar[i0]*y[i0][k]}if(j===0){woo+=bar[0]*y[0][k]}foo[k]=woo}ret[i]=foo}return ret};numeric._getCol=function _getCol(A,j,x){var n=A.length,i;for(i=n-1;i>0;--i){x[i]=A[i][j];--i;x[i]=A[i][j]}if(i===0)x[0]=A[0][j]};numeric.dotMMbig=function dotMMbig(x,y){var gc=numeric._getCol,p=y.length,v=Array(p);var m=x.length,n=y[0].length,A=new Array(m),xj;var VV=numeric.dotVV;var i,j,k,z;--p;--m;for(i=m;i!==-1;--i)A[i]=Array(n);--n;for(i=n;i!==-1;--i){gc(y,i,v);for(j=m;j!==-1;--j){z=0;xj=x[j];A[j][i]=VV(xj,v)}}return A};numeric.dotMV=function dotMV(x,y){var p=x.length,q=y.length,i;var ret=Array(p),dotVV=numeric.dotVV;for(i=p-1;i>=0;i--){ret[i]=dotVV(x[i],y)}return ret};numeric.dotVM=function dotVM(x,y){var i,j,k,p,q,r,ret,foo,bar,woo,i0,k0,p0,r0,s1,s2,s3,baz,accum;p=x.length;q=y[0].length;ret=Array(q);for(k=q-1;k>=0;k--){woo=x[p-1]*y[p-1][k];for(j=p-2;j>=1;j-=2){i0=j-1;woo+=x[j]*y[j][k]+x[i0]*y[i0][k]}if(j===0){woo+=x[0]*y[0][k]}ret[k]=woo}return ret};numeric.dotVV=function dotVV(x,y){var i,n=x.length,i1,ret=x[n-1]*y[n-1];for(i=n-2;i>=1;i-=2){i1=i-1;ret+=x[i]*y[i]+x[i1]*y[i1]}if(i===0){ret+=x[0]*y[0]}return ret};numeric.dot=function dot(x,y){var d=numeric.dim;switch(d(x).length*1e3+d(y).length){case 2002:if(y.length<10)return numeric.dotMMsmall(x,y);else return numeric.dotMMbig(x,y);case 2001:return numeric.dotMV(x,y);case 1002:return numeric.dotVM(x,y);case 1001:return numeric.dotVV(x,y);case 1e3:return numeric.mulVS(x,y);case 1:return numeric.mulSV(x,y);case 0:return x*y;default:throw new Error("numeric.dot only works on vectors and matrices")}};numeric.diag=function diag(d){var i,i1,j,n=d.length,A=Array(n),Ai;for(i=n-1;i>=0;i--){Ai=Array(n);i1=i+2;for(j=n-1;j>=i1;j-=2){Ai[j]=0;Ai[j-1]=0}if(j>i){Ai[j]=0}Ai[i]=d[i];for(j=i-1;j>=1;j-=2){Ai[j]=0;Ai[j-1]=0}if(j===0){Ai[0]=0}A[i]=Ai}return A};numeric.getDiag=function(A){var n=Math.min(A.length,A[0].length),i,ret=Array(n);for(i=n-1;i>=1;--i){ret[i]=A[i][i];--i;ret[i]=A[i][i]}if(i===0){ret[0]=A[0][0]}return ret};numeric.identity=function identity(n){return numeric.diag(numeric.rep([n],1))};numeric.pointwise=function pointwise(params,body,setup){if(typeof setup==="undefined"){setup=""}var fun=[];var k;var avec=/\[i\]$/,p,thevec="";var haveret=false;for(k=0;k<params.length;k++){if(avec.test(params[k])){p=params[k].substring(0,params[k].length-3);thevec=p}else{p=params[k]}if(p==="ret")haveret=true;fun.push(p)}fun[params.length]="_s";fun[params.length+1]="_k";fun[params.length+2]='if(typeof _s === "undefined") _s = numeric.dim('+thevec+");\n"+'if(typeof _k === "undefined") _k = 0;\n'+"var _n = _s[_k];\n"+"var i"+(haveret?"":", ret = Array(_n)")+";\n"+"if(_k < _s.length-1) {\n"+" for(i=_n-1;i>=0;i--) ret[i] = arguments.callee("+params.join(",")+",_s,_k+1);\n"+" return ret;\n"+"}\n"+setup+"\n"+"for(i=_n-1;i!==-1;--i) {\n"+" "+body+"\n"+"}\n"+"return ret;";return Function.apply(null,fun)};numeric.pointwise2=function pointwise2(params,body,setup){if(typeof setup==="undefined"){setup=""}var fun=[];var k;var avec=/\[i\]$/,p,thevec="";var haveret=false;for(k=0;k<params.length;k++){if(avec.test(params[k])){p=params[k].substring(0,params[k].length-3);thevec=p}else{p=params[k]}if(p==="ret")haveret=true;fun.push(p)}fun[params.length]="var _n = "+thevec+".length;\n"+"var i"+(haveret?"":", ret = Array(_n)")+";\n"+setup+"\n"+"for(i=_n-1;i!==-1;--i) {\n"+body+"\n"+"}\n"+"return ret;";return Function.apply(null,fun)};numeric._biforeach=function _biforeach(x,y,s,k,f){if(k===s.length-1){f(x,y);return}var i,n=s[k];for(i=n-1;i>=0;i--){_biforeach(typeof x==="object"?x[i]:x,typeof y==="object"?y[i]:y,s,k+1,f)}};numeric._biforeach2=function _biforeach2(x,y,s,k,f){if(k===s.length-1){return f(x,y)}var i,n=s[k],ret=Array(n);for(i=n-1;i>=0;--i){ret[i]=_biforeach2(typeof x==="object"?x[i]:x,typeof y==="object"?y[i]:y,s,k+1,f)}return ret};numeric._foreach=function _foreach(x,s,k,f){if(k===s.length-1){f(x);return}var i,n=s[k];for(i=n-1;i>=0;i--){_foreach(x[i],s,k+1,f)}};numeric._foreach2=function _foreach2(x,s,k,f){if(k===s.length-1){return f(x)}var i,n=s[k],ret=Array(n);for(i=n-1;i>=0;i--){ret[i]=_foreach2(x[i],s,k+1,f)}return ret};numeric.ops2={add:"+",sub:"-",mul:"*",div:"/",mod:"%",and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">=",band:"&",bor:"|",bxor:"^",lshift:"<<",rshift:">>",rrshift:">>>"};numeric.opseq={addeq:"+=",subeq:"-=",muleq:"*=",diveq:"/=",modeq:"%=",lshifteq:"<<=",rshifteq:">>=",rrshifteq:">>>=",bandeq:"&=",boreq:"|=",bxoreq:"^="};numeric.mathfuns=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan","isNaN","isFinite"];numeric.mathfuns2=["atan2","pow","max","min"];numeric.ops1={neg:"-",not:"!",bnot:"~",clone:""};numeric.mapreducers={any:["if(xi) return true;","var accum = false;"],all:["if(!xi) return false;","var accum = true;"],sum:["accum += xi;","var accum = 0;"],prod:["accum *= xi;","var accum = 1;"],norm2Squared:["accum += xi*xi;","var accum = 0;"],norminf:["accum = max(accum,abs(xi));","var accum = 0, max = Math.max, abs = Math.abs;"],norm1:["accum += abs(xi)","var accum = 0, abs = Math.abs;"],sup:["accum = max(accum,xi);","var accum = -Infinity, max = Math.max;"],inf:["accum = min(accum,xi);","var accum = Infinity, min = Math.min;"]};(function(){var i,o;for(i=0;i<numeric.mathfuns2.length;++i){o=numeric.mathfuns2[i];numeric.ops2[o]=o}for(i in numeric.ops2){if(numeric.ops2.hasOwnProperty(i)){o=numeric.ops2[i];var code,codeeq,setup="";if(numeric.myIndexOf.call(numeric.mathfuns2,i)!==-1){setup="var "+o+" = Math."+o+";\n";code=function(r,x,y){return r+" = "+o+"("+x+","+y+")"};codeeq=function(x,y){return x+" = "+o+"("+x+","+y+")"}}else{code=function(r,x,y){return r+" = "+x+" "+o+" "+y};if(numeric.opseq.hasOwnProperty(i+"eq")){codeeq=function(x,y){return x+" "+o+"= "+y}}else{codeeq=function(x,y){return x+" = "+x+" "+o+" "+y}}}numeric[i+"VV"]=numeric.pointwise2(["x[i]","y[i]"],code("ret[i]","x[i]","y[i]"),setup);numeric[i+"SV"]=numeric.pointwise2(["x","y[i]"],code("ret[i]","x","y[i]"),setup);numeric[i+"VS"]=numeric.pointwise2(["x[i]","y"],code("ret[i]","x[i]","y"),setup);numeric[i]=Function("var n = arguments.length, i, x = arguments[0], y;\n"+"var VV = numeric."+i+"VV, VS = numeric."+i+"VS, SV = numeric."+i+"SV;\n"+"var dim = numeric.dim;\n"+"for(i=1;i!==n;++i) { \n"+" y = arguments[i];\n"+' if(typeof x === "object") {\n'+' if(typeof y === "object") x = numeric._biforeach2(x,y,dim(x),0,VV);\n'+" else x = numeric._biforeach2(x,y,dim(x),0,VS);\n"+' } else if(typeof y === "object") x = numeric._biforeach2(x,y,dim(y),0,SV);\n'+" else "+codeeq("x","y")+"\n"+"}\nreturn x;\n");numeric[o]=numeric[i];numeric[i+"eqV"]=numeric.pointwise2(["ret[i]","x[i]"],codeeq("ret[i]","x[i]"),setup);numeric[i+"eqS"]=numeric.pointwise2(["ret[i]","x"],codeeq("ret[i]","x"),setup);numeric[i+"eq"]=Function("var n = arguments.length, i, x = arguments[0], y;\n"+"var V = numeric."+i+"eqV, S = numeric."+i+"eqS\n"+"var s = numeric.dim(x);\n"+"for(i=1;i!==n;++i) { \n"+" y = arguments[i];\n"+' if(typeof y === "object") numeric._biforeach(x,y,s,0,V);\n'+" else numeric._biforeach(x,y,s,0,S);\n"+"}\nreturn x;\n")}}for(i=0;i<numeric.mathfuns2.length;++i){o=numeric.mathfuns2[i];delete numeric.ops2[o]}for(i=0;i<numeric.mathfuns.length;++i){o=numeric.mathfuns[i];numeric.ops1[o]=o}for(i in numeric.ops1){if(numeric.ops1.hasOwnProperty(i)){setup="";o=numeric.ops1[i];if(numeric.myIndexOf.call(numeric.mathfuns,i)!==-1){if(Math.hasOwnProperty(o))setup="var "+o+" = Math."+o+";\n"}numeric[i+"eqV"]=numeric.pointwise2(["ret[i]"],"ret[i] = "+o+"(ret[i]);",setup);numeric[i+"eq"]=Function("x",'if(typeof x !== "object") return '+o+"x\n"+"var i;\n"+"var V = numeric."+i+"eqV;\n"+"var s = numeric.dim(x);\n"+"numeric._foreach(x,s,0,V);\n"+"return x;\n");numeric[i+"V"]=numeric.pointwise2(["x[i]"],"ret[i] = "+o+"(x[i]);",setup);numeric[i]=Function("x",'if(typeof x !== "object") return '+o+"(x)\n"+"var i;\n"+"var V = numeric."+i+"V;\n"+"var s = numeric.dim(x);\n"+"return numeric._foreach2(x,s,0,V);\n")}}for(i=0;i<numeric.mathfuns.length;++i){o=numeric.mathfuns[i];delete numeric.ops1[o]}for(i in numeric.mapreducers){if(numeric.mapreducers.hasOwnProperty(i)){o=numeric.mapreducers[i];numeric[i+"V"]=numeric.mapreduce2(o[0],o[1]);numeric[i]=Function("x","s","k",o[1]+'if(typeof x !== "object") {'+" xi = x;\n"+o[0]+";\n"+" return accum;\n"+"}"+'if(typeof s === "undefined") s = numeric.dim(x);\n'+'if(typeof k === "undefined") k = 0;\n'+"if(k === s.length-1) return numeric."+i+"V(x);\n"+"var xi;\n"+"var n = x.length, i;\n"+"for(i=n-1;i!==-1;--i) {\n"+" xi = arguments.callee(x[i]);\n"+o[0]+";\n"+"}\n"+"return accum;\n")}}})();numeric.truncVV=numeric.pointwise(["x[i]","y[i]"],"ret[i] = round(x[i]/y[i])*y[i];","var round = Math.round;");numeric.truncVS=numeric.pointwise(["x[i]","y"],"ret[i] = round(x[i]/y)*y;","var round = Math.round;");numeric.truncSV=numeric.pointwise(["x","y[i]"],"ret[i] = round(x/y[i])*y[i];","var round = Math.round;");numeric.trunc=function trunc(x,y){if(typeof x==="object"){if(typeof y==="object")return numeric.truncVV(x,y);return numeric.truncVS(x,y)}if(typeof y==="object")return numeric.truncSV(x,y);return Math.round(x/y)*y};numeric.inv=function inv(x){var s=numeric.dim(x),abs=Math.abs,m=s[0],n=s[1];var A=numeric.clone(x),Ai,Aj;var I=numeric.identity(m),Ii,Ij;var i,j,k,x;for(j=0;j<n;++j){var i0=-1;var v0=-1;for(i=j;i!==m;++i){k=abs(A[i][j]);if(k>v0){i0=i;v0=k}}Aj=A[i0];A[i0]=A[j];A[j]=Aj;Ij=I[i0];I[i0]=I[j];I[j]=Ij;x=Aj[j];for(k=j;k!==n;++k)Aj[k]/=x;for(k=n-1;k!==-1;--k)Ij[k]/=x;for(i=m-1;i!==-1;--i){if(i!==j){Ai=A[i];Ii=I[i];x=Ai[j];for(k=j+1;k!==n;++k)Ai[k]-=Aj[k]*x;for(k=n-1;k>0;--k){Ii[k]-=Ij[k]*x;--k;Ii[k]-=Ij[k]*x}if(k===0)Ii[0]-=Ij[0]*x}}}return I};numeric.det=function det(x){var s=numeric.dim(x);if(s.length!==2||s[0]!==s[1]){throw new Error("numeric: det() only works on square matrices")}var n=s[0],ret=1,i,j,k,A=numeric.clone(x),Aj,Ai,alpha,temp,k1,k2,k3;for(j=0;j<n-1;j++){k=j; | |
for(i=j+1;i<n;i++){if(Math.abs(A[i][j])>Math.abs(A[k][j])){k=i}}if(k!==j){temp=A[k];A[k]=A[j];A[j]=temp;ret*=-1}Aj=A[j];for(i=j+1;i<n;i++){Ai=A[i];alpha=Ai[j]/Aj[j];for(k=j+1;k<n-1;k+=2){k1=k+1;Ai[k]-=Aj[k]*alpha;Ai[k1]-=Aj[k1]*alpha}if(k!==n){Ai[k]-=Aj[k]*alpha}}if(Aj[j]===0){return 0}ret*=Aj[j]}return ret*A[j][j]};numeric.transpose=function transpose(x){var i,j,m=x.length,n=x[0].length,ret=Array(n),A0,A1,Bj;for(j=0;j<n;j++)ret[j]=Array(m);for(i=m-1;i>=1;i-=2){A1=x[i];A0=x[i-1];for(j=n-1;j>=1;--j){Bj=ret[j];Bj[i]=A1[j];Bj[i-1]=A0[j];--j;Bj=ret[j];Bj[i]=A1[j];Bj[i-1]=A0[j]}if(j===0){Bj=ret[0];Bj[i]=A1[0];Bj[i-1]=A0[0]}}if(i===0){A0=x[0];for(j=n-1;j>=1;--j){ret[j][0]=A0[j];--j;ret[j][0]=A0[j]}if(j===0){ret[0][0]=A0[0]}}return ret};numeric.negtranspose=function negtranspose(x){var i,j,m=x.length,n=x[0].length,ret=Array(n),A0,A1,Bj;for(j=0;j<n;j++)ret[j]=Array(m);for(i=m-1;i>=1;i-=2){A1=x[i];A0=x[i-1];for(j=n-1;j>=1;--j){Bj=ret[j];Bj[i]=-A1[j];Bj[i-1]=-A0[j];--j;Bj=ret[j];Bj[i]=-A1[j];Bj[i-1]=-A0[j]}if(j===0){Bj=ret[0];Bj[i]=-A1[0];Bj[i-1]=-A0[0]}}if(i===0){A0=x[0];for(j=n-1;j>=1;--j){ret[j][0]=-A0[j];--j;ret[j][0]=-A0[j]}if(j===0){ret[0][0]=-A0[0]}}return ret};numeric._random=function _random(s,k){var i,n=s[k],ret=Array(n),rnd;if(k===s.length-1){rnd=Math.random;for(i=n-1;i>=1;i-=2){ret[i]=rnd();ret[i-1]=rnd()}if(i===0){ret[0]=rnd()}return ret}for(i=n-1;i>=0;i--)ret[i]=_random(s,k+1);return ret};numeric.random=function random(s){return numeric._random(s,0)};numeric.norm2=function norm2(x){return Math.sqrt(numeric.norm2Squared(x))};numeric.linspace=function linspace(a,b,n){if(typeof n==="undefined")n=Math.max(Math.round(b-a)+1,1);if(n<2){return n===1?[a]:[]}var i,ret=Array(n);n--;for(i=n;i>=0;i--){ret[i]=(i*b+(n-i)*a)/n}return ret};numeric.getBlock=function getBlock(x,from,to){var s=numeric.dim(x);function foo(x,k){var i,a=from[k],n=to[k]-a,ret=Array(n);if(k===s.length-1){for(i=n;i>=0;i--){ret[i]=x[i+a]}return ret}for(i=n;i>=0;i--){ret[i]=foo(x[i+a],k+1)}return ret}return foo(x,0)};numeric.setBlock=function setBlock(x,from,to,B){var s=numeric.dim(x);function foo(x,y,k){var i,a=from[k],n=to[k]-a;if(k===s.length-1){for(i=n;i>=0;i--){x[i+a]=y[i]}}for(i=n;i>=0;i--){foo(x[i+a],y[i],k+1)}}foo(x,B,0);return x};numeric.getRange=function getRange(A,I,J){var m=I.length,n=J.length;var i,j;var B=Array(m),Bi,AI;for(i=m-1;i!==-1;--i){B[i]=Array(n);Bi=B[i];AI=A[I[i]];for(j=n-1;j!==-1;--j)Bi[j]=AI[J[j]]}return B};numeric.blockMatrix=function blockMatrix(X){var s=numeric.dim(X);if(s.length<4)return numeric.blockMatrix([X]);var m=s[0],n=s[1],M,N,i,j,Xij;M=0;N=0;for(i=0;i<m;++i)M+=X[i][0].length;for(j=0;j<n;++j)N+=X[0][j][0].length;var Z=Array(M);for(i=0;i<M;++i)Z[i]=Array(N);var I=0,J,ZI,k,l,Xijk;for(i=0;i<m;++i){J=N;for(j=n-1;j!==-1;--j){Xij=X[i][j];J-=Xij[0].length;for(k=Xij.length-1;k!==-1;--k){Xijk=Xij[k];ZI=Z[I+k];for(l=Xijk.length-1;l!==-1;--l)ZI[J+l]=Xijk[l]}}I+=X[i][0].length}return Z};numeric.tensor=function tensor(x,y){if(typeof x==="number"||typeof y==="number")return numeric.mul(x,y);var s1=numeric.dim(x),s2=numeric.dim(y);if(s1.length!==1||s2.length!==1){throw new Error("numeric: tensor product is only defined for vectors")}var m=s1[0],n=s2[0],A=Array(m),Ai,i,j,xi;for(i=m-1;i>=0;i--){Ai=Array(n);xi=x[i];for(j=n-1;j>=3;--j){Ai[j]=xi*y[j];--j;Ai[j]=xi*y[j];--j;Ai[j]=xi*y[j];--j;Ai[j]=xi*y[j]}while(j>=0){Ai[j]=xi*y[j];--j}A[i]=Ai}return A};numeric.T=function T(x,y){this.x=x;this.y=y};numeric.t=function t(x,y){return new numeric.T(x,y)};numeric.Tbinop=function Tbinop(rr,rc,cr,cc,setup){var io=numeric.indexOf;if(typeof setup!=="string"){var k;setup="";for(k in numeric){if(numeric.hasOwnProperty(k)&&(rr.indexOf(k)>=0||rc.indexOf(k)>=0||cr.indexOf(k)>=0||cc.indexOf(k)>=0)&&k.length>1){setup+="var "+k+" = numeric."+k+";\n"}}}return Function(["y"],"var x = this;\n"+"if(!(y instanceof numeric.T)) { y = new numeric.T(y); }\n"+setup+"\n"+"if(x.y) {"+" if(y.y) {"+" return new numeric.T("+cc+");\n"+" }\n"+" return new numeric.T("+cr+");\n"+"}\n"+"if(y.y) {\n"+" return new numeric.T("+rc+");\n"+"}\n"+"return new numeric.T("+rr+");\n")};numeric.T.prototype.add=numeric.Tbinop("add(x.x,y.x)","add(x.x,y.x),y.y","add(x.x,y.x),x.y","add(x.x,y.x),add(x.y,y.y)");numeric.T.prototype.sub=numeric.Tbinop("sub(x.x,y.x)","sub(x.x,y.x),neg(y.y)","sub(x.x,y.x),x.y","sub(x.x,y.x),sub(x.y,y.y)");numeric.T.prototype.mul=numeric.Tbinop("mul(x.x,y.x)","mul(x.x,y.x),mul(x.x,y.y)","mul(x.x,y.x),mul(x.y,y.x)","sub(mul(x.x,y.x),mul(x.y,y.y)),add(mul(x.x,y.y),mul(x.y,y.x))");numeric.T.prototype.reciprocal=function reciprocal(){var mul=numeric.mul,div=numeric.div;if(this.y){var d=numeric.add(mul(this.x,this.x),mul(this.y,this.y));return new numeric.T(div(this.x,d),div(numeric.neg(this.y),d))}return new T(div(1,this.x))};numeric.T.prototype.div=function div(y){if(!(y instanceof numeric.T))y=new numeric.T(y);if(y.y){return this.mul(y.reciprocal())}var div=numeric.div;if(this.y){return new numeric.T(div(this.x,y.x),div(this.y,y.x))}return new numeric.T(div(this.x,y.x))};numeric.T.prototype.dot=numeric.Tbinop("dot(x.x,y.x)","dot(x.x,y.x),dot(x.x,y.y)","dot(x.x,y.x),dot(x.y,y.x)","sub(dot(x.x,y.x),dot(x.y,y.y)),add(dot(x.x,y.y),dot(x.y,y.x))");numeric.T.prototype.transpose=function transpose(){var t=numeric.transpose,x=this.x,y=this.y;if(y){return new numeric.T(t(x),t(y))}return new numeric.T(t(x))};numeric.T.prototype.transjugate=function transjugate(){var t=numeric.transpose,x=this.x,y=this.y;if(y){return new numeric.T(t(x),numeric.negtranspose(y))}return new numeric.T(t(x))};numeric.Tunop=function Tunop(r,c,s){if(typeof s!=="string"){s=""}return Function("var x = this;\n"+s+"\n"+"if(x.y) {"+" "+c+";\n"+"}\n"+r+";\n")};numeric.T.prototype.exp=numeric.Tunop("return new numeric.T(ex)","return new numeric.T(mul(cos(x.y),ex),mul(sin(x.y),ex))","var ex = numeric.exp(x.x), cos = numeric.cos, sin = numeric.sin, mul = numeric.mul;");numeric.T.prototype.conj=numeric.Tunop("return new numeric.T(x.x);","return new numeric.T(x.x,numeric.neg(x.y));");numeric.T.prototype.neg=numeric.Tunop("return new numeric.T(neg(x.x));","return new numeric.T(neg(x.x),neg(x.y));","var neg = numeric.neg;");numeric.T.prototype.sin=numeric.Tunop("return new numeric.T(numeric.sin(x.x))","return x.exp().sub(x.neg().exp()).div(new numeric.T(0,2));");numeric.T.prototype.cos=numeric.Tunop("return new numeric.T(numeric.cos(x.x))","return x.exp().add(x.neg().exp()).div(2);");numeric.T.prototype.abs=numeric.Tunop("return new numeric.T(numeric.abs(x.x));","return new numeric.T(numeric.sqrt(numeric.add(mul(x.x,x.x),mul(x.y,x.y))));","var mul = numeric.mul;");numeric.T.prototype.log=numeric.Tunop("return new numeric.T(numeric.log(x.x));","var theta = new numeric.T(numeric.atan2(x.y,x.x)), r = x.abs();\n"+"return new numeric.T(numeric.log(r.x),theta.x);");numeric.T.prototype.norm2=numeric.Tunop("return numeric.norm2(x.x);","var f = numeric.norm2Squared;\n"+"return Math.sqrt(f(x.x)+f(x.y));");numeric.T.prototype.inv=function inv(){var A=this;if(typeof A.y==="undefined"){return new numeric.T(numeric.inv(A.x))}var n=A.x.length,i,j,k;var Rx=numeric.identity(n),Ry=numeric.rep([n,n],0);var Ax=numeric.clone(A.x),Ay=numeric.clone(A.y);var Aix,Aiy,Ajx,Ajy,Rix,Riy,Rjx,Rjy;var i,j,k,d,d1,ax,ay,bx,by,temp;for(i=0;i<n;i++){ax=Ax[i][i];ay=Ay[i][i];d=ax*ax+ay*ay;k=i;for(j=i+1;j<n;j++){ax=Ax[j][i];ay=Ay[j][i];d1=ax*ax+ay*ay;if(d1>d){k=j;d=d1}}if(k!==i){temp=Ax[i];Ax[i]=Ax[k];Ax[k]=temp;temp=Ay[i];Ay[i]=Ay[k];Ay[k]=temp;temp=Rx[i];Rx[i]=Rx[k];Rx[k]=temp;temp=Ry[i];Ry[i]=Ry[k];Ry[k]=temp}Aix=Ax[i];Aiy=Ay[i];Rix=Rx[i];Riy=Ry[i];ax=Aix[i];ay=Aiy[i];for(j=i+1;j<n;j++){bx=Aix[j];by=Aiy[j];Aix[j]=(bx*ax+by*ay)/d;Aiy[j]=(by*ax-bx*ay)/d}for(j=0;j<n;j++){bx=Rix[j];by=Riy[j];Rix[j]=(bx*ax+by*ay)/d;Riy[j]=(by*ax-bx*ay)/d}for(j=i+1;j<n;j++){Ajx=Ax[j];Ajy=Ay[j];Rjx=Rx[j];Rjy=Ry[j];ax=Ajx[i];ay=Ajy[i];for(k=i+1;k<n;k++){bx=Aix[k];by=Aiy[k];Ajx[k]-=bx*ax-by*ay;Ajy[k]-=by*ax+bx*ay}for(k=0;k<n;k++){bx=Rix[k];by=Riy[k];Rjx[k]-=bx*ax-by*ay;Rjy[k]-=by*ax+bx*ay}}}for(i=n-1;i>0;i--){Rix=Rx[i];Riy=Ry[i];for(j=i-1;j>=0;j--){Rjx=Rx[j];Rjy=Ry[j];ax=Ax[j][i];ay=Ay[j][i];for(k=n-1;k>=0;k--){bx=Rix[k];by=Riy[k];Rjx[k]-=ax*bx-ay*by;Rjy[k]-=ax*by+ay*bx}}}return new numeric.T(Rx,Ry)};numeric.T.prototype.get=function get(i){var x=this.x,y=this.y,k=0,ik,n=i.length;if(y){while(k<n){ik=i[k];x=x[ik];y=y[ik];k++}return new numeric.T(x,y)}while(k<n){ik=i[k];x=x[ik];k++}return new numeric.T(x)};numeric.T.prototype.set=function set(i,v){var x=this.x,y=this.y,k=0,ik,n=i.length,vx=v.x,vy=v.y;if(n===0){if(vy){this.y=vy}else if(y){this.y=undefined}this.x=x;return this}if(vy){if(y){}else{y=numeric.rep(numeric.dim(x),0);this.y=y}while(k<n-1){ik=i[k];x=x[ik];y=y[ik];k++}ik=i[k];x[ik]=vx;y[ik]=vy;return this}if(y){while(k<n-1){ik=i[k];x=x[ik];y=y[ik];k++}ik=i[k];x[ik]=vx;if(vx instanceof Array)y[ik]=numeric.rep(numeric.dim(vx),0);else y[ik]=0;return this}while(k<n-1){ik=i[k];x=x[ik];k++}ik=i[k];x[ik]=vx;return this};numeric.T.prototype.getRows=function getRows(i0,i1){var n=i1-i0+1,j;var rx=Array(n),ry,x=this.x,y=this.y;for(j=i0;j<=i1;j++){rx[j-i0]=x[j]}if(y){ry=Array(n);for(j=i0;j<=i1;j++){ry[j-i0]=y[j]}return new numeric.T(rx,ry)}return new numeric.T(rx)};numeric.T.prototype.setRows=function setRows(i0,i1,A){var j;var rx=this.x,ry=this.y,x=A.x,y=A.y;for(j=i0;j<=i1;j++){rx[j]=x[j-i0]}if(y){if(!ry){ry=numeric.rep(numeric.dim(rx),0);this.y=ry}for(j=i0;j<=i1;j++){ry[j]=y[j-i0]}}else if(ry){for(j=i0;j<=i1;j++){ry[j]=numeric.rep([x[j-i0].length],0)}}return this};numeric.T.prototype.getRow=function getRow(k){var x=this.x,y=this.y;if(y){return new numeric.T(x[k],y[k])}return new numeric.T(x[k])};numeric.T.prototype.setRow=function setRow(i,v){var rx=this.x,ry=this.y,x=v.x,y=v.y;rx[i]=x;if(y){if(!ry){ry=numeric.rep(numeric.dim(rx),0);this.y=ry}ry[i]=y}else if(ry){ry=numeric.rep([x.length],0)}return this};numeric.T.prototype.getBlock=function getBlock(from,to){var x=this.x,y=this.y,b=numeric.getBlock;if(y){return new numeric.T(b(x,from,to),b(y,from,to))}return new numeric.T(b(x,from,to))};numeric.T.prototype.setBlock=function setBlock(from,to,A){if(!(A instanceof numeric.T))A=new numeric.T(A);var x=this.x,y=this.y,b=numeric.setBlock,Ax=A.x,Ay=A.y;if(Ay){if(!y){this.y=numeric.rep(numeric.dim(this),0);y=this.y}b(x,from,to,Ax);b(y,from,to,Ay);return this}b(x,from,to,Ax);if(y)b(y,from,to,numeric.rep(numeric.dim(Ax),0))};numeric.T.rep=function rep(s,v){var T=numeric.T;if(!(v instanceof T))v=new T(v);var x=v.x,y=v.y,r=numeric.rep;if(y)return new T(r(s,x),r(s,y));return new T(r(s,x))};numeric.T.diag=function diag(d){if(!(d instanceof numeric.T))d=new numeric.T(d);var x=d.x,y=d.y,diag=numeric.diag;if(y)return new numeric.T(diag(x),diag(y));return new numeric.T(diag(x))};numeric.T.eig=function eig(){if(this.y){throw new Error("eig: not implemented for complex matrices.")}return numeric.eig(this.x)};numeric.T.identity=function identity(n){return new numeric.T(numeric.identity(n))};numeric.T.prototype.getDiag=function getDiag(){var n=numeric;var x=this.x,y=this.y;if(y){return new n.T(n.getDiag(x),n.getDiag(y))}return new n.T(n.getDiag(x))};numeric.house=function house(x){var v=numeric.clone(x);var s=x[0]>=0?1:-1;var alpha=s*numeric.norm2(x);v[0]+=alpha;var foo=numeric.norm2(v);if(foo===0){throw new Error("eig: internal error")}return numeric.div(v,foo)};numeric.toUpperHessenberg=function toUpperHessenberg(me){var s=numeric.dim(me);if(s.length!==2||s[0]!==s[1]){throw new Error("numeric: toUpperHessenberg() only works on square matrices")}var m=s[0],i,j,k,x,v,A=numeric.clone(me),B,C,Ai,Ci,Q=numeric.identity(m),Qi;for(j=0;j<m-2;j++){x=Array(m-j-1);for(i=j+1;i<m;i++){x[i-j-1]=A[i][j]}if(numeric.norm2(x)>0){v=numeric.house(x);B=numeric.getBlock(A,[j+1,j],[m-1,m-1]);C=numeric.tensor(v,numeric.dot(v,B));for(i=j+1;i<m;i++){Ai=A[i];Ci=C[i-j-1];for(k=j;k<m;k++)Ai[k]-=2*Ci[k-j]}B=numeric.getBlock(A,[0,j+1],[m-1,m-1]);C=numeric.tensor(numeric.dot(B,v),v);for(i=0;i<m;i++){Ai=A[i];Ci=C[i];for(k=j+1;k<m;k++)Ai[k]-=2*Ci[k-j-1]}B=Array(m-j-1);for(i=j+1;i<m;i++)B[i-j-1]=Q[i];C=numeric.tensor(v,numeric.dot(v,B));for(i=j+1;i<m;i++){Qi=Q[i];Ci=C[i-j-1];for(k=0;k<m;k++)Qi[k]-=2*Ci[k]}}}return{H:A,Q:Q}};numeric.epsilon=2.220446049250313e-16;numeric.QRFrancis=function(H,maxiter){if(typeof maxiter==="undefined"){maxiter=1e4}H=numeric.clone(H);var H0=numeric.clone(H);var s=numeric.dim(H),m=s[0],x,v,a,b,c,d,det,tr,Hloc,Q=numeric.identity(m),Qi,Hi,B,C,Ci,i,j,k,iter;if(m<3){return{Q:Q,B:[[0,m-1]]}}var epsilon=numeric.epsilon;for(iter=0;iter<maxiter;iter++){for(j=0;j<m-1;j++){if(Math.abs(H[j+1][j])<epsilon*(Math.abs(H[j][j])+Math.abs(H[j+1][j+1]))){var QH1=numeric.QRFrancis(numeric.getBlock(H,[0,0],[j,j]),maxiter);var QH2=numeric.QRFrancis(numeric.getBlock(H,[j+1,j+1],[m-1,m-1]),maxiter);B=Array(j+1);for(i=0;i<=j;i++){B[i]=Q[i]}C=numeric.dot(QH1.Q,B);for(i=0;i<=j;i++){Q[i]=C[i]}B=Array(m-j-1);for(i=j+1;i<m;i++){B[i-j-1]=Q[i]}C=numeric.dot(QH2.Q,B);for(i=j+1;i<m;i++){Q[i]=C[i-j-1]}return{Q:Q,B:QH1.B.concat(numeric.add(QH2.B,j+1))}}}a=H[m-2][m-2];b=H[m-2][m-1];c=H[m-1][m-2];d=H[m-1][m-1];tr=a+d;det=a*d-b*c;Hloc=numeric.getBlock(H,[0,0],[2,2]);if(tr*tr>=4*det){var s1,s2;s1=.5*(tr+Math.sqrt(tr*tr-4*det));s2=.5*(tr-Math.sqrt(tr*tr-4*det));Hloc=numeric.add(numeric.sub(numeric.dot(Hloc,Hloc),numeric.mul(Hloc,s1+s2)),numeric.diag(numeric.rep([3],s1*s2)))}else{Hloc=numeric.add(numeric.sub(numeric.dot(Hloc,Hloc),numeric.mul(Hloc,tr)),numeric.diag(numeric.rep([3],det)))}x=[Hloc[0][0],Hloc[1][0],Hloc[2][0]];v=numeric.house(x);B=[H[0],H[1],H[2]];C=numeric.tensor(v,numeric.dot(v,B));for(i=0;i<3;i++){Hi=H[i];Ci=C[i];for(k=0;k<m;k++)Hi[k]-=2*Ci[k]}B=numeric.getBlock(H,[0,0],[m-1,2]);C=numeric.tensor(numeric.dot(B,v),v);for(i=0;i<m;i++){Hi=H[i];Ci=C[i];for(k=0;k<3;k++)Hi[k]-=2*Ci[k]}B=[Q[0],Q[1],Q[2]];C=numeric.tensor(v,numeric.dot(v,B));for(i=0;i<3;i++){Qi=Q[i];Ci=C[i];for(k=0;k<m;k++)Qi[k]-=2*Ci[k]}var J;for(j=0;j<m-2;j++){for(k=j;k<=j+1;k++){if(Math.abs(H[k+1][k])<epsilon*(Math.abs(H[k][k])+Math.abs(H[k+1][k+1]))){var QH1=numeric.QRFrancis(numeric.getBlock(H,[0,0],[k,k]),maxiter);var QH2=numeric.QRFrancis(numeric.getBlock(H,[k+1,k+1],[m-1,m-1]),maxiter);B=Array(k+1);for(i=0;i<=k;i++){B[i]=Q[i]}C=numeric.dot(QH1.Q,B);for(i=0;i<=k;i++){Q[i]=C[i]}B=Array(m-k-1);for(i=k+1;i<m;i++){B[i-k-1]=Q[i]}C=numeric.dot(QH2.Q,B);for(i=k+1;i<m;i++){Q[i]=C[i-k-1]}return{Q:Q,B:QH1.B.concat(numeric.add(QH2.B,k+1))}}}J=Math.min(m-1,j+3);x=Array(J-j);for(i=j+1;i<=J;i++){x[i-j-1]=H[i][j]}v=numeric.house(x);B=numeric.getBlock(H,[j+1,j],[J,m-1]);C=numeric.tensor(v,numeric.dot(v,B));for(i=j+1;i<=J;i++){Hi=H[i];Ci=C[i-j-1];for(k=j;k<m;k++)Hi[k]-=2*Ci[k-j]}B=numeric.getBlock(H,[0,j+1],[m-1,J]);C=numeric.tensor(numeric.dot(B,v),v);for(i=0;i<m;i++){Hi=H[i];Ci=C[i];for(k=j+1;k<=J;k++)Hi[k]-=2*Ci[k-j-1]}B=Array(J-j);for(i=j+1;i<=J;i++)B[i-j-1]=Q[i];C=numeric.tensor(v,numeric.dot(v,B));for(i=j+1;i<=J;i++){Qi=Q[i];Ci=C[i-j-1];for(k=0;k<m;k++)Qi[k]-=2*Ci[k]}}}throw new Error("numeric: eigenvalue iteration does not converge -- increase maxiter?")};numeric.eig=function eig(A,maxiter){var QH=numeric.toUpperHessenberg(A);var QB=numeric.QRFrancis(QH.H,maxiter);var T=numeric.T;var n=A.length,i,k,flag=false,B=QB.B,H=numeric.dot(QB.Q,numeric.dot(QH.H,numeric.transpose(QB.Q)));var Q=new T(numeric.dot(QB.Q,QH.Q)),Q0;var m=B.length,j;var a,b,c,d,p1,p2,disc,x,y,p,q,n1,n2;var sqrt=Math.sqrt;for(k=0;k<m;k++){i=B[k][0];if(i===B[k][1]){}else{j=i+1;a=H[i][i];b=H[i][j];c=H[j][i];d=H[j][j];if(b===0&&c===0)continue;p1=-a-d;p2=a*d-b*c;disc=p1*p1-4*p2;if(disc>=0){if(p1<0)x=-.5*(p1-sqrt(disc));else x=-.5*(p1+sqrt(disc));n1=(a-x)*(a-x)+b*b;n2=c*c+(d-x)*(d-x);if(n1>n2){n1=sqrt(n1);p=(a-x)/n1;q=b/n1}else{n2=sqrt(n2);p=c/n2;q=(d-x)/n2}Q0=new T([[q,-p],[p,q]]);Q.setRows(i,j,Q0.dot(Q.getRows(i,j)))}else{x=-.5*p1;y=.5*sqrt(-disc);n1=(a-x)*(a-x)+b*b;n2=c*c+(d-x)*(d-x);if(n1>n2){n1=sqrt(n1+y*y);p=(a-x)/n1;q=b/n1;x=0;y/=n1}else{n2=sqrt(n2+y*y);p=c/n2;q=(d-x)/n2;x=y/n2;y=0}Q0=new T([[q,-p],[p,q]],[[x,y],[y,-x]]);Q.setRows(i,j,Q0.dot(Q.getRows(i,j)))}}}var R=Q.dot(A).dot(Q.transjugate()),n=A.length,E=numeric.T.identity(n);for(j=0;j<n;j++){if(j>0){for(k=j-1;k>=0;k--){var Rk=R.get([k,k]),Rj=R.get([j,j]);if(numeric.neq(Rk.x,Rj.x)||numeric.neq(Rk.y,Rj.y)){x=R.getRow(k).getBlock([k],[j-1]);y=E.getRow(j).getBlock([k],[j-1]);E.set([j,k],R.get([k,j]).neg().sub(x.dot(y)).div(Rk.sub(Rj)))}else{E.setRow(j,E.getRow(k));continue}}}}for(j=0;j<n;j++){x=E.getRow(j);E.setRow(j,x.div(x.norm2()))}E=E.transpose();E=Q.transjugate().dot(E);return{lambda:R.getDiag(),E:E}};numeric.ccsSparse=function ccsSparse(A){var m=A.length,n,foo,i,j,counts=[];for(i=m-1;i!==-1;--i){foo=A[i];for(j in foo){j=parseInt(j);while(j>=counts.length)counts[counts.length]=0;if(foo[j]!==0)counts[j]++}}var n=counts.length;var Ai=Array(n+1);Ai[0]=0;for(i=0;i<n;++i)Ai[i+1]=Ai[i]+counts[i];var Aj=Array(Ai[n]),Av=Array(Ai[n]);for(i=m-1;i!==-1;--i){foo=A[i];for(j in foo){if(foo[j]!==0){counts[j]--;Aj[Ai[j]+counts[j]]=i;Av[Ai[j]+counts[j]]=foo[j]}}}return[Ai,Aj,Av]};numeric.ccsFull=function ccsFull(A){var Ai=A[0],Aj=A[1],Av=A[2],s=numeric.ccsDim(A),m=s[0],n=s[1],i,j,j0,j1,k;var B=numeric.rep([m,n],0);for(i=0;i<n;i++){j0=Ai[i];j1=Ai[i+1];for(j=j0;j<j1;++j){B[Aj[j]][i]=Av[j]}}return B};numeric.ccsTSolve=function ccsTSolve(A,b,x,bj,xj){var Ai=A[0],Aj=A[1],Av=A[2],m=Ai.length-1,max=Math.max,n=0;if(typeof bj==="undefined")x=numeric.rep([m],0);if(typeof bj==="undefined")bj=numeric.linspace(0,x.length-1);if(typeof xj==="undefined")xj=[];function dfs(j){var k;if(x[j]!==0)return;x[j]=1;for(k=Ai[j];k<Ai[j+1];++k)dfs(Aj[k]);xj[n]=j;++n}var i,j,j0,j1,k,l,l0,l1,a;for(i=bj.length-1;i!==-1;--i){dfs(bj[i])}xj.length=n;for(i=xj.length-1;i!==-1;--i){x[xj[i]]=0}for(i=bj.length-1;i!==-1;--i){j=bj[i];x[j]=b[j]}for(i=xj.length-1;i!==-1;--i){j=xj[i];j0=Ai[j];j1=max(Ai[j+1],j0);for(k=j0;k!==j1;++k){if(Aj[k]===j){x[j]/=Av[k];break}}a=x[j];for(k=j0;k!==j1;++k){l=Aj[k];if(l!==j)x[l]-=a*Av[k]}}return x};numeric.ccsDFS=function ccsDFS(n){this.k=Array(n);this.k1=Array(n);this.j=Array(n)};numeric.ccsDFS.prototype.dfs=function dfs(J,Ai,Aj,x,xj,Pinv){var m=0,foo,n=xj.length;var k=this.k,k1=this.k1,j=this.j,km,k11;if(x[J]!==0)return;x[J]=1;j[0]=J;k[0]=km=Ai[J];k1[0]=k11=Ai[J+1];while(1){if(km>=k11){xj[n]=j[m];if(m===0)return;++n;--m;km=k[m];k11=k1[m]}else{foo=Pinv[Aj[km]];if(x[foo]===0){x[foo]=1;k[m]=km;++m;j[m]=foo;km=Ai[foo];k1[m]=k11=Ai[foo+1]}else++km}}};numeric.ccsLPSolve=function ccsLPSolve(A,B,x,xj,I,Pinv,dfs){var Ai=A[0],Aj=A[1],Av=A[2],m=Ai.length-1,n=0;var Bi=B[0],Bj=B[1],Bv=B[2];var i,i0,i1,j,J,j0,j1,k,l,l0,l1,a;i0=Bi[I];i1=Bi[I+1];xj.length=0;for(i=i0;i<i1;++i){dfs.dfs(Pinv[Bj[i]],Ai,Aj,x,xj,Pinv)}for(i=xj.length-1;i!==-1;--i){x[xj[i]]=0}for(i=i0;i!==i1;++i){j=Pinv[Bj[i]];x[j]=Bv[i]}for(i=xj.length-1;i!==-1;--i){j=xj[i];j0=Ai[j];j1=Ai[j+1];for(k=j0;k<j1;++k){if(Pinv[Aj[k]]===j){x[j]/=Av[k];break}}a=x[j];for(k=j0;k<j1;++k){l=Pinv[Aj[k]];if(l!==j)x[l]-=a*Av[k]}}return x};numeric.ccsLUP1=function ccsLUP1(A,threshold){var m=A[0].length-1;var L=[numeric.rep([m+1],0),[],[]],U=[numeric.rep([m+1],0),[],[]];var Li=L[0],Lj=L[1],Lv=L[2],Ui=U[0],Uj=U[1],Uv=U[2];var x=numeric.rep([m],0),xj=numeric.rep([m],0);var i,j,k,j0,j1,a,e,c,d,K;var sol=numeric.ccsLPSolve,max=Math.max,abs=Math.abs;var P=numeric.linspace(0,m-1),Pinv=numeric.linspace(0,m-1);var dfs=new numeric.ccsDFS(m);if(typeof threshold==="undefined"){threshold=1}for(i=0;i<m;++i){sol(L,A,x,xj,i,Pinv,dfs);a=-1;e=-1;for(j=xj.length-1;j!==-1;--j){k=xj[j];if(k<=i)continue;c=abs(x[k]);if(c>a){e=k;a=c}}if(abs(x[i])<threshold*a){j=P[i];a=P[e];P[i]=a;Pinv[a]=i;P[e]=j;Pinv[j]=e;a=x[i];x[i]=x[e];x[e]=a}a=Li[i];e=Ui[i];d=x[i];Lj[a]=P[i];Lv[a]=1;++a;for(j=xj.length-1;j!==-1;--j){k=xj[j];c=x[k];xj[j]=0;x[k]=0;if(k<=i){Uj[e]=k;Uv[e]=c;++e}else{Lj[a]=P[k];Lv[a]=c/d;++a}}Li[i+1]=a;Ui[i+1]=e}for(j=Lj.length-1;j!==-1;--j){Lj[j]=Pinv[Lj[j]]}return{L:L,U:U,P:P,Pinv:Pinv}};numeric.ccsDFS0=function ccsDFS0(n){this.k=Array(n);this.k1=Array(n);this.j=Array(n)};numeric.ccsDFS0.prototype.dfs=function dfs(J,Ai,Aj,x,xj,Pinv,P){var m=0,foo,n=xj.length;var k=this.k,k1=this.k1,j=this.j,km,k11;if(x[J]!==0)return;x[J]=1;j[0]=J;k[0]=km=Ai[Pinv[J]];k1[0]=k11=Ai[Pinv[J]+1];while(1){if(isNaN(km))throw new Error("Ow!");if(km>=k11){xj[n]=Pinv[j[m]];if(m===0)return;++n;--m;km=k[m];k11=k1[m]}else{foo=Aj[km];if(x[foo]===0){x[foo]=1;k[m]=km;++m;j[m]=foo;foo=Pinv[foo];km=Ai[foo];k1[m]=k11=Ai[foo+1]}else++km}}};numeric.ccsLPSolve0=function ccsLPSolve0(A,B,y,xj,I,Pinv,P,dfs){var Ai=A[0],Aj=A[1],Av=A[2],m=Ai.length-1,n=0;var Bi=B[0],Bj=B[1],Bv=B[2];var i,i0,i1,j,J,j0,j1,k,l,l0,l1,a;i0=Bi[I];i1=Bi[I+1];xj.length=0;for(i=i0;i<i1;++i){dfs.dfs(Bj[i],Ai,Aj,y,xj,Pinv,P)}for(i=xj.length-1;i!==-1;--i){j=xj[i];y[P[j]]=0}for(i=i0;i!==i1;++i){j=Bj[i];y[j]=Bv[i]}for(i=xj.length-1;i!==-1;--i){j=xj[i];l=P[j];j0=Ai[j];j1=Ai[j+1];for(k=j0;k<j1;++k){if(Aj[k]===l){y[l]/=Av[k];break}}a=y[l];for(k=j0;k<j1;++k)y[Aj[k]]-=a*Av[k];y[l]=a}};numeric.ccsLUP0=function ccsLUP0(A,threshold){var m=A[0].length-1;var L=[numeric.rep([m+1],0),[],[]],U=[numeric.rep([m+1],0),[],[]];var Li=L[0],Lj=L[1],Lv=L[2],Ui=U[0],Uj=U[1],Uv=U[2];var y=numeric.rep([m],0),xj=numeric.rep([m],0);var i,j,k,j0,j1,a,e,c,d,K;var sol=numeric.ccsLPSolve0,max=Math.max,abs=Math.abs;var P=numeric.linspace(0,m-1),Pinv=numeric.linspace(0,m-1);var dfs=new numeric.ccsDFS0(m);if(typeof threshold==="undefined"){threshold=1}for(i=0;i<m;++i){sol(L,A,y,xj,i,Pinv,P,dfs);a=-1;e=-1;for(j=xj.length-1;j!==-1;--j){k=xj[j];if(k<=i)continue;c=abs(y[P[k]]);if(c>a){e=k;a=c}}if(abs(y[P[i]])<threshold*a){j=P[i];a=P[e];P[i]=a;Pinv[a]=i;P[e]=j;Pinv[j]=e}a=Li[i];e=Ui[i];d=y[P[i]];Lj[a]=P[i];Lv[a]=1;++a;for(j=xj.length-1;j!==-1;--j){k=xj[j];c=y[P[k]];xj[j]=0;y[P[k]]=0;if(k<=i){Uj[e]=k;Uv[e]=c;++e}else{Lj[a]=P[k];Lv[a]=c/d;++a}}Li[i+1]=a;Ui[i+1]=e}for(j=Lj.length-1;j!==-1;--j){Lj[j]=Pinv[Lj[j]]}return{L:L,U:U,P:P,Pinv:Pinv}};numeric.ccsLUP=numeric.ccsLUP0;numeric.ccsDim=function ccsDim(A){return[numeric.sup(A[1])+1,A[0].length-1]};numeric.ccsGetBlock=function ccsGetBlock(A,i,j){var s=numeric.ccsDim(A),m=s[0],n=s[1];if(typeof i==="undefined"){i=numeric.linspace(0,m-1)}else if(typeof i==="number"){i=[i]}if(typeof j==="undefined"){j=numeric.linspace(0,n-1)}else if(typeof j==="number"){j=[j]}var p,p0,p1,P=i.length,q,Q=j.length,r,jq,ip;var Bi=numeric.rep([n],0),Bj=[],Bv=[],B=[Bi,Bj,Bv];var Ai=A[0],Aj=A[1],Av=A[2];var x=numeric.rep([m],0),count=0,flags=numeric.rep([m],0);for(q=0;q<Q;++q){jq=j[q];var q0=Ai[jq];var q1=Ai[jq+1];for(p=q0;p<q1;++p){r=Aj[p];flags[r]=1;x[r]=Av[p]}for(p=0;p<P;++p){ip=i[p];if(flags[ip]){Bj[count]=p;Bv[count]=x[i[p]];++count}}for(p=q0;p<q1;++p){r=Aj[p];flags[r]=0}Bi[q+1]=count}return B};numeric.ccsDot=function ccsDot(A,B){var Ai=A[0],Aj=A[1],Av=A[2];var Bi=B[0],Bj=B[1],Bv=B[2];var sA=numeric.ccsDim(A),sB=numeric.ccsDim(B);var m=sA[0],n=sA[1],o=sB[1];var x=numeric.rep([m],0),flags=numeric.rep([m],0),xj=Array(m);var Ci=numeric.rep([o],0),Cj=[],Cv=[],C=[Ci,Cj,Cv];var i,j,k,j0,j1,i0,i1,l,p,a,b;for(k=0;k!==o;++k){j0=Bi[k];j1=Bi[k+1];p=0;for(j=j0;j<j1;++j){a=Bj[j];b=Bv[j];i0=Ai[a];i1=Ai[a+1];for(i=i0;i<i1;++i){l=Aj[i];if(flags[l]===0){xj[p]=l;flags[l]=1;p=p+1}x[l]=x[l]+Av[i]*b}}j0=Ci[k];j1=j0+p;Ci[k+1]=j1;for(j=p-1;j!==-1;--j){b=j0+j;i=xj[j];Cj[b]=i;Cv[b]=x[i];flags[i]=0;x[i]=0}Ci[k+1]=Ci[k]+p}return C};numeric.ccsLUPSolve=function ccsLUPSolve(LUP,B){var L=LUP.L,U=LUP.U,P=LUP.P;var Bi=B[0];var flag=false;if(typeof Bi!=="object"){B=[[0,B.length],numeric.linspace(0,B.length-1),B];Bi=B[0];flag=true}var Bj=B[1],Bv=B[2];var n=L[0].length-1,m=Bi.length-1;var x=numeric.rep([n],0),xj=Array(n);var b=numeric.rep([n],0),bj=Array(n);var Xi=numeric.rep([m+1],0),Xj=[],Xv=[];var sol=numeric.ccsTSolve;var i,j,j0,j1,k,J,N=0;for(i=0;i<m;++i){k=0;j0=Bi[i];j1=Bi[i+1];for(j=j0;j<j1;++j){J=LUP.Pinv[Bj[j]];bj[k]=J;b[J]=Bv[j];++k}bj.length=k;sol(L,b,x,bj,xj);for(j=bj.length-1;j!==-1;--j)b[bj[j]]=0;sol(U,x,b,xj,bj);if(flag)return b;for(j=xj.length-1;j!==-1;--j)x[xj[j]]=0;for(j=bj.length-1;j!==-1;--j){J=bj[j];Xj[N]=J;Xv[N]=b[J];b[J]=0;++N}Xi[i+1]=N}return[Xi,Xj,Xv]};numeric.ccsbinop=function ccsbinop(body,setup){if(typeof setup==="undefined")setup="";return Function("X","Y","var Xi = X[0], Xj = X[1], Xv = X[2];\n"+"var Yi = Y[0], Yj = Y[1], Yv = Y[2];\n"+"var n = Xi.length-1,m = Math.max(numeric.sup(Xj),numeric.sup(Yj))+1;\n"+"var Zi = numeric.rep([n+1],0), Zj = [], Zv = [];\n"+"var x = numeric.rep([m],0),y = numeric.rep([m],0);\n"+"var xk,yk,zk;\n"+"var i,j,j0,j1,k,p=0;\n"+setup+"for(i=0;i<n;++i) {\n"+" j0 = Xi[i]; j1 = Xi[i+1];\n"+" for(j=j0;j!==j1;++j) {\n"+" k = Xj[j];\n"+" x[k] = 1;\n"+" Zj[p] = k;\n"+" ++p;\n"+" }\n"+" j0 = Yi[i]; j1 = Yi[i+1];\n"+" for(j=j0;j!==j1;++j) {\n"+" k = Yj[j];\n"+" y[k] = Yv[j];\n"+" if(x[k] === 0) {\n"+" Zj[p] = k;\n"+" ++p;\n"+" }\n"+" }\n"+" Zi[i+1] = p;\n"+" j0 = Xi[i]; j1 = Xi[i+1];\n"+" for(j=j0;j!==j1;++j) x[Xj[j]] = Xv[j];\n"+" j0 = Zi[i]; j1 = Zi[i+1];\n"+" for(j=j0;j!==j1;++j) {\n"+" k = Zj[j];\n"+" xk = x[k];\n"+" yk = y[k];\n"+body+"\n"+" Zv[j] = zk;\n"+" }\n"+" j0 = Xi[i]; j1 = Xi[i+1];\n"+" for(j=j0;j!==j1;++j) x[Xj[j]] = 0;\n"+" j0 = Yi[i]; j1 = Yi[i+1];\n"+" for(j=j0;j!==j1;++j) y[Yj[j]] = 0;\n"+"}\n"+"return [Zi,Zj,Zv];")};(function(){var k,A,B,C;for(k in numeric.ops2){if(isFinite(eval("1"+numeric.ops2[k]+"0")))A="[Y[0],Y[1],numeric."+k+"(X,Y[2])]";else A="NaN";if(isFinite(eval("0"+numeric.ops2[k]+"1")))B="[X[0],X[1],numeric."+k+"(X[2],Y)]";else B="NaN";if(isFinite(eval("1"+numeric.ops2[k]+"0"))&&isFinite(eval("0"+numeric.ops2[k]+"1")))C="numeric.ccs"+k+"MM(X,Y)";else C="NaN";numeric["ccs"+k+"MM"]=numeric.ccsbinop("zk = xk "+numeric.ops2[k]+"yk;");numeric["ccs"+k]=Function("X","Y",'if(typeof X === "number") return '+A+";\n"+'if(typeof Y === "number") return '+B+";\n"+"return "+C+";\n")}})();numeric.ccsScatter=function ccsScatter(A){var Ai=A[0],Aj=A[1],Av=A[2];var n=numeric.sup(Aj)+1,m=Ai.length;var Ri=numeric.rep([n],0),Rj=Array(m),Rv=Array(m);var counts=numeric.rep([n],0),i;for(i=0;i<m;++i)counts[Aj[i]]++;for(i=0;i<n;++i)Ri[i+1]=Ri[i]+counts[i];var ptr=Ri.slice(0),k,Aii;for(i=0;i<m;++i){Aii=Aj[i];k=ptr[Aii];Rj[k]=Ai[i];Rv[k]=Av[i];ptr[Aii]=ptr[Aii]+1}return[Ri,Rj,Rv]};numeric.ccsGather=function ccsGather(A){var Ai=A[0],Aj=A[1],Av=A[2];var n=Ai.length-1,m=Aj.length;var Ri=Array(m),Rj=Array(m),Rv=Array(m);var i,j,j0,j1,p;p=0;for(i=0;i<n;++i){j0=Ai[i];j1=Ai[i+1];for(j=j0;j!==j1;++j){Rj[p]=i;Ri[p]=Aj[j];Rv[p]=Av[j];++p}}return[Ri,Rj,Rv]};numeric.sdim=function dim(A,ret,k){if(typeof ret==="undefined"){ret=[]}if(typeof A!=="object")return ret;if(typeof k==="undefined"){k=0}if(!(k in ret)){ret[k]=0}if(A.length>ret[k])ret[k]=A.length;var i;for(i in A){if(A.hasOwnProperty(i))dim(A[i],ret,k+1)}return ret};numeric.sclone=function clone(A,k,n){if(typeof k==="undefined"){k=0}if(typeof n==="undefined"){n=numeric.sdim(A).length}var i,ret=Array(A.length);if(k===n-1){for(i in A){if(A.hasOwnProperty(i))ret[i]=A[i]}return ret}for(i in A){if(A.hasOwnProperty(i))ret[i]=clone(A[i],k+1,n)}return ret};numeric.sdiag=function diag(d){var n=d.length,i,ret=Array(n),i1,i2,i3;for(i=n-1;i>=1;i-=2){i1=i-1;ret[i]=[];ret[i][i]=d[i];ret[i1]=[];ret[i1][i1]=d[i1]}if(i===0){ret[0]=[];ret[0][0]=d[i]}return ret};numeric.sidentity=function identity(n){return numeric.sdiag(numeric.rep([n],1))};numeric.stranspose=function transpose(A){var ret=[],n=A.length,i,j,Ai;for(i in A){if(!A.hasOwnProperty(i))continue;Ai=A[i];for(j in Ai){if(!Ai.hasOwnProperty(j))continue;if(typeof ret[j]!=="object"){ret[j]=[]}ret[j][i]=Ai[j]}}return ret};numeric.sLUP=function LUP(A,tol){throw new Error("The function numeric.sLUP had a bug in it and has been removed. Please use the new numeric.ccsLUP function instead.")};numeric.sdotMM=function dotMM(A,B){var p=A.length,q=B.length,BT=numeric.stranspose(B),r=BT.length,Ai,BTk;var i,j,k,accum;var ret=Array(p),reti;for(i=p-1;i>=0;i--){reti=[];Ai=A[i];for(k=r-1;k>=0;k--){accum=0;BTk=BT[k];for(j in Ai){if(!Ai.hasOwnProperty(j))continue;if(j in BTk){accum+=Ai[j]*BTk[j]}}if(accum)reti[k]=accum}ret[i]=reti}return ret};numeric.sdotMV=function dotMV(A,x){var p=A.length,Ai,i,j;var ret=Array(p),accum;for(i=p-1;i>=0;i--){Ai=A[i];accum=0;for(j in Ai){if(!Ai.hasOwnProperty(j))continue;if(x[j])accum+=Ai[j]*x[j]}if(accum)ret[i]=accum}return ret};numeric.sdotVM=function dotMV(x,A){var i,j,Ai,alpha;var ret=[],accum;for(i in x){if(!x.hasOwnProperty(i))continue;Ai=A[i];alpha=x[i];for(j in Ai){if(!Ai.hasOwnProperty(j))continue;if(!ret[j]){ret[j]=0}ret[j]+=alpha*Ai[j]}}return ret};numeric.sdotVV=function dotVV(x,y){var i,ret=0;for(i in x){if(x[i]&&y[i])ret+=x[i]*y[i]}return ret};numeric.sdot=function dot(A,B){var m=numeric.sdim(A).length,n=numeric.sdim(B).length;var k=m*1e3+n;switch(k){case 0:return A*B;case 1001:return numeric.sdotVV(A,B);case 2001:return numeric.sdotMV(A,B);case 1002:return numeric.sdotVM(A,B);case 2002:return numeric.sdotMM(A,B);default:throw new Error("numeric.sdot not implemented for tensors of order "+m+" and "+n)}};numeric.sscatter=function scatter(V){var n=V[0].length,Vij,i,j,m=V.length,A=[],Aj;for(i=n-1;i>=0;--i){if(!V[m-1][i])continue;Aj=A;for(j=0;j<m-2;j++){Vij=V[j][i];if(!Aj[Vij])Aj[Vij]=[];Aj=Aj[Vij]}Aj[V[j][i]]=V[j+1][i]}return A};numeric.sgather=function gather(A,ret,k){if(typeof ret==="undefined")ret=[];if(typeof k==="undefined")k=[];var n,i,Ai;n=k.length;for(i in A){if(A.hasOwnProperty(i)){k[n]=parseInt(i);Ai=A[i];if(typeof Ai==="number"){if(Ai){if(ret.length===0){for(i=n+1;i>=0;--i)ret[i]=[]}for(i=n;i>=0;--i)ret[i].push(k[i]);ret[n+1].push(Ai)}}else gather(Ai,ret,k)}}if(k.length>n)k.pop();return ret};numeric.cLU=function LU(A){var I=A[0],J=A[1],V=A[2];var p=I.length,m=0,i,j,k,a,b,c;for(i=0;i<p;i++)if(I[i]>m)m=I[i];m++;var L=Array(m),U=Array(m),left=numeric.rep([m],Infinity),right=numeric.rep([m],-Infinity);var Ui,Uj,alpha;for(k=0;k<p;k++){i=I[k];j=J[k];if(j<left[i])left[i]=j;if(j>right[i])right[i]=j}for(i=0;i<m-1;i++){if(right[i]>right[i+1])right[i+1]=right[i]}for(i=m-1;i>=1;i--){if(left[i]<left[i-1])left[i-1]=left[i]}var countL=0,countU=0;for(i=0;i<m;i++){U[i]=numeric.rep([right[i]-left[i]+1],0);L[i]=numeric.rep([i-left[i]],0);countL+=i-left[i]+1;countU+=right[i]-i+1}for(k=0;k<p;k++){i=I[k];U[i][J[k]-left[i]]=V[k]}for(i=0;i<m-1;i++){a=i-left[i];Ui=U[i];for(j=i+1;left[j]<=i&&j<m;j++){b=i-left[j];c=right[i]-i;Uj=U[j];alpha=Uj[b]/Ui[a];if(alpha){for(k=1;k<=c;k++){Uj[k+b]-=alpha*Ui[k+a]}L[j][i-left[j]]=alpha}}}var Ui=[],Uj=[],Uv=[],Li=[],Lj=[],Lv=[];var p,q,foo;p=0;q=0;for(i=0;i<m;i++){a=left[i];b=right[i];foo=U[i];for(j=i;j<=b;j++){if(foo[j-a]){Ui[p]=i;Uj[p]=j;Uv[p]=foo[j-a];p++}}foo=L[i];for(j=a;j<i;j++){if(foo[j-a]){Li[q]=i;Lj[q]=j;Lv[q]=foo[j-a];q++}}Li[q]=i;Lj[q]=i;Lv[q]=1;q++}return{U:[Ui,Uj,Uv],L:[Li,Lj,Lv]}};numeric.cLUsolve=function LUsolve(lu,b){var L=lu.L,U=lu.U,ret=numeric.clone(b);var Li=L[0],Lj=L[1],Lv=L[2];var Ui=U[0],Uj=U[1],Uv=U[2];var p=Ui.length,q=Li.length;var m=ret.length,i,j,k;k=0;for(i=0;i<m;i++){while(Lj[k]<i){ret[i]-=Lv[k]*ret[Lj[k]];k++}k++}k=p-1;for(i=m-1;i>=0;i--){while(Uj[k]>i){ret[i]-=Uv[k]*ret[Uj[k]];k--}ret[i]/=Uv[k];k--}return ret};numeric.cgrid=function grid(n,shape){if(typeof n==="number")n=[n,n];var ret=numeric.rep(n,-1);var i,j,count;if(typeof shape!=="function"){switch(shape){case"L":shape=function(i,j){return i>=n[0]/2||j<n[1]/2};break;default:shape=function(i,j){return true};break}}count=0;for(i=1;i<n[0]-1;i++)for(j=1;j<n[1]-1;j++)if(shape(i,j)){ret[i][j]=count;count++}return ret};numeric.cdelsq=function delsq(g){var dir=[[-1,0],[0,-1],[0,1],[1,0]];var s=numeric.dim(g),m=s[0],n=s[1],i,j,k,p,q;var Li=[],Lj=[],Lv=[];for(i=1;i<m-1;i++)for(j=1;j<n-1;j++){if(g[i][j]<0)continue;for(k=0;k<4;k++){p=i+dir[k][0];q=j+dir[k][1];if(g[p][q]<0)continue;Li.push(g[i][j]);Lj.push(g[p][q]);Lv.push(-1)}Li.push(g[i][j]);Lj.push(g[i][j]);Lv.push(4)}return[Li,Lj,Lv]};numeric.cdotMV=function dotMV(A,x){var ret,Ai=A[0],Aj=A[1],Av=A[2],k,p=Ai.length,N;N=0;for(k=0;k<p;k++){if(Ai[k]>N)N=Ai[k]}N++;ret=numeric.rep([N],0);for(k=0;k<p;k++){ret[Ai[k]]+=Av[k]*x[Aj[k]]}return ret};numeric.Spline=function Spline(x,yl,yr,kl,kr){this.x=x;this.yl=yl; | |
this.yr=yr;this.kl=kl;this.kr=kr};numeric.Spline.prototype._at=function _at(x1,p){var x=this.x;var yl=this.yl;var yr=this.yr;var kl=this.kl;var kr=this.kr;var x1,a,b,t;var add=numeric.add,sub=numeric.sub,mul=numeric.mul;a=sub(mul(kl[p],x[p+1]-x[p]),sub(yr[p+1],yl[p]));b=add(mul(kr[p+1],x[p]-x[p+1]),sub(yr[p+1],yl[p]));t=(x1-x[p])/(x[p+1]-x[p]);var s=t*(1-t);return add(add(add(mul(1-t,yl[p]),mul(t,yr[p+1])),mul(a,s*(1-t))),mul(b,s*t))};numeric.Spline.prototype.at=function at(x0){if(typeof x0==="number"){var x=this.x;var n=x.length;var p,q,mid,floor=Math.floor,a,b,t;p=0;q=n-1;while(q-p>1){mid=floor((p+q)/2);if(x[mid]<=x0)p=mid;else q=mid}return this._at(x0,p)}var n=x0.length,i,ret=Array(n);for(i=n-1;i!==-1;--i)ret[i]=this.at(x0[i]);return ret};numeric.Spline.prototype.diff=function diff(){var x=this.x;var yl=this.yl;var yr=this.yr;var kl=this.kl;var kr=this.kr;var n=yl.length;var i,dx,dy;var zl=kl,zr=kr,pl=Array(n),pr=Array(n);var add=numeric.add,mul=numeric.mul,div=numeric.div,sub=numeric.sub;for(i=n-1;i!==-1;--i){dx=x[i+1]-x[i];dy=sub(yr[i+1],yl[i]);pl[i]=div(add(mul(dy,6),mul(kl[i],-4*dx),mul(kr[i+1],-2*dx)),dx*dx);pr[i+1]=div(add(mul(dy,-6),mul(kl[i],2*dx),mul(kr[i+1],4*dx)),dx*dx)}return new numeric.Spline(x,zl,zr,pl,pr)};numeric.Spline.prototype.roots=function roots(){function sqr(x){return x*x}function heval(y0,y1,k0,k1,x){var A=k0*2-(y1-y0);var B=-k1*2+(y1-y0);var t=(x+1)*.5;var s=t*(1-t);return(1-t)*y0+t*y1+A*s*(1-t)+B*s*t}var ret=[];var x=this.x,yl=this.yl,yr=this.yr,kl=this.kl,kr=this.kr;if(typeof yl[0]==="number"){yl=[yl];yr=[yr];kl=[kl];kr=[kr]}var m=yl.length,n=x.length-1,i,j,k,y,s,t;var ai,bi,ci,di,ret=Array(m),ri,k0,k1,y0,y1,A,B,D,dx,cx,stops,z0,z1,zm,t0,t1,tm;var sqrt=Math.sqrt;for(i=0;i!==m;++i){ai=yl[i];bi=yr[i];ci=kl[i];di=kr[i];ri=[];for(j=0;j!==n;j++){if(j>0&&bi[j]*ai[j]<0)ri.push(x[j]);dx=x[j+1]-x[j];cx=x[j];y0=ai[j];y1=bi[j+1];k0=ci[j]/dx;k1=di[j+1]/dx;D=sqr(k0-k1+3*(y0-y1))+12*k1*y0;A=k1+3*y0+2*k0-3*y1;B=3*(k1+k0+2*(y0-y1));if(D<=0){z0=A/B;if(z0>x[j]&&z0<x[j+1])stops=[x[j],z0,x[j+1]];else stops=[x[j],x[j+1]]}else{z0=(A-sqrt(D))/B;z1=(A+sqrt(D))/B;stops=[x[j]];if(z0>x[j]&&z0<x[j+1])stops.push(z0);if(z1>x[j]&&z1<x[j+1])stops.push(z1);stops.push(x[j+1])}t0=stops[0];z0=this._at(t0,j);for(k=0;k<stops.length-1;k++){t1=stops[k+1];z1=this._at(t1,j);if(z0===0){ri.push(t0);t0=t1;z0=z1;continue}if(z1===0||z0*z1>0){t0=t1;z0=z1;continue}var side=0;while(1){tm=(z0*t1-z1*t0)/(z0-z1);if(tm<=t0||tm>=t1){break}zm=this._at(tm,j);if(zm*z1>0){t1=tm;z1=zm;if(side===-1)z0*=.5;side=-1}else if(zm*z0>0){t0=tm;z0=zm;if(side===1)z1*=.5;side=1}else break}ri.push(tm);t0=stops[k+1];z0=this._at(t0,j)}if(z1===0)ri.push(t1)}ret[i]=ri}if(typeof this.yl[0]==="number")return ret[0];return ret};numeric.spline=function spline(x,y,k1,kn){var n=x.length,b=[],dx=[],dy=[];var i;var sub=numeric.sub,mul=numeric.mul,add=numeric.add;for(i=n-2;i>=0;i--){dx[i]=x[i+1]-x[i];dy[i]=sub(y[i+1],y[i])}if(typeof k1==="string"||typeof kn==="string"){k1=kn="periodic"}var T=[[],[],[]];switch(typeof k1){case"undefined":b[0]=mul(3/(dx[0]*dx[0]),dy[0]);T[0].push(0,0);T[1].push(0,1);T[2].push(2/dx[0],1/dx[0]);break;case"string":b[0]=add(mul(3/(dx[n-2]*dx[n-2]),dy[n-2]),mul(3/(dx[0]*dx[0]),dy[0]));T[0].push(0,0,0);T[1].push(n-2,0,1);T[2].push(1/dx[n-2],2/dx[n-2]+2/dx[0],1/dx[0]);break;default:b[0]=k1;T[0].push(0);T[1].push(0);T[2].push(1);break}for(i=1;i<n-1;i++){b[i]=add(mul(3/(dx[i-1]*dx[i-1]),dy[i-1]),mul(3/(dx[i]*dx[i]),dy[i]));T[0].push(i,i,i);T[1].push(i-1,i,i+1);T[2].push(1/dx[i-1],2/dx[i-1]+2/dx[i],1/dx[i])}switch(typeof kn){case"undefined":b[n-1]=mul(3/(dx[n-2]*dx[n-2]),dy[n-2]);T[0].push(n-1,n-1);T[1].push(n-2,n-1);T[2].push(1/dx[n-2],2/dx[n-2]);break;case"string":T[1][T[1].length-1]=0;break;default:b[n-1]=kn;T[0].push(n-1);T[1].push(n-1);T[2].push(1);break}if(typeof b[0]!=="number")b=numeric.transpose(b);else b=[b];var k=Array(b.length);if(typeof k1==="string"){for(i=k.length-1;i!==-1;--i){k[i]=numeric.ccsLUPSolve(numeric.ccsLUP(numeric.ccsScatter(T)),b[i]);k[i][n-1]=k[i][0]}}else{for(i=k.length-1;i!==-1;--i){k[i]=numeric.cLUsolve(numeric.cLU(T),b[i])}}if(typeof y[0]==="number")k=k[0];else k=numeric.transpose(k);return new numeric.Spline(x,y,y,k,k)};numeric.fftpow2=function fftpow2(x,y){var n=x.length;if(n===1)return;var cos=Math.cos,sin=Math.sin,i,j;var xe=Array(n/2),ye=Array(n/2),xo=Array(n/2),yo=Array(n/2);j=n/2;for(i=n-1;i!==-1;--i){--j;xo[j]=x[i];yo[j]=y[i];--i;xe[j]=x[i];ye[j]=y[i]}fftpow2(xe,ye);fftpow2(xo,yo);j=n/2;var t,k=-6.283185307179586/n,ci,si;for(i=n-1;i!==-1;--i){--j;if(j===-1)j=n/2-1;t=k*i;ci=cos(t);si=sin(t);x[i]=xe[j]+ci*xo[j]-si*yo[j];y[i]=ye[j]+ci*yo[j]+si*xo[j]}};numeric._ifftpow2=function _ifftpow2(x,y){var n=x.length;if(n===1)return;var cos=Math.cos,sin=Math.sin,i,j;var xe=Array(n/2),ye=Array(n/2),xo=Array(n/2),yo=Array(n/2);j=n/2;for(i=n-1;i!==-1;--i){--j;xo[j]=x[i];yo[j]=y[i];--i;xe[j]=x[i];ye[j]=y[i]}_ifftpow2(xe,ye);_ifftpow2(xo,yo);j=n/2;var t,k=6.283185307179586/n,ci,si;for(i=n-1;i!==-1;--i){--j;if(j===-1)j=n/2-1;t=k*i;ci=cos(t);si=sin(t);x[i]=xe[j]+ci*xo[j]-si*yo[j];y[i]=ye[j]+ci*yo[j]+si*xo[j]}};numeric.ifftpow2=function ifftpow2(x,y){numeric._ifftpow2(x,y);numeric.diveq(x,x.length);numeric.diveq(y,y.length)};numeric.convpow2=function convpow2(ax,ay,bx,by){numeric.fftpow2(ax,ay);numeric.fftpow2(bx,by);var i,n=ax.length,axi,bxi,ayi,byi;for(i=n-1;i!==-1;--i){axi=ax[i];ayi=ay[i];bxi=bx[i];byi=by[i];ax[i]=axi*bxi-ayi*byi;ay[i]=axi*byi+ayi*bxi}numeric.ifftpow2(ax,ay)};numeric.T.prototype.fft=function fft(){var x=this.x,y=this.y;var n=x.length,log=Math.log,log2=log(2),p=Math.ceil(log(2*n-1)/log2),m=Math.pow(2,p);var cx=numeric.rep([m],0),cy=numeric.rep([m],0),cos=Math.cos,sin=Math.sin;var k,c=-3.141592653589793/n,t;var a=numeric.rep([m],0),b=numeric.rep([m],0),nhalf=Math.floor(n/2);for(k=0;k<n;k++)a[k]=x[k];if(typeof y!=="undefined")for(k=0;k<n;k++)b[k]=y[k];cx[0]=1;for(k=1;k<=m/2;k++){t=c*k*k;cx[k]=cos(t);cy[k]=sin(t);cx[m-k]=cos(t);cy[m-k]=sin(t)}var X=new numeric.T(a,b),Y=new numeric.T(cx,cy);X=X.mul(Y);numeric.convpow2(X.x,X.y,numeric.clone(Y.x),numeric.neg(Y.y));X=X.mul(Y);X.x.length=n;X.y.length=n;return X};numeric.T.prototype.ifft=function ifft(){var x=this.x,y=this.y;var n=x.length,log=Math.log,log2=log(2),p=Math.ceil(log(2*n-1)/log2),m=Math.pow(2,p);var cx=numeric.rep([m],0),cy=numeric.rep([m],0),cos=Math.cos,sin=Math.sin;var k,c=3.141592653589793/n,t;var a=numeric.rep([m],0),b=numeric.rep([m],0),nhalf=Math.floor(n/2);for(k=0;k<n;k++)a[k]=x[k];if(typeof y!=="undefined")for(k=0;k<n;k++)b[k]=y[k];cx[0]=1;for(k=1;k<=m/2;k++){t=c*k*k;cx[k]=cos(t);cy[k]=sin(t);cx[m-k]=cos(t);cy[m-k]=sin(t)}var X=new numeric.T(a,b),Y=new numeric.T(cx,cy);X=X.mul(Y);numeric.convpow2(X.x,X.y,numeric.clone(Y.x),numeric.neg(Y.y));X=X.mul(Y);X.x.length=n;X.y.length=n;return X.div(n)};numeric.gradient=function gradient(f,x){var n=x.length;var f0=f(x);if(isNaN(f0))throw new Error("gradient: f(x) is a NaN!");var max=Math.max;var i,x0=numeric.clone(x),f1,f2,J=Array(n);var div=numeric.div,sub=numeric.sub,errest,roundoff,max=Math.max,eps=.001,abs=Math.abs,min=Math.min;var t0,t1,t2,it=0,d1,d2,N;for(i=0;i<n;i++){var h=max(1e-6*f0,1e-8);while(1){++it;if(it>20){throw new Error("Numerical gradient fails")}x0[i]=x[i]+h;f1=f(x0);x0[i]=x[i]-h;f2=f(x0);x0[i]=x[i];if(isNaN(f1)||isNaN(f2)){h/=16;continue}J[i]=(f1-f2)/(2*h);t0=x[i]-h;t1=x[i];t2=x[i]+h;d1=(f1-f0)/h;d2=(f0-f2)/h;N=max(abs(J[i]),abs(f0),abs(f1),abs(f2),abs(t0),abs(t1),abs(t2),1e-8);errest=min(max(abs(d1-J[i]),abs(d2-J[i]),abs(d1-d2))/N,h/N);if(errest>eps){h/=16}else break}}return J};numeric.uncmin=function uncmin(f,x0,tol,gradient,maxit,callback,options){var grad=numeric.gradient;if(typeof options==="undefined"){options={}}if(typeof tol==="undefined"){tol=1e-8}if(typeof gradient==="undefined"){gradient=function(x){return grad(f,x)}}if(typeof maxit==="undefined")maxit=1e3;x0=numeric.clone(x0);var n=x0.length;var f0=f(x0),f1,df0;if(isNaN(f0))throw new Error("uncmin: f(x0) is a NaN!");var max=Math.max,norm2=numeric.norm2;tol=max(tol,numeric.epsilon);var step,g0,g1,H1=options.Hinv||numeric.identity(n);var dot=numeric.dot,inv=numeric.inv,sub=numeric.sub,add=numeric.add,ten=numeric.tensor,div=numeric.div,mul=numeric.mul;var all=numeric.all,isfinite=numeric.isFinite,neg=numeric.neg;var it=0,i,s,x1,y,Hy,Hs,ys,i0,t,nstep,t1,t2;var msg="";g0=gradient(x0);while(it<maxit){if(typeof callback==="function"){if(callback(it,x0,f0,g0,H1)){msg="Callback returned true";break}}if(!all(isfinite(g0))){msg="Gradient has Infinity or NaN";break}step=neg(dot(H1,g0));if(!all(isfinite(step))){msg="Search direction has Infinity or NaN";break}nstep=norm2(step);if(nstep<tol){msg="Newton step smaller than tol";break}t=1;df0=dot(g0,step);x1=x0;while(it<maxit){if(t*nstep<tol){break}s=mul(step,t);x1=add(x0,s);f1=f(x1);if(f1-f0>=.1*t*df0||isNaN(f1)){t*=.5;++it;continue}break}if(t*nstep<tol){msg="Line search step size smaller than tol";break}if(it===maxit){msg="maxit reached during line search";break}g1=gradient(x1);y=sub(g1,g0);ys=dot(y,s);Hy=dot(H1,y);H1=sub(add(H1,mul((ys+dot(y,Hy))/(ys*ys),ten(s,s))),div(add(ten(Hy,s),ten(s,Hy)),ys));x0=x1;f0=f1;g0=g1;++it}return{solution:x0,f:f0,gradient:g0,invHessian:H1,iterations:it,message:msg}};numeric.Dopri=function Dopri(x,y,f,ymid,iterations,msg,events){this.x=x;this.y=y;this.f=f;this.ymid=ymid;this.iterations=iterations;this.events=events;this.message=msg};numeric.Dopri.prototype._at=function _at(xi,j){function sqr(x){return x*x}var sol=this;var xs=sol.x;var ys=sol.y;var k1=sol.f;var ymid=sol.ymid;var n=xs.length;var x0,x1,xh,y0,y1,yh,xi;var floor=Math.floor,h;var c=.5;var add=numeric.add,mul=numeric.mul,sub=numeric.sub,p,q,w;x0=xs[j];x1=xs[j+1];y0=ys[j];y1=ys[j+1];h=x1-x0;xh=x0+c*h;yh=ymid[j];p=sub(k1[j],mul(y0,1/(x0-xh)+2/(x0-x1)));q=sub(k1[j+1],mul(y1,1/(x1-xh)+2/(x1-x0)));w=[sqr(xi-x1)*(xi-xh)/sqr(x0-x1)/(x0-xh),sqr(xi-x0)*sqr(xi-x1)/sqr(x0-xh)/sqr(x1-xh),sqr(xi-x0)*(xi-xh)/sqr(x1-x0)/(x1-xh),(xi-x0)*sqr(xi-x1)*(xi-xh)/sqr(x0-x1)/(x0-xh),(xi-x1)*sqr(xi-x0)*(xi-xh)/sqr(x0-x1)/(x1-xh)];return add(add(add(add(mul(y0,w[0]),mul(yh,w[1])),mul(y1,w[2])),mul(p,w[3])),mul(q,w[4]))};numeric.Dopri.prototype.at=function at(x){var i,j,k,floor=Math.floor;if(typeof x!=="number"){var n=x.length,ret=Array(n);for(i=n-1;i!==-1;--i){ret[i]=this.at(x[i])}return ret}var x0=this.x;i=0;j=x0.length-1;while(j-i>1){k=floor(.5*(i+j));if(x0[k]<=x)i=k;else j=k}return this._at(x,i)};numeric.dopri=function dopri(x0,x1,y0,f,tol,maxit,event){if(typeof tol==="undefined"){tol=1e-6}if(typeof maxit==="undefined"){maxit=1e3}var xs=[x0],ys=[y0],k1=[f(x0,y0)],k2,k3,k4,k5,k6,k7,ymid=[];var A2=1/5;var A3=[3/40,9/40];var A4=[44/45,-56/15,32/9];var A5=[19372/6561,-25360/2187,64448/6561,-212/729];var A6=[9017/3168,-355/33,46732/5247,49/176,-5103/18656];var b=[35/384,0,500/1113,125/192,-2187/6784,11/84];var bm=[.5*6025192743/30085553152,0,.5*51252292925/65400821598,.5*-2691868925/45128329728,.5*187940372067/1594534317056,.5*-1776094331/19743644256,.5*11237099/235043384];var c=[1/5,3/10,4/5,8/9,1,1];var e=[-71/57600,0,71/16695,-71/1920,17253/339200,-22/525,1/40];var i=0,er,j;var h=(x1-x0)/10;var it=0;var add=numeric.add,mul=numeric.mul,y1,erinf;var max=Math.max,min=Math.min,abs=Math.abs,norminf=numeric.norminf,pow=Math.pow;var any=numeric.any,lt=numeric.lt,and=numeric.and,sub=numeric.sub;var e0,e1,ev;var ret=new numeric.Dopri(xs,ys,k1,ymid,-1,"");if(typeof event==="function")e0=event(x0,y0);while(x0<x1&&it<maxit){++it;if(x0+h>x1)h=x1-x0;k2=f(x0+c[0]*h,add(y0,mul(A2*h,k1[i])));k3=f(x0+c[1]*h,add(add(y0,mul(A3[0]*h,k1[i])),mul(A3[1]*h,k2)));k4=f(x0+c[2]*h,add(add(add(y0,mul(A4[0]*h,k1[i])),mul(A4[1]*h,k2)),mul(A4[2]*h,k3)));k5=f(x0+c[3]*h,add(add(add(add(y0,mul(A5[0]*h,k1[i])),mul(A5[1]*h,k2)),mul(A5[2]*h,k3)),mul(A5[3]*h,k4)));k6=f(x0+c[4]*h,add(add(add(add(add(y0,mul(A6[0]*h,k1[i])),mul(A6[1]*h,k2)),mul(A6[2]*h,k3)),mul(A6[3]*h,k4)),mul(A6[4]*h,k5)));y1=add(add(add(add(add(y0,mul(k1[i],h*b[0])),mul(k3,h*b[2])),mul(k4,h*b[3])),mul(k5,h*b[4])),mul(k6,h*b[5]));k7=f(x0+h,y1);er=add(add(add(add(add(mul(k1[i],h*e[0]),mul(k3,h*e[2])),mul(k4,h*e[3])),mul(k5,h*e[4])),mul(k6,h*e[5])),mul(k7,h*e[6]));if(typeof er==="number")erinf=abs(er);else erinf=norminf(er);if(erinf>tol){h=.2*h*pow(tol/erinf,.25);if(x0+h===x0){ret.msg="Step size became too small";break}continue}ymid[i]=add(add(add(add(add(add(y0,mul(k1[i],h*bm[0])),mul(k3,h*bm[2])),mul(k4,h*bm[3])),mul(k5,h*bm[4])),mul(k6,h*bm[5])),mul(k7,h*bm[6]));++i;xs[i]=x0+h;ys[i]=y1;k1[i]=k7;if(typeof event==="function"){var yi,xl=x0,xr=x0+.5*h,xi;e1=event(xr,ymid[i-1]);ev=and(lt(e0,0),lt(0,e1));if(!any(ev)){xl=xr;xr=x0+h;e0=e1;e1=event(xr,y1);ev=and(lt(e0,0),lt(0,e1))}if(any(ev)){var xc,yc,en,ei;var side=0,sl=1,sr=1;while(1){if(typeof e0==="number")xi=(sr*e1*xl-sl*e0*xr)/(sr*e1-sl*e0);else{xi=xr;for(j=e0.length-1;j!==-1;--j){if(e0[j]<0&&e1[j]>0)xi=min(xi,(sr*e1[j]*xl-sl*e0[j]*xr)/(sr*e1[j]-sl*e0[j]))}}if(xi<=xl||xi>=xr)break;yi=ret._at(xi,i-1);ei=event(xi,yi);en=and(lt(e0,0),lt(0,ei));if(any(en)){xr=xi;e1=ei;ev=en;sr=1;if(side===-1)sl*=.5;else sl=1;side=-1}else{xl=xi;e0=ei;sl=1;if(side===1)sr*=.5;else sr=1;side=1}}y1=ret._at(.5*(x0+xi),i-1);ret.f[i]=f(xi,yi);ret.x[i]=xi;ret.y[i]=yi;ret.ymid[i-1]=y1;ret.events=ev;ret.iterations=it;return ret}}x0+=h;y0=y1;e0=e1;h=min(.8*h*pow(tol/erinf,.25),4*h)}ret.iterations=it;return ret};numeric.LU=function(A,fast){fast=fast||false;var abs=Math.abs;var i,j,k,absAjk,Akk,Ak,Pk,Ai;var max;var n=A.length,n1=n-1;var P=new Array(n);if(!fast)A=numeric.clone(A);for(k=0;k<n;++k){Pk=k;Ak=A[k];max=abs(Ak[k]);for(j=k+1;j<n;++j){absAjk=abs(A[j][k]);if(max<absAjk){max=absAjk;Pk=j}}P[k]=Pk;if(Pk!=k){A[k]=A[Pk];A[Pk]=Ak;Ak=A[k]}Akk=Ak[k];for(i=k+1;i<n;++i){A[i][k]/=Akk}for(i=k+1;i<n;++i){Ai=A[i];for(j=k+1;j<n1;++j){Ai[j]-=Ai[k]*Ak[j];++j;Ai[j]-=Ai[k]*Ak[j]}if(j===n1)Ai[j]-=Ai[k]*Ak[j]}}return{LU:A,P:P}};numeric.LUsolve=function LUsolve(LUP,b){var i,j;var LU=LUP.LU;var n=LU.length;var x=numeric.clone(b);var P=LUP.P;var Pi,LUi,LUii,tmp;for(i=n-1;i!==-1;--i)x[i]=b[i];for(i=0;i<n;++i){Pi=P[i];if(P[i]!==i){tmp=x[i];x[i]=x[Pi];x[Pi]=tmp}LUi=LU[i];for(j=0;j<i;++j){x[i]-=x[j]*LUi[j]}}for(i=n-1;i>=0;--i){LUi=LU[i];for(j=i+1;j<n;++j){x[i]-=x[j]*LUi[j]}x[i]/=LUi[i]}return x};numeric.solve=function solve(A,b,fast){return numeric.LUsolve(numeric.LU(A,fast),b)};numeric.echelonize=function echelonize(A){var s=numeric.dim(A),m=s[0],n=s[1];var I=numeric.identity(m);var P=Array(m);var i,j,k,l,Ai,Ii,Z,a;var abs=Math.abs;var diveq=numeric.diveq;A=numeric.clone(A);for(i=0;i<m;++i){k=0;Ai=A[i];Ii=I[i];for(j=1;j<n;++j)if(abs(Ai[k])<abs(Ai[j]))k=j;P[i]=k;diveq(Ii,Ai[k]);diveq(Ai,Ai[k]);for(j=0;j<m;++j)if(j!==i){Z=A[j];a=Z[k];for(l=n-1;l!==-1;--l)Z[l]-=Ai[l]*a;Z=I[j];for(l=m-1;l!==-1;--l)Z[l]-=Ii[l]*a}}return{I:I,A:A,P:P}};numeric.__solveLP=function __solveLP(c,A,b,tol,maxit,x,flag){var sum=numeric.sum,log=numeric.log,mul=numeric.mul,sub=numeric.sub,dot=numeric.dot,div=numeric.div,add=numeric.add;var m=c.length,n=b.length,y;var unbounded=false,cb,i0=0;var alpha=1;var f0,df0,AT=numeric.transpose(A),svd=numeric.svd,transpose=numeric.transpose,leq=numeric.leq,sqrt=Math.sqrt,abs=Math.abs;var muleq=numeric.muleq;var norm=numeric.norminf,any=numeric.any,min=Math.min;var all=numeric.all,gt=numeric.gt;var p=Array(m),A0=Array(n),e=numeric.rep([n],1),H;var solve=numeric.solve,z=sub(b,dot(A,x)),count;var dotcc=dot(c,c);var g;for(count=i0;count<maxit;++count){var i,j,d;for(i=n-1;i!==-1;--i)A0[i]=div(A[i],z[i]);var A1=transpose(A0);for(i=m-1;i!==-1;--i)p[i]=sum(A1[i]);alpha=.25*abs(dotcc/dot(c,p));var a1=100*sqrt(dotcc/dot(p,p));if(!isFinite(alpha)||alpha>a1)alpha=a1;g=add(c,mul(alpha,p));H=dot(A1,A0);for(i=m-1;i!==-1;--i)H[i][i]+=1;d=solve(H,div(g,alpha),true);var t0=div(z,dot(A,d));var t=1;for(i=n-1;i!==-1;--i)if(t0[i]<0)t=min(t,-.999*t0[i]);y=sub(x,mul(d,t));z=sub(b,dot(A,y));if(!all(gt(z,0)))return{solution:x,message:"",iterations:count};x=y;if(alpha<tol)return{solution:y,message:"",iterations:count};if(flag){var s=dot(c,g),Ag=dot(A,g);unbounded=true;for(i=n-1;i!==-1;--i)if(s*Ag[i]<0){unbounded=false;break}}else{if(x[m-1]>=0)unbounded=false;else unbounded=true}if(unbounded)return{solution:y,message:"Unbounded",iterations:count}}return{solution:x,message:"maximum iteration count exceeded",iterations:count}};numeric._solveLP=function _solveLP(c,A,b,tol,maxit){var m=c.length,n=b.length,y;var sum=numeric.sum,log=numeric.log,mul=numeric.mul,sub=numeric.sub,dot=numeric.dot,div=numeric.div,add=numeric.add;var c0=numeric.rep([m],0).concat([1]);var J=numeric.rep([n,1],-1);var A0=numeric.blockMatrix([[A,J]]);var b0=b;var y=numeric.rep([m],0).concat(Math.max(0,numeric.sup(numeric.neg(b)))+1);var x0=numeric.__solveLP(c0,A0,b0,tol,maxit,y,false);var x=numeric.clone(x0.solution);x.length=m;var foo=numeric.inf(sub(b,dot(A,x)));if(foo<0){return{solution:NaN,message:"Infeasible",iterations:x0.iterations}}var ret=numeric.__solveLP(c,A,b,tol,maxit-x0.iterations,x,true);ret.iterations+=x0.iterations;return ret};numeric.solveLP=function solveLP(c,A,b,Aeq,beq,tol,maxit){if(typeof maxit==="undefined")maxit=1e3;if(typeof tol==="undefined")tol=numeric.epsilon;if(typeof Aeq==="undefined")return numeric._solveLP(c,A,b,tol,maxit);var m=Aeq.length,n=Aeq[0].length,o=A.length;var B=numeric.echelonize(Aeq);var flags=numeric.rep([n],0);var P=B.P;var Q=[];var i;for(i=P.length-1;i!==-1;--i)flags[P[i]]=1;for(i=n-1;i!==-1;--i)if(flags[i]===0)Q.push(i);var g=numeric.getRange;var I=numeric.linspace(0,m-1),J=numeric.linspace(0,o-1);var Aeq2=g(Aeq,I,Q),A1=g(A,J,P),A2=g(A,J,Q),dot=numeric.dot,sub=numeric.sub;var A3=dot(A1,B.I);var A4=sub(A2,dot(A3,Aeq2)),b4=sub(b,dot(A3,beq));var c1=Array(P.length),c2=Array(Q.length);for(i=P.length-1;i!==-1;--i)c1[i]=c[P[i]];for(i=Q.length-1;i!==-1;--i)c2[i]=c[Q[i]];var c4=sub(c2,dot(c1,dot(B.I,Aeq2)));var S=numeric._solveLP(c4,A4,b4,tol,maxit);var x2=S.solution;if(x2!==x2)return S;var x1=dot(B.I,sub(beq,dot(Aeq2,x2)));var x=Array(c.length);for(i=P.length-1;i!==-1;--i)x[P[i]]=x1[i];for(i=Q.length-1;i!==-1;--i)x[Q[i]]=x2[i];return{solution:x,message:S.message,iterations:S.iterations}};numeric.MPStoLP=function MPStoLP(MPS){if(MPS instanceof String){MPS.split("\n")}var state=0;var states=["Initial state","NAME","ROWS","COLUMNS","RHS","BOUNDS","ENDATA"];var n=MPS.length;var i,j,z,N=0,rows={},sign=[],rl=0,vars={},nv=0;var name;var c=[],A=[],b=[];function err(e){throw new Error("MPStoLP: "+e+"\nLine "+i+": "+MPS[i]+"\nCurrent state: "+states[state]+"\n")}for(i=0;i<n;++i){z=MPS[i];var w0=z.match(/\S*/g);var w=[];for(j=0;j<w0.length;++j)if(w0[j]!=="")w.push(w0[j]);if(w.length===0)continue;for(j=0;j<states.length;++j)if(z.substr(0,states[j].length)===states[j])break;if(j<states.length){state=j;if(j===1){name=w[1]}if(j===6)return{name:name,c:c,A:numeric.transpose(A),b:b,rows:rows,vars:vars};continue}switch(state){case 0:case 1:err("Unexpected line");case 2:switch(w[0]){case"N":if(N===0)N=w[1];else err("Two or more N rows");break;case"L":rows[w[1]]=rl;sign[rl]=1;b[rl]=0;++rl;break;case"G":rows[w[1]]=rl;sign[rl]=-1;b[rl]=0;++rl;break;case"E":rows[w[1]]=rl;sign[rl]=0;b[rl]=0;++rl;break;default:err("Parse error "+numeric.prettyPrint(w))}break;case 3:if(!vars.hasOwnProperty(w[0])){vars[w[0]]=nv;c[nv]=0;A[nv]=numeric.rep([rl],0);++nv}var p=vars[w[0]];for(j=1;j<w.length;j+=2){if(w[j]===N){c[p]=parseFloat(w[j+1]);continue}var q=rows[w[j]];A[p][q]=(sign[q]<0?-1:1)*parseFloat(w[j+1])}break;case 4:for(j=1;j<w.length;j+=2)b[rows[w[j]]]=(sign[rows[w[j]]]<0?-1:1)*parseFloat(w[j+1]);break;case 5:break;case 6:err("Internal error")}}err("Reached end of file without ENDATA")};numeric.seedrandom={pow:Math.pow,random:Math.random};(function(pool,math,width,chunks,significance,overflow,startdenom){math["seedrandom"]=function seedrandom(seed,use_entropy){var key=[];var arc4;seed=mixkey(flatten(use_entropy?[seed,pool]:arguments.length?seed:[(new Date).getTime(),pool,window],3),key);arc4=new ARC4(key);mixkey(arc4.S,pool);math["random"]=function random(){var n=arc4.g(chunks);var d=startdenom;var x=0;while(n<significance){n=(n+x)*width;d*=width;x=arc4.g(1)}while(n>=overflow){n/=2;d/=2;x>>>=1}return(n+x)/d};return seed};function ARC4(key){var t,u,me=this,keylen=key.length;var i=0,j=me.i=me.j=me.m=0;me.S=[];me.c=[];if(!keylen){key=[keylen++]}while(i<width){me.S[i]=i++}for(i=0;i<width;i++){t=me.S[i];j=lowbits(j+t+key[i%keylen]);u=me.S[j];me.S[i]=u;me.S[j]=t}me.g=function getnext(count){var s=me.S;var i=lowbits(me.i+1);var t=s[i];var j=lowbits(me.j+t);var u=s[j];s[i]=u;s[j]=t;var r=s[lowbits(t+u)];while(--count){i=lowbits(i+1);t=s[i];j=lowbits(j+t);u=s[j];s[i]=u;s[j]=t;r=r*width+s[lowbits(t+u)]}me.i=i;me.j=j;return r};me.g(width)}function flatten(obj,depth,result,prop,typ){result=[];typ=typeof obj;if(depth&&typ=="object"){for(prop in obj){if(prop.indexOf("S")<5){try{result.push(flatten(obj[prop],depth-1))}catch(e){}}}}return result.length?result:obj+(typ!="string"?"\x00":"")}function mixkey(seed,key,smear,j){seed+="";smear=0;for(j=0;j<seed.length;j++){key[lowbits(j)]=lowbits((smear^=key[lowbits(j)]*19)+seed.charCodeAt(j))}seed="";for(j in key){seed+=String.fromCharCode(key[j])}return seed}function lowbits(n){return n&width-1}startdenom=math.pow(width,chunks);significance=math.pow(2,significance);overflow=significance*2;mixkey(math.random(),pool)})([],numeric.seedrandom,256,6,52);(function(exports){function base0to1(A){if(typeof A!=="object"){return A}var ret=[],i,n=A.length;for(i=0;i<n;i++)ret[i+1]=base0to1(A[i]);return ret}function base1to0(A){if(typeof A!=="object"){return A}var ret=[],i,n=A.length;for(i=1;i<n;i++)ret[i-1]=base1to0(A[i]);return ret}function dpori(a,lda,n){var i,j,k,kp1,t;for(k=1;k<=n;k=k+1){a[k][k]=1/a[k][k];t=-a[k][k];for(i=1;i<k;i=i+1){a[i][k]=t*a[i][k]}kp1=k+1;if(n<kp1){break}for(j=kp1;j<=n;j=j+1){t=a[k][j];a[k][j]=0;for(i=1;i<=k;i=i+1){a[i][j]=a[i][j]+t*a[i][k]}}}}function dposl(a,lda,n,b){var i,k,kb,t;for(k=1;k<=n;k=k+1){t=0;for(i=1;i<k;i=i+1){t=t+a[i][k]*b[i]}b[k]=(b[k]-t)/a[k][k]}for(kb=1;kb<=n;kb=kb+1){k=n+1-kb;b[k]=b[k]/a[k][k];t=-b[k];for(i=1;i<k;i=i+1){b[i]=b[i]+t*a[i][k]}}}function dpofa(a,lda,n,info){var i,j,jm1,k,t,s;for(j=1;j<=n;j=j+1){info[1]=j;s=0;jm1=j-1;if(jm1<1){s=a[j][j]-s;if(s<=0){break}a[j][j]=Math.sqrt(s)}else{for(k=1;k<=jm1;k=k+1){t=a[k][j];for(i=1;i<k;i=i+1){t=t-a[i][j]*a[i][k]}t=t/a[k][k];a[k][j]=t;s=s+t*t}s=a[j][j]-s;if(s<=0){break}a[j][j]=Math.sqrt(s)}info[1]=0}}function qpgen2(dmat,dvec,fddmat,n,sol,crval,amat,bvec,fdamat,q,meq,iact,nact,iter,work,ierr){var i,j,l,l1,info,it1,iwzv,iwrv,iwrm,iwsv,iwuv,nvl,r,iwnbv,temp,sum,t1,tt,gc,gs,nu,t1inf,t2min,vsmall,tmpa,tmpb,go;r=Math.min(n,q);l=2*n+r*(r+5)/2+2*q+1;vsmall=1e-60;do{vsmall=vsmall+vsmall;tmpa=1+.1*vsmall;tmpb=1+.2*vsmall}while(tmpa<=1||tmpb<=1);for(i=1;i<=n;i=i+1){work[i]=dvec[i]}for(i=n+1;i<=l;i=i+1){work[i]=0}for(i=1;i<=q;i=i+1){iact[i]=0}info=[];if(ierr[1]===0){dpofa(dmat,fddmat,n,info);if(info[1]!==0){ierr[1]=2;return}dposl(dmat,fddmat,n,dvec);dpori(dmat,fddmat,n)}else{for(j=1;j<=n;j=j+1){sol[j]=0;for(i=1;i<=j;i=i+1){sol[j]=sol[j]+dmat[i][j]*dvec[i]}}for(j=1;j<=n;j=j+1){dvec[j]=0;for(i=j;i<=n;i=i+1){dvec[j]=dvec[j]+dmat[j][i]*sol[i]}}}crval[1]=0;for(j=1;j<=n;j=j+1){sol[j]=dvec[j];crval[1]=crval[1]+work[j]*sol[j];work[j]=0;for(i=j+1;i<=n;i=i+1){dmat[i][j]=0}}crval[1]=-crval[1]/2;ierr[1]=0;iwzv=n;iwrv=iwzv+n;iwuv=iwrv+r;iwrm=iwuv+r+1;iwsv=iwrm+r*(r+1)/2;iwnbv=iwsv+q;for(i=1;i<=q;i=i+1){sum=0;for(j=1;j<=n;j=j+1){sum=sum+amat[j][i]*amat[j][i]}work[iwnbv+i]=Math.sqrt(sum)}nact=0;iter[1]=0;iter[2]=0;function fn_goto_50(){iter[1]=iter[1]+1;l=iwsv;for(i=1;i<=q;i=i+1){l=l+1;sum=-bvec[i];for(j=1;j<=n;j=j+1){sum=sum+amat[j][i]*sol[j]}if(Math.abs(sum)<vsmall){sum=0}if(i>meq){work[l]=sum}else{work[l]=-Math.abs(sum);if(sum>0){for(j=1;j<=n;j=j+1){amat[j][i]=-amat[j][i]}bvec[i]=-bvec[i]}}}for(i=1;i<=nact;i=i+1){work[iwsv+iact[i]]=0}nvl=0;temp=0;for(i=1;i<=q;i=i+1){if(work[iwsv+i]<temp*work[iwnbv+i]){nvl=i;temp=work[iwsv+i]/work[iwnbv+i]}}if(nvl===0){return 999}return 0}function fn_goto_55(){for(i=1;i<=n;i=i+1){sum=0;for(j=1;j<=n;j=j+1){sum=sum+dmat[j][i]*amat[j][nvl]}work[i]=sum}l1=iwzv;for(i=1;i<=n;i=i+1){work[l1+i]=0}for(j=nact+1;j<=n;j=j+1){for(i=1;i<=n;i=i+1){work[l1+i]=work[l1+i]+dmat[i][j]*work[j]}}t1inf=true;for(i=nact;i>=1;i=i-1){sum=work[i];l=iwrm+i*(i+3)/2;l1=l-i;for(j=i+1;j<=nact;j=j+1){sum=sum-work[l]*work[iwrv+j];l=l+j}sum=sum/work[l1];work[iwrv+i]=sum;if(iact[i]<meq){break}if(sum<0){break}t1inf=false;it1=i}if(!t1inf){t1=work[iwuv+it1]/work[iwrv+it1];for(i=1;i<=nact;i=i+1){if(iact[i]<meq){break}if(work[iwrv+i]<0){break}temp=work[iwuv+i]/work[iwrv+i];if(temp<t1){t1=temp;it1=i}}}sum=0;for(i=iwzv+1;i<=iwzv+n;i=i+1){sum=sum+work[i]*work[i]}if(Math.abs(sum)<=vsmall){if(t1inf){ierr[1]=1;return 999}else{for(i=1;i<=nact;i=i+1){work[iwuv+i]=work[iwuv+i]-t1*work[iwrv+i]}work[iwuv+nact+1]=work[iwuv+nact+1]+t1;return 700}}else{sum=0;for(i=1;i<=n;i=i+1){sum=sum+work[iwzv+i]*amat[i][nvl]}tt=-work[iwsv+nvl]/sum;t2min=true;if(!t1inf){if(t1<tt){tt=t1;t2min=false}}for(i=1;i<=n;i=i+1){sol[i]=sol[i]+tt*work[iwzv+i];if(Math.abs(sol[i])<vsmall){sol[i]=0}}crval[1]=crval[1]+tt*sum*(tt/2+work[iwuv+nact+1]);for(i=1;i<=nact;i=i+1){work[iwuv+i]=work[iwuv+i]-tt*work[iwrv+i]}work[iwuv+nact+1]=work[iwuv+nact+1]+tt;if(t2min){nact=nact+1;iact[nact]=nvl;l=iwrm+(nact-1)*nact/2+1;for(i=1;i<=nact-1;i=i+1){work[l]=work[i];l=l+1}if(nact===n){work[l]=work[n]}else{for(i=n;i>=nact+1;i=i-1){if(work[i]===0){break}gc=Math.max(Math.abs(work[i-1]),Math.abs(work[i]));gs=Math.min(Math.abs(work[i-1]),Math.abs(work[i]));if(work[i-1]>=0){temp=Math.abs(gc*Math.sqrt(1+gs*gs/(gc*gc)))}else{temp=-Math.abs(gc*Math.sqrt(1+gs*gs/(gc*gc)))}gc=work[i-1]/temp;gs=work[i]/temp;if(gc===1){break}if(gc===0){work[i-1]=gs*temp;for(j=1;j<=n;j=j+1){temp=dmat[j][i-1];dmat[j][i-1]=dmat[j][i];dmat[j][i]=temp}}else{work[i-1]=temp;nu=gs/(1+gc);for(j=1;j<=n;j=j+1){temp=gc*dmat[j][i-1]+gs*dmat[j][i];dmat[j][i]=nu*(dmat[j][i-1]+temp)-dmat[j][i];dmat[j][i-1]=temp}}}work[l]=work[nact]}}else{sum=-bvec[nvl];for(j=1;j<=n;j=j+1){sum=sum+sol[j]*amat[j][nvl]}if(nvl>meq){work[iwsv+nvl]=sum}else{work[iwsv+nvl]=-Math.abs(sum);if(sum>0){for(j=1;j<=n;j=j+1){amat[j][nvl]=-amat[j][nvl]}bvec[nvl]=-bvec[nvl]}}return 700}}return 0}function fn_goto_797(){l=iwrm+it1*(it1+1)/2+1;l1=l+it1;if(work[l1]===0){return 798}gc=Math.max(Math.abs(work[l1-1]),Math.abs(work[l1]));gs=Math.min(Math.abs(work[l1-1]),Math.abs(work[l1]));if(work[l1-1]>=0){temp=Math.abs(gc*Math.sqrt(1+gs*gs/(gc*gc)))}else{temp=-Math.abs(gc*Math.sqrt(1+gs*gs/(gc*gc)))}gc=work[l1-1]/temp;gs=work[l1]/temp;if(gc===1){return 798}if(gc===0){for(i=it1+1;i<=nact;i=i+1){temp=work[l1-1];work[l1-1]=work[l1];work[l1]=temp;l1=l1+i}for(i=1;i<=n;i=i+1){temp=dmat[i][it1];dmat[i][it1]=dmat[i][it1+1];dmat[i][it1+1]=temp}}else{nu=gs/(1+gc);for(i=it1+1;i<=nact;i=i+1){temp=gc*work[l1-1]+gs*work[l1];work[l1]=nu*(work[l1-1]+temp)-work[l1];work[l1-1]=temp;l1=l1+i}for(i=1;i<=n;i=i+1){temp=gc*dmat[i][it1]+gs*dmat[i][it1+1];dmat[i][it1+1]=nu*(dmat[i][it1]+temp)-dmat[i][it1+1];dmat[i][it1]=temp}}return 0}function fn_goto_798(){l1=l-it1;for(i=1;i<=it1;i=i+1){work[l1]=work[l];l=l+1;l1=l1+1}work[iwuv+it1]=work[iwuv+it1+1];iact[it1]=iact[it1+1];it1=it1+1;if(it1<nact){return 797}return 0}function fn_goto_799(){work[iwuv+nact]=work[iwuv+nact+1];work[iwuv+nact+1]=0;iact[nact]=0;nact=nact-1;iter[2]=iter[2]+1;return 0}go=0;while(true){go=fn_goto_50();if(go===999){return}while(true){go=fn_goto_55();if(go===0){break}if(go===999){return}if(go===700){if(it1===nact){fn_goto_799()}else{while(true){fn_goto_797();go=fn_goto_798();if(go!==797){break}}fn_goto_799()}}}}}function solveQP(Dmat,dvec,Amat,bvec,meq,factorized){Dmat=base0to1(Dmat);dvec=base0to1(dvec);Amat=base0to1(Amat);var i,n,q,nact,r,crval=[],iact=[],sol=[],work=[],iter=[],message;meq=meq||0;factorized=factorized?base0to1(factorized):[undefined,0];bvec=bvec?base0to1(bvec):[];n=Dmat.length-1;q=Amat[1].length-1;if(!bvec){for(i=1;i<=q;i=i+1){bvec[i]=0}}for(i=1;i<=q;i=i+1){iact[i]=0}nact=0;r=Math.min(n,q);for(i=1;i<=n;i=i+1){sol[i]=0}crval[1]=0;for(i=1;i<=2*n+r*(r+5)/2+2*q+1;i=i+1){work[i]=0}for(i=1;i<=2;i=i+1){iter[i]=0}qpgen2(Dmat,dvec,n,n,sol,crval,Amat,bvec,n,q,meq,iact,nact,iter,work,factorized);message="";if(factorized[1]===1){message="constraints are inconsistent, no solution!"}if(factorized[1]===2){message="matrix D in quadratic function is not positive definite!"}return{solution:base1to0(sol),value:base1to0(crval),unconstrained_solution:base1to0(dvec),iterations:base1to0(iter),iact:base1to0(iact),message:message}}exports.solveQP=solveQP})(numeric);numeric.svd=function svd(A){var temp;var prec=numeric.epsilon;var tolerance=1e-64/prec;var itmax=50;var c=0;var i=0;var j=0;var k=0;var l=0;var u=numeric.clone(A);var m=u.length;var n=u[0].length;if(m<n)throw"Need more rows than columns";var e=new Array(n);var q=new Array(n);for(i=0;i<n;i++)e[i]=q[i]=0;var v=numeric.rep([n,n],0);function pythag(a,b){a=Math.abs(a);b=Math.abs(b);if(a>b)return a*Math.sqrt(1+b*b/a/a);else if(b==0)return a;return b*Math.sqrt(1+a*a/b/b)}var f=0;var g=0;var h=0;var x=0;var y=0;var z=0;var s=0;for(i=0;i<n;i++){e[i]=g;s=0;l=i+1;for(j=i;j<m;j++)s+=u[j][i]*u[j][i];if(s<=tolerance)g=0;else{f=u[i][i];g=Math.sqrt(s);if(f>=0)g=-g;h=f*g-s;u[i][i]=f-g;for(j=l;j<n;j++){s=0;for(k=i;k<m;k++)s+=u[k][i]*u[k][j];f=s/h;for(k=i;k<m;k++)u[k][j]+=f*u[k][i]}}q[i]=g;s=0;for(j=l;j<n;j++)s=s+u[i][j]*u[i][j];if(s<=tolerance)g=0;else{f=u[i][i+1];g=Math.sqrt(s);if(f>=0)g=-g;h=f*g-s;u[i][i+1]=f-g;for(j=l;j<n;j++)e[j]=u[i][j]/h;for(j=l;j<m;j++){s=0;for(k=l;k<n;k++)s+=u[j][k]*u[i][k];for(k=l;k<n;k++)u[j][k]+=s*e[k]}}y=Math.abs(q[i])+Math.abs(e[i]);if(y>x)x=y}for(i=n-1;i!=-1;i+=-1){if(g!=0){h=g*u[i][i+1];for(j=l;j<n;j++)v[j][i]=u[i][j]/h;for(j=l;j<n;j++){s=0;for(k=l;k<n;k++)s+=u[i][k]*v[k][j];for(k=l;k<n;k++)v[k][j]+=s*v[k][i]}}for(j=l;j<n;j++){v[i][j]=0;v[j][i]=0}v[i][i]=1;g=e[i];l=i}for(i=n-1;i!=-1;i+=-1){l=i+1;g=q[i];for(j=l;j<n;j++)u[i][j]=0;if(g!=0){h=u[i][i]*g;for(j=l;j<n;j++){s=0;for(k=l;k<m;k++)s+=u[k][i]*u[k][j];f=s/h;for(k=i;k<m;k++)u[k][j]+=f*u[k][i]}for(j=i;j<m;j++)u[j][i]=u[j][i]/g}else for(j=i;j<m;j++)u[j][i]=0;u[i][i]+=1}prec=prec*x;for(k=n-1;k!=-1;k+=-1){for(var iteration=0;iteration<itmax;iteration++){var test_convergence=false;for(l=k;l!=-1;l+=-1){if(Math.abs(e[l])<=prec){test_convergence=true;break}if(Math.abs(q[l-1])<=prec)break}if(!test_convergence){c=0;s=1;var l1=l-1;for(i=l;i<k+1;i++){f=s*e[i];e[i]=c*e[i];if(Math.abs(f)<=prec)break;g=q[i];h=pythag(f,g);q[i]=h;c=g/h;s=-f/h;for(j=0;j<m;j++){y=u[j][l1];z=u[j][i];u[j][l1]=y*c+z*s;u[j][i]=-y*s+z*c}}}z=q[k];if(l==k){if(z<0){q[k]=-z;for(j=0;j<n;j++)v[j][k]=-v[j][k]}break}if(iteration>=itmax-1)throw"Error: no convergence.";x=q[l];y=q[k-1];g=e[k-1];h=e[k];f=((y-z)*(y+z)+(g-h)*(g+h))/(2*h*y);g=pythag(f,1);if(f<0)f=((x-z)*(x+z)+h*(y/(f-g)-h))/x;else f=((x-z)*(x+z)+h*(y/(f+g)-h))/x;c=1;s=1;for(i=l+1;i<k+1;i++){g=e[i];y=q[i];h=s*g;g=c*g;z=pythag(f,h);e[i-1]=z;c=f/z;s=h/z;f=x*c+g*s;g=-x*s+g*c;h=y*s;y=y*c;for(j=0;j<n;j++){x=v[j][i-1];z=v[j][i];v[j][i-1]=x*c+z*s;v[j][i]=-x*s+z*c}z=pythag(f,h);q[i-1]=z;c=f/z;s=h/z;f=c*g+s*y;x=-s*g+c*y;for(j=0;j<m;j++){y=u[j][i-1];z=u[j][i];u[j][i-1]=y*c+z*s;u[j][i]=-y*s+z*c}}e[l]=0;e[k]=f;q[k]=x}}for(i=0;i<q.length;i++)if(q[i]<prec)q[i]=0;for(i=0;i<n;i++){for(j=i-1;j>=0;j--){if(q[j]<q[i]){c=q[j];q[j]=q[i];q[i]=c;for(k=0;k<u.length;k++){temp=u[k][i];u[k][i]=u[k][j];u[k][j]=temp}for(k=0;k<v.length;k++){temp=v[k][i];v[k][i]=v[k][j];v[k][j]=temp}i=j}}}return{U:u,S:q,V:v}}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],rbf:[function(require,module,exports){(function(){if(typeof module!=="undefined"&&module.exports){var numeric=require("numeric");onload(numeric)}else if(typeof define!=="undefined"&&define.amd){define(["numeric"],onload)}else{onload(window.numeric)}function onload(numeric){function distanceLinear(pa,pb){return numeric.norm2(numeric.sub(pb,pa))}function distanceCubic(pa,pb){return Math.pow(distanceLinear(pa,pb),3)}var distanceFunctions={linear:distanceLinear,cubic:distanceCubic};function RBF(points,values,distanceFunction){var distance=distanceFunctions.linear; | |
if(distanceFunction){distance=typeof distanceFunction!=="string"?distanceFunction:distanceFunctions[distanceFunction]}var M=numeric.identity(points.length);for(var j=0;j<points.length;j++){for(var i=0;i<points.length;i++){M[j][i]=distance(points[i],points[j])}}var LU=numeric.LU(M);var w=numeric.LUsolve(LU,values);function interpolant(p){var distances=points.map(function(point){return distance(p,point)});var products=numeric.mul(distances,w);var sum=products.reduce(function(acc,value){return acc+value},0);return sum}return interpolant}if(typeof module!=="undefined"&&module.exports){module.exports=RBF}else if(typeof define!=="undefined"&&define.amd){return RBF}else{window.RBF=RBF}}})()},{numeric:1}]},{},[]);var shell=require("gl-now")();var bunny=require("bunny");var normals=require("normals");var createGeometry=require("gl-geometry");var createShader=require("gl-shader");var mat4=require("gl-matrix").mat4;var RBF=require("rbf");var geom,shader,start,warped;var vertexShader=" attribute vec3 position; attribute vec3 normal ; uniform mat4 mv; uniform mat4 proj; varying vec3 v_normal; varying vec3 v_position; void main() { gl_Position = proj * mv * vec4(position, 1.0); v_normal = vec3(mv * vec4(normal, 0.0)); v_position = vec3(mv * vec4(position, 1.0)); } ";var fragmentShader=" precision mediump float; uniform vec3 ambient; uniform vec3 diffuse; varying vec3 v_normal; varying vec3 v_position; void main() { vec3 N = normalize(v_normal); vec3 E = normalize(- v_position); float f = max(dot(N, E), 0.0); gl_FragColor = vec4(ambient + diffuse * f, 1.0); } ";shell.on("gl-init",function(){var gl=shell.gl;gl.enable(gl.DEPTH_TEST);var far=1e6;var points=[[-far,0,0],[0,-far,0],[0,0,-far],[far,0,0],[0,far,0],[0,0,far],[-3.83,7.51,2.43],[-1.044,8.22,.03],[-3.76,7.41,-.68],[2.57,5.86,1.15],[-4.594316,5.771342,3.01694],[.19,9.5,-1.48],[-3.45,9.05,-3.35],[4.83,1.37,.84],[3.91,3.81,1.35]];var displaced=[[-far,0,0],[0,-far,0],[0,0,-far],[far,0,0],[0,far,0],[0,0,far],[-3.83,7.51,2.43],[-1.044,8.22,.03],[-3.76,7.41,-.68],[2.57,5.86,1.15],[-4.594316,5.771342,4.01694],[.19,7.5,-1.48],[-2.45,9.05,-2.35],[7.83,1.37,.84],[2.41,3.81,1.35]];valuesX=displaced.map(function(p){return p[0]});valuesY=displaced.map(function(p){return p[1]});valuesZ=displaced.map(function(p){return p[2]});var rbfX=new RBF(points,valuesX);var rbfY=new RBF(points,valuesY);var rbfZ=new RBF(points,valuesZ);warped=bunny.positions.map(function(position){return[rbfX(position),rbfY(position),rbfZ(position)]});bunny.normals=normals.vertexNormals(bunny.cells,bunny.positions);geom=createGeometry(shell.gl).attr("position",bunny.positions).attr("normal",bunny.normals).faces(bunny.cells);shader=createShader(shell.gl,vertexShader,fragmentShader);start=performance.now()});shell.on("gl-render",function(){var t=performance.now()-start;shader.bind();var proj=mat4.create();mat4.perspective(proj,Math.PI/4,shell.width/shell.height,.1,1e3);var mv=mat4.create();mat4.lookAt(mv,[0,0,20],[0,4,0],[0,1,0]);mat4.rotateX(mv,mv,Math.PI/6);mat4.rotateY(mv,mv,2*Math.PI*(t/1e3)/20*-1);var mesh={cells:bunny.cells,positions:lerpPositions(bunny.positions,warped,Math.sin(2*Math.PI*t/1e3*.5))};mesh.normals=normals.vertexNormals(mesh.cells,mesh.positions);geom.dispose();geom=createGeometry(shell.gl).attr("position",mesh.positions).attr("normal",mesh.normals).faces(mesh.cells);geom.bind(shader);shader.uniforms.proj=proj;shader.uniforms.mv=mv;shader.uniforms.ambient=[.5,.5,.5];shader.uniforms.diffuse=[.5,.5,.5];var gl=shell.gl;gl.clearColor(1,1,1,1);gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT);geom.draw()});function lerpPositions(a,b,t){var c=new Array(a.length);for(var i=0;i<a.length;i++){c[i]=lerp(a[i],b[i],t)}return c}function lerp(a,b,t){var c=new Array(a.length);for(var i=0;i<a.length;i++){c[i]=a[i]*t+b[i]*(1-t)}return c} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "requirebin-sketch", | |
"version": "1.0.0", | |
"dependencies": { | |
"gl-now": "1.4.0", | |
"bunny": "1.0.1", | |
"normals": "1.0.1", | |
"gl-geometry": "1.0.3", | |
"gl-shader": "4.0.0", | |
"gl-matrix": "2.1.0", | |
"rbf": "0.1.1" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style type='text/css'>html, body { margin: 0; padding: 0; border: 0; } | |
body, html { height: 100%; width: 100%; }</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment