/* VECTOR */ function Vector(size,values) { this.size = size; this.values = new Array(this.size); for (var i=0;i<this.size;i++) this.values[i]=0.0; if (values) { if (values instanceof Vector) values=values.values; for (var i=0;i<Math.min(this.size,values.length);i++) this.values[i]=values[i]; } } Vector.prototype.resized=function(size) { return new Vector(size,this); }; Vector.prototype.multiplyScalar=function(b) { var c=new Vector(this.size); for (var i in this.values) c.values[i]=(this.values[i]*b); return c; }; Vector.prototype.divideScalar=function(b) { var c=new Vector(this.size); for (var i in this.values) c.values[i]=(this.values[i]/b); return c; }; Vector.prototype.addVector=function(b) { var c=new Vector(this.size); for (var i in this.values) c.values[i]=(this.values[i]+b.values[i]); return c; }; Vector.prototype.subtractVector=function(b) { var c=new Vector(this.size); for (var i in this.values) c.values[i]=(this.values[i]-b.values[i]); return c; }; Vector.prototype.length2=function() { var l2=0.0; for (var i in this.values) l2+=(this.values[i]*this.values[i]); return l2; }; Vector.prototype.length=function() { return Math.sqrt(this.length2()); }; Vector.prototype.dot=function(b) { var d=0.0; for (var i in this.values) d+=(this.values[i]*b.values[i]); return d; }; Vector.prototype.cross=function(b) { if (this.size!=3 || b.size!=3) throw new Error("Cross product is only defined for vectors with a length of 3"); var c=new Vector(3); c.values[0]=(this.values[1]*b.values[2])-(this.values[2]*b.values[1]); c.values[1]=(this.values[2]*b.values[0])-(this.values[0]*b.values[2]); c.values[2]=(this.values[0]*b.values[1])-(this.values[1]*b.values[0]); return c; }; Vector.prototype.normalized=function() { return this.divideScalar(this.length()); }; Vector.prototype.negated=function() { var c=new Vector(this.size); for (var i in this.values) c.values[i]=-this.values[i]; return c; }; /* MATRIX */ function degreesToRadians(degrees) { return (degrees*(Math.PI/180)); } function Matrix(rows,columns,values) { this.rows = rows; this.columns = columns; this.values = new Array(this.rows*this.columns); for (var i=0;i<this.rows;i++) for (var j=0;j<this.columns;j++) this.set(i,j,(i==j? 1.0:0.0)); if (values) { if (values instanceof Matrix) { for (var i=0;i<Math.min(this.rows,values.rows);i++) for (var j=0;j<Math.min(this.columns,values.columns);j++) this.set(i,j,values.get(i,j)); return; } if (values.length>(this.rows*this.columns)) throw Error("Too many arguments for matrix constructor"); var k=0; for (var j=0;j<this.columns;j++) for (var i=0;i<this.rows;i++) this.set(i,j,values[k++]); } } Matrix.prototype.get=function(i,j) { return this.values[i + j*this.rows]; }; Matrix.prototype.set=function(i,j,value) { this.values[i + j*this.rows]=value; }; Matrix.prototype.resized=function(rows,columns) { return new Matrix(rows,columns,this); }; Matrix.prototype.multiplyMatrix=function(b) { if (this.columns!=b.rows) throw new Error("Cannot multiply matrices: size mismatch"); var c=new Matrix(this.rows,b.columns); for (var i=0;i<this.rows;i++) for (var j=0;j<b.columns;j++) { var sum=0.0; for (var k=0;k<this.columns;k++) sum+=(this.get(i,k)*b.get(k,j)); c.set(i,j,sum); } return c; }; Matrix.prototype.multiplyVector=function(b) { if (this.columns!=b.size) throw new Error("Cannot multiply matrix and vector: size mismatch"); var c=new Vector(b.size); for (var i=0;i<this.rows;i++) { var sum=0.0; for (var k=0;k<this.columns;k++) sum+=(this.get(i,k)*b.values[k]); c.values[i]=sum; } return c; }; Matrix.rotationX3=function(r) { r=degreesToRadians(r); var c=Math.cos(r); var s=Math.sin(r); return new Matrix(3,3, [ 1.0, 0.0, 0.0, 0.0, c, s, 0.0, -s, c ]); }; Matrix.rotationY3=function(r) { r=degreesToRadians(r); var c=Math.cos(r); var s=Math.sin(r); return new Matrix(3,3, [ c, 0.0, -s, 0.0, 1.0, 0.0, s, 0.0, c ]); }; Matrix.rotationZ3=function(r) { r=degreesToRadians(r); var c=Math.cos(r); var s=Math.sin(r); return new Matrix(3,3, [ c, s, 0.0, -s, c, 0.0, 0.0, 0.0, 1.0 ]); }; Matrix.scale3=function(x,y,z) { return new Matrix(3,3, [ x, 0.0, 0.0, 0.0, y, 0.0, 0.0, 0.0, z ]); }; Matrix.translation4=function(x,y,z) { return new Matrix(4,4, [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, x, y, z, 1.0 ]); }; Matrix.perspective4=function(fov,aspect,near,far) { fov=degreesToRadians(fov); var f=(1.0/Math.tan(fov/2)); return new Matrix(4,4, [ (f/aspect), 0.0, 0.0, 0.0, 0.0, f, 0.0, 0.0, 0.0, 0.0, ((far+near)/(near-far)), -1.0, 0.0, 0.0, ((2*far*near)/(near-far)), 0.0 ]); }; /* RENDER */ var CAMERA_DIRECTION=new Vector(3,[0.0,0.0,1.0]); function clamp(value,min,max) { if (value<min) return min; if (value>max) return max; return value; } function render(context,projection,modelView,vertices,faces) { function DrawFace(normal,depth2,points) { this.normal = normal; this.depth2 = depth2; this.points = points; } /* Backface culling: */ var drawFaces=[]; for (var i in faces) { /* Transform points to model+view space: */ var points=[]; for (var j in faces[i]) { var vertex=new Vector(4,vertices[faces[i][j]]); vertex.values[3]=1.0; vertex=modelView.multiplyVector(vertex); vertex=vertex.divideScalar(vertex.values[3]); points.push(new Vector(3,vertex.values)); } /* Calculate normal: */ var u=(points[2].subtractVector(points[0])); var v=(points[2].subtractVector(points[1])); var normal=u.cross(v).normalized(); /* Calculate center: */ var center=(points[0].addVector(points[1]).addVector(points[2])).divideScalar(3.0); /* Save front facing faces: */ if (normal.dot(center)<0.0) drawFaces.push(new DrawFace(normal,center.length2(),points)); } /* Sort faces back to front: */ drawFaces.sort(function(a,b) { return (b.depth2-a.depth2); }); /* Draw faces: */ for (var i in drawFaces) { /* Transform points to projection space: */ var points=[]; for (var j in drawFaces[i].points) { var vertex=new Vector(4,drawFaces[i].points[j]); vertex.values[3]=1.0; vertex=projection.multiplyVector(vertex); vertex=vertex.divideScalar(vertex.values[3]); points.push(new Vector(3,vertex.values)); } /* Draw face: */ context.beginPath(); context.moveTo(points[0].values[0],points[0].values[1]); context.lineTo(points[1].values[0],points[1].values[1]); context.lineTo(points[2].values[0],points[2].values[1]); context.closePath(); /* Lighting: */ var intensity = clamp(drawFaces[i].normal.dot(CAMERA_DIRECTION),0.0,1.0); var value = parseInt(255*intensity); var color = ("#"+value.toString(16)+"0000"); context.fillStyle=color; context.fill(); context.strokeStyle=color; context.stroke(); } } /* MESH */ var mesh = { "vertices" : [ [0.4375,0.1640624701976776,0.765625], [-0.4375,0.1640624701976776,0.765625], [0.5,0.09374997019767761,0.6875], [-0.5,0.09374997019767761,0.6875], [0.546875,0.05468747392296791,0.578125], [-0.546875,0.05468747392296791,0.578125], [0.3515625,-0.02343752607703209,0.6171875], [-0.3515625,-0.02343752607703209,0.6171875], [0.3515625,0.031249968335032463,0.71875], [-0.3515625,0.031249968335032463,0.71875], [0.3515625,0.1328124701976776,0.78125], [-0.3515625,0.1328124701976776,0.78125], [0.2734375,0.1640624701976776,0.796875], [-0.2734375,0.1640624701976776,0.796875], [0.203125,0.09374997019767761,0.7421875], [-0.203125,0.09374997019767761,0.7421875], [0.15625,0.05468747019767761,0.6484375], [-0.15625,0.05468747019767761,0.6484375], [0.078125,0.2421874701976776,0.65625], [-0.078125,0.2421874701976776,0.65625], [0.140625,0.2421874701976776,0.7421875], [-0.140625,0.2421874701976776,0.7421875], [0.2421875,0.2421874701976776,0.796875], [-0.2421875,0.2421874701976776,0.796875], [0.2734375,0.3281249701976776,0.796875], [-0.2734375,0.3281249701976776,0.796875], [0.203125,0.3906249701976776,0.7421875], [-0.203125,0.3906249701976776,0.7421875], [0.15625,0.4374999701976776,0.6484375], [-0.15625,0.4374999701976776,0.6484375], [0.3515625,0.515625,0.6171875], [-0.3515625,0.515625,0.6171875], [0.3515625,0.4531249701976776,0.71875], [-0.3515625,0.4531249701976776,0.71875], [0.3515625,0.3593749701976776,0.78125], [-0.3515625,0.3593749701976776,0.78125], [0.4375,0.3281249701976776,0.765625], [-0.4375,0.3281249701976776,0.765625], [0.5,0.3906249701976776,0.6875], [-0.5,0.3906249701976776,0.6875], [0.546875,0.4374999701976776,0.578125], [-0.546875,0.4374999701976776,0.578125], [0.625,0.2421874701976776,0.5625], [-0.625,0.2421874701976776,0.5625], [0.5625,0.2421874701976776,0.671875], [-0.5625,0.2421874701976776,0.671875], [0.46875,0.2421874701976776,0.7578125], [-0.46875,0.2421874701976776,0.7578125], [0.4765625,0.2421874701976776,0.7734375], [-0.4765625,0.2421874701976776,0.7734375], [0.4453125,0.3359374701976776,0.78125], [-0.4453125,0.3359374701976776,0.78125], [0.3515625,0.3749999701976776,0.8046875], [-0.3515625,0.3749999701976776,0.8046875], [0.265625,0.3359374701976776,0.8203125], [-0.265625,0.3359374701976776,0.8203125], [0.2265625,0.2421874701976776,0.8203125], [-0.2265625,0.2421874701976776,0.8203125], [0.265625,0.1562499701976776,0.8203125], [-0.265625,0.1562499701976776,0.8203125], [0.3515625,0.2421874701976776,0.828125], [-0.3515625,0.2421874701976776,0.828125], [0.3515625,0.11718746274709702,0.8046875], [-0.3515625,0.11718746274709702,0.8046875], [0.4453125,0.1562499701976776,0.78125], [-0.4453125,0.1562499701976776,0.78125], [0.0,0.4296874701976776,0.7421875], [0.0,0.3515624701976776,0.8203125], [0.0,-0.6796875596046448,0.734375], [0.0,-0.3203125298023224,0.78125], [0.0,-0.1875000298023224,0.796875], [0.0,-0.7734375596046448,0.7187499403953552], [0.0,0.4062499701976776,0.6015625], [0.0,0.5703125,0.5703125], [0.0,0.8984375,-0.5468749403953552], [0.0,0.5625000596046448,-0.8515625], [0.0,0.07031253725290298,-0.828125], [0.0,-0.3828124701976776,-0.3515625298023224], [0.203125,-0.1875000298023224,0.5625], [-0.203125,-0.1875000298023224,0.5625], [0.3125,-0.4375000298023224,0.5703125], [-0.3125,-0.4375000298023224,0.5703125], [0.3515625,-0.6953125,0.5703124403953552], [-0.3515625,-0.6953125,0.5703124403953552], [0.3671875,-0.890625,0.5312499403953552], [-0.3671875,-0.890625,0.5312499403953552], [0.328125,-0.9453125,0.5234374403953552], [-0.328125,-0.9453125,0.5234374403953552], [0.1796875,-0.96875,0.5546874403953552], [-0.1796875,-0.96875,0.5546874403953552], [0.0,-0.984375,0.5781249403953552], [0.4375,-0.1406250298023224,0.53125], [-0.4375,-0.1406250298023224,0.53125], [0.6328125,-0.03906252235174179,0.5390625], [-0.6328125,-0.03906252235174179,0.5390625], [0.828125,0.1484374850988388,0.4453125], [-0.828125,0.1484374850988388,0.4453125], [0.859375,0.4296874701976776,0.59375], [-0.859375,0.4296874701976776,0.59375], [0.7109375,0.4843749701976776,0.625], [-0.7109375,0.4843749701976776,0.625], [0.4921875,0.6015624403953552,0.6875], [-0.4921875,0.6015624403953552,0.6875], [0.3203125,0.7578124403953552,0.7343750596046448], [-0.3203125,0.7578124403953552,0.7343750596046448], [0.15625,0.7187499403953552,0.7578125596046448], [-0.15625,0.7187499403953552,0.7578125596046448], [0.0625,0.4921874701976776,0.75], [-0.0625,0.4921874701976776,0.75], [0.1640625,0.4140624701976776,0.7734375], [-0.1640625,0.4140624701976776,0.7734375], [0.125,0.3046874701976776,0.765625], [-0.125,0.3046874701976776,0.765625], [0.203125,0.09374997019767761,0.7421875], [-0.203125,0.09374997019767761,0.7421875], [0.375,0.015624969266355038,0.703125], [-0.375,0.015624969266355038,0.703125], [0.4921875,0.06249997019767761,0.671875], [-0.4921875,0.06249997019767761,0.671875], [0.625,0.1874999701976776,0.6484375], [-0.625,0.1874999701976776,0.6484375], [0.640625,0.2968749701976776,0.6484375], [-0.640625,0.2968749701976776,0.6484375], [0.6015625,0.3749999701976776,0.6640625], [-0.6015625,0.3749999701976776,0.6640625], [0.4296875,0.4374999701976776,0.71875], [-0.4296875,0.4374999701976776,0.71875], [0.25,0.4687499701976776,0.7578125], [-0.25,0.4687499701976776,0.7578125], [0.0,-0.7656250596046448,0.7343749403953552], [0.109375,-0.7187500596046448,0.7343749403953552], [-0.109375,-0.7187500596046448,0.7343749403953552], [0.1171875,-0.8359375596046448,0.7109374403953552], [-0.1171875,-0.8359375596046448,0.7109374403953552], [0.0625,-0.8828125596046448,0.6953124403953552], [-0.0625,-0.8828125596046448,0.6953124403953552], [0.0,-0.8906250596046448,0.6874999403953552], [0.0,-0.1953125298023224,0.75], [0.0,-0.1406250298023224,0.7421875], [0.1015625,-0.1484375298023224,0.7421875], [-0.1015625,-0.1484375298023224,0.7421875], [0.125,-0.2265625298023224,0.75], [-0.125,-0.2265625298023224,0.75], [0.0859375,-0.2890625298023224,0.7421875], [-0.0859375,-0.2890625298023224,0.7421875], [0.3984375,-0.04687502980232239,0.671875], [-0.3984375,-0.04687502980232239,0.671875], [0.6171875,0.05468747392296791,0.625], [-0.6171875,0.05468747392296791,0.625], [0.7265625,0.2031249701976776,0.6015625], [-0.7265625,0.2031249701976776,0.6015625], [0.7421875,0.3749999701976776,0.65625], [-0.7421875,0.3749999701976776,0.65625], [0.6875,0.4140624701976776,0.7265625], [-0.6875,0.4140624701976776,0.7265625], [0.4375,0.5468749403953552,0.796875], [-0.4375,0.5468749403953552,0.796875], [0.3125,0.6406249403953552,0.8359375], [-0.3125,0.6406249403953552,0.8359375], [0.203125,0.6171874403953552,0.8515625], [-0.203125,0.6171874403953552,0.8515625], [0.1015625,0.4296874701976776,0.84375], [-0.1015625,0.4296874701976776,0.84375], [0.125,-0.10156253725290298,0.8125], [-0.125,-0.10156253725290298,0.8125], [0.2109375,-0.4453125298023224,0.7109375], [-0.2109375,-0.4453125298023224,0.7109375], [0.25,-0.7031250596046448,0.6874999403953552], [-0.25,-0.7031250596046448,0.6874999403953552], [0.265625,-0.8203125,0.6640624403953552], [-0.265625,-0.8203125,0.6640624403953552], [0.234375,-0.9140625,0.6328124403953552], [-0.234375,-0.9140625,0.6328124403953552], [0.1640625,-0.9296875,0.6328124403953552], [-0.1640625,-0.9296875,0.6328124403953552], [0.0,-0.9453125,0.6406249403953552], [0.0,0.046874966472387314,0.7265625], [0.0,0.2109374701976776,0.765625], [0.328125,0.4765624701976776,0.7421875], [-0.328125,0.4765624701976776,0.7421875], [0.1640625,0.1406249701976776,0.75], [-0.1640625,0.1406249701976776,0.75], [0.1328125,0.2109374701976776,0.7578125], [-0.1328125,0.2109374701976776,0.7578125], [0.1171875,-0.6875000596046448,0.7343749403953552], [-0.1171875,-0.6875000596046448,0.7343749403953552], [0.078125,-0.4453125298023224,0.75], [-0.078125,-0.4453125298023224,0.75], [0.0,-0.4453125298023224,0.75], [0.0,-0.3281250298023224,0.7421875], [0.09375,-0.2734375298023224,0.78125], [-0.09375,-0.2734375298023224,0.78125], [0.1328125,-0.2265625298023224,0.796875], [-0.1328125,-0.2265625298023224,0.796875], [0.109375,-0.1328125298023224,0.78125], [-0.109375,-0.1328125298023224,0.78125], [0.0390625,-0.1250000298023224,0.78125], [-0.0390625,-0.1250000298023224,0.78125], [0.0,-0.2031250298023224,0.828125], [0.046875,-0.1484375298023224,0.8125], [-0.046875,-0.1484375298023224,0.8125], [0.09375,-0.1562500298023224,0.8125], [-0.09375,-0.1562500298023224,0.8125], [0.109375,-0.2265625298023224,0.828125], [-0.109375,-0.2265625298023224,0.828125], [0.078125,-0.2500000298023224,0.8046875], [-0.078125,-0.2500000298023224,0.8046875], [0.0,-0.2890625298023224,0.8046875], [0.2578125,-0.3125000298023224,0.5546875], [-0.2578125,-0.3125000298023224,0.5546875], [0.1640625,-0.2421875298023224,0.7109375], [-0.1640625,-0.2421875298023224,0.7109375], [0.1796875,-0.3125000298023224,0.7109375], [-0.1796875,-0.3125000298023224,0.7109375], [0.234375,-0.2500000298023224,0.5546875], [-0.234375,-0.2500000298023224,0.5546875], [0.0,-0.8750000596046448,0.6874999403953552], [0.046875,-0.8671875596046448,0.6874999403953552], [-0.046875,-0.8671875596046448,0.6874999403953552], [0.09375,-0.8203125596046448,0.7109374403953552], [-0.09375,-0.8203125596046448,0.7109374403953552], [0.09375,-0.7421875596046448,0.7265624403953552], [-0.09375,-0.7421875596046448,0.7265624403953552], [0.0,-0.78125,0.6562499403953552], [0.09375,-0.75,0.6640624403953552], [-0.09375,-0.75,0.6640624403953552], [0.09375,-0.8125,0.6406249403953552], [-0.09375,-0.8125,0.6406249403953552], [0.046875,-0.8515625,0.6328124403953552], [-0.046875,-0.8515625,0.6328124403953552], [0.0,-0.859375,0.6328124403953552], [0.171875,0.2187499701976776,0.78125], [-0.171875,0.2187499701976776,0.78125], [0.1875,0.1562499701976776,0.7734375], [-0.1875,0.1562499701976776,0.7734375], [0.3359375,0.4296874701976776,0.7578125], [-0.3359375,0.4296874701976776,0.7578125], [0.2734375,0.4218749701976776,0.7734375], [-0.2734375,0.4218749701976776,0.7734375], [0.421875,0.3984374701976776,0.7734375], [-0.421875,0.3984374701976776,0.7734375], [0.5625,0.3515624701976776,0.6953125], [-0.5625,0.3515624701976776,0.6953125], [0.5859375,0.2890624701976776,0.6875], [-0.5859375,0.2890624701976776,0.6875], [0.578125,0.1953124701976776,0.6796875], [-0.578125,0.1953124701976776,0.6796875], [0.4765625,0.10156247019767761,0.71875], [-0.4765625,0.10156247019767761,0.71875], [0.375,0.062499966472387314,0.7421875], [-0.375,0.062499966472387314,0.7421875], [0.2265625,0.10937496274709702,0.78125], [-0.2265625,0.10937496274709702,0.78125], [0.1796875,0.2968749701976776,0.78125], [-0.1796875,0.2968749701976776,0.78125], [0.2109375,0.3749999701976776,0.78125], [-0.2109375,0.3749999701976776,0.78125], [0.234375,0.3593749701976776,0.7578125], [-0.234375,0.3593749701976776,0.7578125], [0.1953125,0.2968749701976776,0.7578125], [-0.1953125,0.2968749701976776,0.7578125], [0.2421875,0.12499997019767761,0.7578125], [-0.2421875,0.12499997019767761,0.7578125], [0.375,0.08593747019767761,0.7265625], [-0.375,0.08593747019767761,0.7265625], [0.4609375,0.11718747019767761,0.703125], [-0.4609375,0.11718747019767761,0.703125], [0.546875,0.2109374701976776,0.671875], [-0.546875,0.2109374701976776,0.671875], [0.5546875,0.2812499701976776,0.671875], [-0.5546875,0.2812499701976776,0.671875], [0.53125,0.3359374701976776,0.6796875], [-0.53125,0.3359374701976776,0.6796875], [0.4140625,0.3906249701976776,0.75], [-0.4140625,0.3906249701976776,0.75], [0.28125,0.3984374701976776,0.765625], [-0.28125,0.3984374701976776,0.765625], [0.3359375,0.4062499701976776,0.75], [-0.3359375,0.4062499701976776,0.75], [0.203125,0.1718749701976776,0.75], [-0.203125,0.1718749701976776,0.75], [0.1953125,0.2265624701976776,0.75], [-0.1953125,0.2265624701976776,0.75], [0.109375,0.4609374701976776,0.609375], [-0.109375,0.4609374701976776,0.609375], [0.1953125,0.6640625,0.6171875], [-0.1953125,0.6640625,0.6171875], [0.3359375,0.6875,0.5937500596046448], [-0.3359375,0.6875,0.5937500596046448], [0.484375,0.5546875,0.5546875], [-0.484375,0.5546875,0.5546875], [0.6796875,0.4531249701976776,0.4921875298023224], [-0.6796875,0.4531249701976776,0.4921875298023224], [0.796875,0.4062499701976776,0.4609375298023224], [-0.796875,0.4062499701976776,0.4609375298023224], [0.7734375,0.1640624850988388,0.375], [-0.7734375,0.1640624850988388,0.375], [0.6015625,-1.809924654594397e-08,0.4140625], [-0.6015625,-1.809924654594397e-08,0.4140625], [0.4375,-0.09375002235174179,0.46875], [-0.4375,-0.09375002235174179,0.46875], [0.0,0.8984375,0.2890625298023224], [0.0,0.984375,-0.07812495529651642], [0.0,-0.1953124701976776,-0.671875], [0.0,-0.4609375,0.1874999850988388], [0.0,-0.9765625,0.4609374701976776], [0.0,-0.8046875,0.3437499701976776], [0.0,-0.5703125,0.3203124701976776], [0.0,-0.484375,0.2812499701976776], [0.8515625,0.234375,0.054687511175870895], [-0.8515625,0.234375,0.054687511175870895], [0.859375,0.3203125,-0.046874985098838806], [-0.859375,0.3203125,-0.046874985098838806], [0.7734375,0.2656250298023224,-0.4375], [-0.7734375,0.2656250298023224,-0.4375], [0.4609375,0.4375000298023224,-0.703125], [-0.4609375,0.4375000298023224,-0.703125], [0.734375,-0.0468750037252903,0.0703125], [-0.734375,-0.0468750037252903,0.0703125], [0.59375,-0.1249999925494194,-0.1640625], [-0.59375,-0.1249999925494194,-0.1640625], [0.640625,-0.007812481373548508,-0.4296875], [-0.640625,-0.007812481373548508,-0.4296875], [0.3359375,0.05468752980232239,-0.6640625], [-0.3359375,0.05468752980232239,-0.6640625], [0.234375,-0.3515625298023224,0.4062499701976776], [-0.234375,-0.3515625298023224,0.4062499701976776], [0.1796875,-0.4140625,0.2578124701976776], [-0.1796875,-0.4140625,0.2578124701976776], [0.2890625,-0.7109375,0.3828124701976776], [-0.2890625,-0.7109375,0.3828124701976776], [0.25,-0.5,0.3906249701976776], [-0.25,-0.5,0.3906249701976776], [0.328125,-0.9140625,0.3984374701976776], [-0.328125,-0.9140625,0.3984374701976776], [0.140625,-0.7578125,0.3671874701976776], [-0.140625,-0.7578125,0.3671874701976776], [0.125,-0.5390625,0.3593749701976776], [-0.125,-0.5390625,0.3593749701976776], [0.1640625,-0.9453125,0.4374999701976776], [-0.1640625,-0.9453125,0.4374999701976776], [0.21875,-0.2812500298023224,0.4296875], [-0.21875,-0.2812500298023224,0.4296875], [0.2109375,-0.2265625149011612,0.46875], [-0.2109375,-0.2265625149011612,0.46875], [0.203125,-0.1718750149011612,0.5], [-0.203125,-0.1718750149011612,0.5], [0.2109375,-0.390625,0.1640624850988388], [-0.2109375,-0.390625,0.1640624850988388], [0.296875,-0.3125,-0.265625], [-0.296875,-0.3125,-0.265625], [0.34375,-0.1484374701976776,-0.5390625], [-0.34375,-0.1484374701976776,-0.5390625], [0.453125,0.8671875,-0.3828124701976776], [-0.453125,0.8671875,-0.3828124701976776], [0.453125,0.9296875,-0.07031246274709702], [-0.453125,0.9296875,-0.07031246274709702], [0.453125,0.8515625,0.2343750298023224], [-0.453125,0.8515625,0.2343750298023224], [0.4609375,0.5234375,0.4296875298023224], [-0.4609375,0.5234375,0.4296875298023224], [0.7265625,0.40625,0.3359375298023224], [-0.7265625,0.40625,0.3359375298023224], [0.6328125,0.453125,0.2812500298023224], [-0.6328125,0.453125,0.2812500298023224], [0.640625,0.703125,0.05468752980232239], [-0.640625,0.703125,0.05468752980232239], [0.796875,0.5625,0.1250000298023224], [-0.796875,0.5625,0.1250000298023224], [0.796875,0.6171875,-0.11718747019767761], [-0.796875,0.6171875,-0.11718747019767761], [0.640625,0.75,-0.1953124701976776], [-0.640625,0.75,-0.1953124701976776], [0.640625,0.6796875,-0.4453124701976776], [-0.640625,0.6796875,-0.4453124701976776], [0.796875,0.5390625,-0.3593749701976776], [-0.796875,0.5390625,-0.3593749701976776], [0.6171875,0.3281250298023224,-0.5859375], [-0.6171875,0.3281250298023224,-0.5859375], [0.484375,0.02343752421438694,-0.546875], [-0.484375,0.02343752421438694,-0.546875], [0.8203125,0.328125,-0.2031249850988388], [-0.8203125,0.328125,-0.2031249850988388], [0.40625,-0.171875,0.1484374850988388], [-0.40625,-0.171875,0.1484374850988388], [0.4296875,-0.1953124850988388,-0.2109375149011612], [-0.4296875,-0.1953124850988388,-0.2109375149011612], [0.890625,0.40625,-0.2343749850988388], [-0.890625,0.40625,-0.2343749850988388], [0.7734375,-0.140625,-0.125], [-0.7734375,-0.140625,-0.125], [1.0390625,-0.1015624850988388,-0.328125], [-1.0390625,-0.1015624850988388,-0.328125], [1.28125,0.05468751862645149,-0.4296875], [-1.28125,0.05468751862645149,-0.4296875], [1.3515625,0.3203125298023224,-0.421875], [-1.3515625,0.3203125298023224,-0.421875], [1.234375,0.5078125,-0.4218749701976776], [-1.234375,0.5078125,-0.4218749701976776], [1.0234375,0.4765625,-0.3124999701976776], [-1.0234375,0.4765625,-0.3124999701976776], [1.015625,0.4140625,-0.2890624701976776], [-1.015625,0.4140625,-0.2890624701976776], [1.1875,0.4375000298023224,-0.3906249701976776], [-1.1875,0.4375000298023224,-0.3906249701976776], [1.265625,0.2890625298023224,-0.40625], [-1.265625,0.2890625298023224,-0.40625], [1.2109375,0.0781250149011612,-0.40625], [-1.2109375,0.0781250149011612,-0.40625], [1.03125,-0.039062485098838806,-0.3046875], [-1.03125,-0.039062485098838806,-0.3046875], [0.828125,-0.0703124925494194,-0.1328125], [-0.828125,-0.0703124925494194,-0.1328125], [0.921875,0.359375,-0.2187499850988388], [-0.921875,0.359375,-0.2187499850988388], [0.9453125,0.3046875,-0.2890625], [-0.9453125,0.3046875,-0.2890625], [0.8828125,-0.023437490686774254,-0.2109375], [-0.8828125,-0.023437490686774254,-0.2109375], [1.0390625,1.6050275775114642e-08,-0.3671875], [-1.0390625,1.6050275775114642e-08,-0.3671875], [1.1875,0.09375002235174179,-0.4453125], [-1.1875,0.09375002235174179,-0.4453125], [1.234375,0.2500000298023224,-0.4453125], [-1.234375,0.2500000298023224,-0.4453125], [1.171875,0.3593750298023224,-0.4374999701976776], [-1.171875,0.3593750298023224,-0.4374999701976776], [1.0234375,0.3437500298023224,-0.3593749701976776], [-1.0234375,0.3437500298023224,-0.3593749701976776], [0.84375,0.2890625,-0.2109374850988388], [-0.84375,0.2890625,-0.2109374850988388], [0.8359375,0.1718750149011612,-0.2734375], [-0.8359375,0.1718750149011612,-0.2734375], [0.7578125,0.0937500149011612,-0.2734375], [-0.7578125,0.0937500149011612,-0.2734375], [0.8203125,0.0859375149011612,-0.2734375], [-0.8203125,0.0859375149011612,-0.2734375], [0.84375,0.015625011175870895,-0.2734375], [-0.84375,0.015625011175870895,-0.2734375], [0.8125,-0.01562498789280653,-0.2734375], [-0.8125,-0.01562498789280653,-0.2734375], [0.7265625,3.073457044422412e-09,-0.0703125], [-0.7265625,3.073457044422412e-09,-0.0703125], [0.71875,-0.023437492549419403,-0.171875], [-0.71875,-0.023437492549419403,-0.171875], [0.71875,0.0390625074505806,-0.1875], [-0.71875,0.0390625074505806,-0.1875], [0.796875,0.2031250149011612,-0.2109374850988388], [-0.796875,0.2031250149011612,-0.2109374850988388], [0.890625,0.2421875149011612,-0.265625], [-0.890625,0.2421875149011612,-0.265625], [0.890625,0.2343750149011612,-0.3203125], [-0.890625,0.2343750149011612,-0.3203125], [0.8125,-0.01562498603016138,-0.3203125], [-0.8125,-0.01562498603016138,-0.3203125], [0.8515625,0.015625014901161194,-0.3203125], [-0.8515625,0.015625014901161194,-0.3203125], [0.828125,0.0781250149011612,-0.3203125], [-0.828125,0.0781250149011612,-0.3203125], [0.765625,0.0937500149011612,-0.3203125], [-0.765625,0.0937500149011612,-0.3203125], [0.84375,0.1718750149011612,-0.3203125], [-0.84375,0.1718750149011612,-0.3203125], [1.0390625,0.3281250298023224,-0.4140625], [-1.0390625,0.3281250298023224,-0.4140625], [1.1875,0.3437500298023224,-0.4843749701976776], [-1.1875,0.3437500298023224,-0.4843749701976776], [1.2578125,0.2421875149011612,-0.4921875], [-1.2578125,0.2421875149011612,-0.4921875], [1.2109375,0.08593752235174179,-0.484375], [-1.2109375,0.08593752235174179,-0.484375], [1.046875,1.844074226653447e-08,-0.421875], [-1.046875,1.844074226653447e-08,-0.421875], [0.8828125,-0.015624988824129105,-0.265625], [-0.8828125,-0.015624988824129105,-0.265625], [0.953125,0.2890625298023224,-0.34375], [-0.953125,0.2890625298023224,-0.34375], [0.890625,0.1093750149011612,-0.328125], [-0.890625,0.1093750149011612,-0.328125], [0.9375,0.0625000149011612,-0.3359375], [-0.9375,0.0625000149011612,-0.3359375], [1.0,0.1250000149011612,-0.3671875], [-1.0,0.1250000149011612,-0.3671875], [0.9609375,0.1718750149011612,-0.3515625], [-0.9609375,0.1718750149011612,-0.3515625], [1.015625,0.2343750149011612,-0.375], [-1.015625,0.2343750149011612,-0.375], [1.0546875,0.1875000149011612,-0.3828125], [-1.0546875,0.1875000149011612,-0.3828125], [1.109375,0.2109375149011612,-0.390625], [-1.109375,0.2109375149011612,-0.390625], [1.0859375,0.2734375298023224,-0.390625], [-1.0859375,0.2734375298023224,-0.390625], [1.0234375,0.4375000298023224,-0.4843749701976776], [-1.0234375,0.4375000298023224,-0.4843749701976776], [1.25,0.4687500298023224,-0.546875], [-1.25,0.4687500298023224,-0.546875], [1.3671875,0.2968750298023224,-0.5], [-1.3671875,0.2968750298023224,-0.5], [1.3125,0.05468752235174179,-0.53125], [-1.3125,0.05468752235174179,-0.53125], [1.0390625,-0.08593747764825821,-0.4921875], [-1.0390625,-0.08593747764825821,-0.4921875], [0.7890625,-0.1249999850988388,-0.328125], [-0.7890625,-0.1249999850988388,-0.328125], [0.859375,0.3828125298023224,-0.3828124701976776], [-0.859375,0.3828125298023224,-0.3828124701976776] ], "faces" : [ [46,0,2], [2,44,46], [3,1,47], [47,45,3], [44,2,4], [4,42,44], [5,3,45], [45,43,5], [2,8,6], [6,4,2], [7,9,3], [3,5,7], [0,10,8], [8,2,0], [9,11,1], [1,3,9], [10,12,14], [14,8,10], [15,13,11], [11,9,15], [8,14,16], [16,6,8], [17,15,9], [9,7,17], [14,20,18], [18,16,14], [19,21,15], [15,17,19], [12,22,20], [20,14,12], [21,23,13], [13,15,21], [22,24,26], [26,20,22], [27,25,23], [23,21,27], [20,26,28], [28,18,20], [29,27,21], [21,19,29], [26,32,30], [30,28,26], [31,33,27], [27,29,31], [24,34,32], [32,26,24], [33,35,25], [25,27,33], [34,36,38], [38,32,34], [39,37,35], [35,33,39], [32,38,40], [40,30,32], [41,39,33], [33,31,41], [38,44,42], [42,40,38], [43,45,39], [39,41,43], [36,46,44], [44,38,36], [45,47,37], [37,39,45], [46,36,50], [50,48,46], [51,37,47], [47,49,51], [36,34,52], [52,50,36], [53,35,37], [37,51,53], [34,24,54], [54,52,34], [55,25,35], [35,53,55], [24,22,56], [56,54,24], [57,23,25], [25,55,57], [22,12,58], [58,56,22], [59,13,23], [23,57,59], [12,10,62], [62,58,12], [63,11,13], [13,59,63], [10,0,64], [64,62,10], [65,1,11], [11,63,65], [0,46,48], [48,64,0], [49,47,1], [1,65,49], [60,64,48], [49,65,61], [62,64,60], [61,65,63], [60,58,62], [63,59,61], [60,56,58], [59,57,61], [60,54,56], [57,55,61], [60,52,54], [55,53,61], [60,50,52], [53,51,61], [60,48,50], [51,49,61], [88,173,175], [175,90,88], [175,174,89], [89,90,175], [86,171,173], [173,88,86], [174,172,87], [87,89,174], [84,169,171], [171,86,84], [172,170,85], [85,87,172], [82,167,169], [169,84,82], [170,168,83], [83,85,170], [80,165,167], [167,82,80], [168,166,81], [81,83,168], [78,91,145], [145,163,78], [146,92,79], [79,164,146], [91,93,147], [147,145,91], [148,94,92], [92,146,148], [93,95,149], [149,147,93], [150,96,94], [94,148,150], [95,97,151], [151,149,95], [152,98,96], [96,150,152], [97,99,153], [153,151,97], [154,100,98], [98,152,154], [99,101,155], [155,153,99], [156,102,100], [100,154,156], [101,103,157], [157,155,101], [158,104,102], [102,156,158], [103,105,159], [159,157,103], [160,106,104], [104,158,160], [105,107,161], [161,159,105], [162,108,106], [106,160,162], [107,66,67], [67,161,107], [67,66,108], [108,162,67], [109,127,159], [159,161,109], [160,128,110], [110,162,160], [127,178,157], [157,159,127], [158,179,128], [128,160,158], [125,155,157], [157,178,125], [158,156,126], [126,179,158], [123,153,155], [155,125,123], [156,154,124], [124,126,156], [121,151,153], [153,123,121], [154,152,122], [122,124,154], [119,149,151], [151,121,119], [152,150,120], [120,122,152], [117,147,149], [149,119,117], [150,148,118], [118,120,150], [115,145,147], [147,117,115], [148,146,116], [116,118,148], [113,163,145], [145,115,113], [146,164,114], [114,116,146], [113,180,176], [176,163,113], [176,181,114], [114,164,176], [109,161,67], [67,111,109], [67,162,110], [110,112,67], [111,67,177], [177,182,111], [177,67,112], [112,183,177], [176,180,182], [182,177,176], [183,181,176], [176,177,183], [134,136,175], [175,173,134], [175,136,135], [135,174,175], [132,134,173], [173,171,132], [174,135,133], [133,172,174], [130,132,171], [171,169,130], [172,133,131], [131,170,172], [165,186,184], [184,167,165], [185,187,166], [166,168,185], [130,169,167], [167,184,130], [168,170,131], [131,185,168], [143,189,188], [188,186,143], [188,189,144], [144,187,188], [184,186,188], [188,68,184], [188,187,185], [185,68,188], [129,130,184], [184,68,129], [185,131,129], [129,68,185], [141,192,190], [190,143,141], [191,193,142], [142,144,191], [139,194,192], [192,141,139], [193,195,140], [140,142,193], [138,196,194], [194,139,138], [195,197,138], [138,140,195], [137,70,196], [196,138,137], [197,70,137], [137,138,197], [189,143,190], [190,69,189], [191,144,189], [189,69,191], [69,190,205], [205,207,69], [206,191,69], [69,207,206], [70,198,199], [199,196,70], [200,198,70], [70,197,200], [196,199,201], [201,194,196], [202,200,197], [197,195,202], [194,201,203], [203,192,194], [204,202,195], [195,193,204], [192,203,205], [205,190,192], [206,204,193], [193,191,206], [198,203,201], [201,199,198], [202,204,198], [198,200,202], [198,207,205], [205,203,198], [206,207,198], [198,204,206], [138,139,163], [163,176,138], [164,140,138], [138,176,164], [139,141,210], [210,163,139], [211,142,140], [140,164,211], [141,143,212], [212,210,141], [213,144,142], [142,211,213], [143,186,165], [165,212,143], [166,187,144], [144,213,166], [80,208,212], [212,165,80], [213,209,81], [81,166,213], [208,214,210], [210,212,208], [211,215,209], [209,213,211], [78,163,210], [210,214,78], [211,164,79], [79,215,211], [130,129,71], [71,221,130], [71,129,131], [131,222,71], [132,130,221], [221,219,132], [222,131,133], [133,220,222], [134,132,219], [219,217,134], [220,133,135], [135,218,220], [136,134,217], [217,216,136], [218,135,136], [136,216,218], [216,217,228], [228,230,216], [229,218,216], [216,230,229], [217,219,226], [226,228,217], [227,220,218], [218,229,227], [219,221,224], [224,226,219], [225,222,220], [220,227,225], [221,71,223], [223,224,221], [223,71,222], [222,225,223], [223,230,228], [228,224,223], [229,230,223], [223,225,229], [224,228,226], [227,229,225], [182,180,233], [233,231,182], [234,181,183], [183,232,234], [111,182,231], [231,253,111], [232,183,112], [112,254,232], [109,111,253], [253,255,109], [254,112,110], [110,256,254], [180,113,251], [251,233,180], [252,114,181], [181,234,252], [113,115,249], [249,251,113], [250,116,114], [114,252,250], [115,117,247], [247,249,115], [248,118,116], [116,250,248], [117,119,245], [245,247,117], [246,120,118], [118,248,246], [119,121,243], [243,245,119], [244,122,120], [120,246,244], [121,123,241], [241,243,121], [242,124,122], [122,244,242], [123,125,239], [239,241,123], [240,126,124], [124,242,240], [125,178,235], [235,239,125], [236,179,126], [126,240,236], [178,127,237], [237,235,178], [238,128,179], [179,236,238], [127,109,255], [255,237,127], [256,110,128], [128,238,256], [237,255,257], [257,275,237], [258,256,238], [238,276,258], [235,237,275], [275,277,235], [276,238,236], [236,278,276], [239,235,277], [277,273,239], [278,236,240], [240,274,278], [241,239,273], [273,271,241], [274,240,242], [242,272,274], [243,241,271], [271,269,243], [272,242,244], [244,270,272], [245,243,269], [269,267,245], [270,244,246], [246,268,270], [247,245,267], [267,265,247], [268,246,248], [248,266,268], [249,247,265], [265,263,249], [266,248,250], [250,264,266], [251,249,263], [263,261,251], [264,250,252], [252,262,264], [233,251,261], [261,279,233], [262,252,234], [234,280,262], [255,253,259], [259,257,255], [260,254,256], [256,258,260], [253,231,281], [281,259,253], [282,232,254], [254,260,282], [231,233,279], [279,281,231], [280,234,232], [232,282,280], [66,107,283], [283,72,66], [284,108,66], [66,72,284], [107,105,285], [285,283,107], [286,106,108], [108,284,286], [105,103,287], [287,285,105], [288,104,106], [106,286,288], [103,101,289], [289,287,103], [290,102,104], [104,288,290], [101,99,291], [291,289,101], [292,100,102], [102,290,292], [99,97,293], [293,291,99], [294,98,100], [100,292,294], [97,95,295], [295,293,97], [296,96,98], [98,294,296], [95,93,297], [297,295,95], [298,94,96], [96,296,298], [93,91,299], [299,297,93], [300,92,94], [94,298,300], [307,308,327], [327,337,307], [328,308,307], [307,338,328], [306,307,337], [337,335,306], [338,307,306], [306,336,338], [305,306,335], [335,339,305], [336,306,305], [305,340,336], [88,90,305], [305,339,88], [305,90,89], [89,340,305], [86,88,339], [339,333,86], [340,89,87], [87,334,340], [84,86,333], [333,329,84], [334,87,85], [85,330,334], [82,84,329], [329,331,82], [330,85,83], [83,332,330], [329,335,337], [337,331,329], [338,336,330], [330,332,338], [329,333,339], [339,335,329], [340,334,330], [330,336,340], [325,331,337], [337,327,325], [338,332,326], [326,328,338], [80,82,331], [331,325,80], [332,83,81], [81,326,332], [208,341,343], [343,214,208], [344,342,209], [209,215,344], [80,325,341], [341,208,80], [342,326,81], [81,209,342], [78,214,343], [343,345,78], [344,215,79], [79,346,344], [78,345,299], [299,91,78], [300,346,79], [79,92,300], [76,323,351], [351,303,76], [352,324,76], [76,303,352], [303,351,349], [349,77,303], [350,352,303], [303,77,350], [77,349,347], [347,304,77], [348,350,77], [77,304,348], [304,347,327], [327,308,304], [328,348,304], [304,308,328], [325,327,347], [347,341,325], [348,328,326], [326,342,348], [295,297,317], [317,309,295], [318,298,296], [296,310,318], [75,315,323], [323,76,75], [324,316,75], [75,76,324], [301,357,355], [355,302,301], [356,358,301], [301,302,356], [302,355,353], [353,74,302], [354,356,302], [302,74,354], [74,353,315], [315,75,74], [316,354,74], [74,75,316], [291,293,361], [361,363,291], [362,294,292], [292,364,362], [363,361,367], [367,365,363], [368,362,364], [364,366,368], [365,367,369], [369,371,365], [370,368,366], [366,372,370], [371,369,375], [375,373,371], [376,370,372], [372,374,376], [313,377,373], [373,375,313], [374,378,314], [314,376,374], [315,353,373], [373,377,315], [374,354,316], [316,378,374], [353,355,371], [371,373,353], [372,356,354], [354,374,372], [355,357,365], [365,371,355], [366,358,356], [356,372,366], [357,359,363], [363,365,357], [364,360,358], [358,366,364], [289,291,363], [363,359,289], [364,292,290], [290,360,364], [73,359,357], [357,301,73], [358,360,73], [73,301,358], [283,285,287], [287,289,283], [288,286,284], [284,290,288], [283,289,359], [359,73,283], [360,290,284], [284,73,360], [72,283,73], [73,284,72], [293,295,309], [309,361,293], [310,296,294], [294,362,310], [309,311,367], [367,361,309], [368,312,310], [310,362,368], [311,381,369], [369,367,311], [370,382,312], [312,368,370], [313,375,369], [369,381,313], [370,376,314], [314,382,370], [347,349,385], [385,383,347], [386,350,348], [348,384,386], [317,383,385], [385,319,317], [386,384,318], [318,320,386], [297,299,383], [383,317,297], [384,300,298], [298,318,384], [299,343,341], [341,383,299], [342,344,300], [300,384,342], [341,347,383], [384,348,342], [299,345,343], [344,346,300], [313,321,379], [379,377,313], [380,322,314], [314,378,380], [315,377,379], [379,323,315], [380,378,316], [316,324,380], [319,385,379], [379,321,319], [380,386,320], [320,322,380], [349,351,379], [379,385,349], [380,352,350], [350,386,380], [323,379,351], [352,380,324], [399,387,413], [413,401,399], [414,388,400], [400,402,414], [399,401,403], [403,397,399], [404,402,400], [400,398,404], [397,403,405], [405,395,397], [406,404,398], [398,396,406], [395,405,407], [407,393,395], [408,406,396], [396,394,408], [393,407,409], [409,391,393], [410,408,394], [394,392,410], [391,409,411], [411,389,391], [412,410,392], [392,390,412], [409,419,417], [417,411,409], [418,420,410], [410,412,418], [407,421,419], [419,409,407], [420,422,408], [408,410,420], [405,423,421], [421,407,405], [422,424,406], [406,408,422], [403,425,423], [423,405,403], [424,426,404], [404,406,424], [401,427,425], [425,403,401], [426,428,402], [402,404,426], [401,413,415], [415,427,401], [416,414,402], [402,428,416], [317,319,443], [443,441,317], [444,320,318], [318,442,444], [319,389,411], [411,443,319], [412,390,320], [320,444,412], [309,317,441], [441,311,309], [442,318,310], [310,312,442], [381,429,413], [413,387,381], [414,430,382], [382,388,414], [411,417,439], [439,443,411], [440,418,412], [412,444,440], [437,445,443], [443,439,437], [444,446,438], [438,440,444], [433,445,437], [437,435,433], [438,446,434], [434,436,438], [431,447,445], [445,433,431], [446,448,432], [432,434,446], [429,447,431], [431,449,429], [432,448,430], [430,450,432], [413,429,449], [449,415,413], [450,430,414], [414,416,450], [311,447,429], [429,381,311], [430,448,312], [312,382,430], [311,441,445], [445,447,311], [446,442,312], [312,448,446], [441,443,445], [446,444,442], [415,449,451], [451,475,415], [452,450,416], [416,476,452], [449,431,461], [461,451,449], [462,432,450], [450,452,462], [431,433,459], [459,461,431], [460,434,432], [432,462,460], [433,435,457], [457,459,433], [458,436,434], [434,460,458], [435,437,455], [455,457,435], [456,438,436], [436,458,456], [437,439,453], [453,455,437], [454,440,438], [438,456,454], [439,417,473], [473,453,439], [474,418,440], [440,454,474], [427,415,475], [475,463,427], [476,416,428], [428,464,476], [425,427,463], [463,465,425], [464,428,426], [426,466,464], [423,425,465], [465,467,423], [466,426,424], [424,468,466], [421,423,467], [467,469,421], [468,424,422], [422,470,468], [419,421,469], [469,471,419], [470,422,420], [420,472,470], [417,419,471], [471,473,417], [472,420,418], [418,474,472], [457,455,479], [479,477,457], [480,456,458], [458,478,480], [477,479,481], [481,483,477], [482,480,478], [478,484,482], [483,481,487], [487,485,483], [488,482,484], [484,486,488], [485,487,489], [489,491,485], [490,488,486], [486,492,490], [463,475,485], [485,491,463], [486,476,464], [464,492,486], [451,483,485], [485,475,451], [486,484,452], [452,476,486], [451,461,477], [477,483,451], [478,462,452], [452,484,478], [457,477,461], [461,459,457], [462,478,458], [458,460,462], [453,473,479], [479,455,453], [480,474,454], [454,456,480], [471,481,479], [479,473,471], [480,482,472], [472,474,480], [469,487,481], [481,471,469], [482,488,470], [470,472,482], [467,489,487], [487,469,467], [488,490,468], [468,470,488], [465,491,489], [489,467,465], [490,492,466], [466,468,490], [463,491,465], [466,492,464], [391,389,503], [503,501,391], [504,390,392], [392,502,504], [393,391,501], [501,499,393], [502,392,394], [394,500,502], [395,393,499], [499,497,395], [500,394,396], [396,498,500], [397,395,497], [497,495,397], [498,396,398], [398,496,498], [399,397,495], [495,493,399], [496,398,400], [400,494,496], [387,399,493], [493,505,387], [494,400,388], [388,506,494], [493,501,503], [503,505,493], [504,502,494], [494,506,504], [493,495,499], [499,501,493], [500,496,494], [494,502,500], [495,497,499], [500,498,496], [313,381,387], [387,505,313], [388,382,314], [314,506,388], [313,505,503], [503,321,313], [504,506,314], [314,322,504], [319,321,503], [503,389,319], [504,322,320], [320,390,504] ] }; /* MAIN */ var canvas = document.getElementById("canvas"); var context = canvas.getContext("2d"); var screenMatrix; var projection; var screenProjection; function resize() { canvas.width = window.innerWidth; canvas.height = window.innerHeight; var halfW=(canvas.width/2); var halfH=(canvas.height/2); /* Screen matrix: Maps from clip space to screen space. */ screenMatrix=new Matrix(4,4, [ halfW, 0.0, 0.0, 0.0, 0.0, -halfH, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, halfW, halfH, 0.0, 1.0 ]); projection=Matrix.perspective4(45.0,(canvas.width/canvas.height),0.1,100.0) screenProjection=screenMatrix.multiplyMatrix(projection); } addEventListener("resize",resize,false); resize(); var r=0; setInterval ( function() { var translation = Matrix.translation4(0.0,0.0,-3.0); var rotationY = Matrix.rotationY3(r).resized(4,4); var rotationX = Matrix.rotationX3(r).resized(4,4); var matrix = (translation.multiplyMatrix(rotationY.multiplyMatrix(rotationX))); context.clearRect(0,0,canvas.width,canvas.height); render(context,screenProjection,matrix,mesh.vertices,mesh.faces); r+=1; }, 1 );
<canvas id="canvas"></canvas>
body { margin: 0px; background-color: black; }