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
//JSON object | |
"object"!=typeof JSON&&(JSON={}),function(){"use strict";function f(t){return 10>t?"0"+t:t}function this_value(){return this.valueOf()}function quote(t){return rx_escapable.lastIndex=0,rx_escapable.test(t)?'"'+t.replace(rx_escapable,function(t){var e=meta[t];return"string"==typeof e?e:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+t+'"'}function str(t,e){var r,n,o,u,f,a=gap,i=e[t];switch(i&&"object"==typeof i&&"function"==typeof i.toJSON&&(i=i.toJSON(t)),"function"==typeof rep&&(i=rep.call(e,t,i)),typeof i){case"string":return quote(i);case"number":return isFinite(i)?i+"":"null";case"boolean":case"null":return i+"";case"object":if(!i)return"null";if(gap+=indent,f=[],"[object Array]"===Object.prototype.toString.apply(i)){for(u=i.length,r=0;u>r;r+=1)f[r]=str(r,i)||"null";return o=0===f.length?"[]":gap?"[\n"+gap+f.join(",\n"+gap)+"\n"+a+"]":"["+f.join(",")+"]",gap=a,o}if(rep&&"object"==typeof rep)for(u=rep.length,r=0;u>r;r+=1)"string"==typeof rep[r]&&(n=rep[r],o=str(n,i),o&&f.push |
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
function bresenhamCircle( cx,cy,r ) | |
{ | |
var x = 0,y = r,p; | |
ctx.fillRect( cx+x,cy-y, 1, 1 ); | |
p=3-(2*r); | |
for(x=0;x<=y;x++) | |
{ |
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 MercatorPlane = function() | |
{ | |
// create the material | |
var vs = "varying vec2 vUv;\nvoid main() {\n vUv = uv;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"; | |
var fs = "uniform sampler2D map;\nvarying vec2 vUv;\n void main() {\nvec4 color = texture2D( map, vUv );\ngl_FragColor = color;\n}"; | |
var material = new THREE.ShaderMaterial({ | |
uniforms: { | |
map: { type: "t", value: null } |
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
//sorts an array by storing highest values in the "center" | |
function sortGauss( array ) | |
{ | |
array.sort( function(a,b) | |
{ | |
return a - b; | |
}); | |
var a = []; | |
var b = []; | |
while( array.length > 0 ) |
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
/* | |
JavaScript port of the following algorithm : http://scale2x.sourceforge.net/algorithm.html | |
*/ | |
var scaleX = ( function( exports ) | |
{ | |
function getPixel32( data, x,y,w ) |
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
float hash( float n ) | |
{ | |
return fract(sin(n)*43758.5453); | |
} | |
float noise( vec3 x ) | |
{ | |
// The noise function returns a value in the range -1.0f -> 1.0f | |
vec3 p = floor(x); |
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> | |
html, body{ | |
width:100%; | |
height:100%; | |
overflow: hidden; | |
top:0; | |
left:0; | |
margin:0; | |
padding:0; | |
} |
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
function dijkstra( graph_array, source, target) | |
{ | |
//builds adjacency list | |
var vertices = []; | |
var neighbours = {}; | |
graph_array.forEach( function( edge ) | |
{ | |
//store the vertex 0 |
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 console = (window.console = window.console || {}); | |
var original = console[ 'log' ]; | |
console[ "log" ] = function() | |
{ | |
var args = Array.prototype.slice.apply( arguments ); | |
original.apply( console, args ); | |
try | |
{ | |
throw new Error(); | |
} |
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
/** | |
* creates a noise on the specified 2d context's canvas | |
* @ctx a 2d context | |
* @rgba color code specifies which channels are affected (default = 0 ) | |
* @min noise lower bound ( >= 0 ) | |
* @max noise upper bound ( <= 0xFF ) | |
* */ | |
function noise( ctx, rgba, min, max ) | |
{ |