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
<?php | |
$url = ""; | |
if( isset( $_GET['url'] ) ) | |
{ | |
$url = $_GET[ 'url' ]; | |
} | |
else | |
{ |
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
/** | |
* converts a XYZ vector3 to longitude latitude (Direct Polar) | |
* @param lng longitude | |
* @param lat latitude | |
* @param vector3 optional output vector3 | |
* @returns a unit vector of the 3d position | |
*/ | |
function lonLatToVector3( lng, lat, out ) | |
{ | |
out = out || new THREE.Vector3(); |
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
import os | |
import cv2 | |
import numpy as np | |
folder = "./cat/" | |
files = os.listdir(folder) | |
files.sort( ) | |
dst = np.ones( (143,143), np.float ) | |
for i, (f) in enumerate( files ): | |
img = cv2.imread(folder + f, cv2.IMREAD_UNCHANGED) | |
img = cv2.cvtColor( img, cv2.COLOR_BGR2GRAY ) |
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
import os | |
import argparse | |
import cv2 | |
import numpy as np | |
from tqdm import tqdm | |
from math import ceil, sqrt | |
def atlasFromFolder( name, src, dst, tile, packChannels, quality ): | |
if src[:-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
import { | |
BufferAttribute, | |
Group, | |
InstancedBufferAttribute, | |
InstancedBufferGeometry, | |
Mesh, | |
MeshStandardMaterial, | |
Vector3, | |
} from "three"; | |
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js"; |
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
/** | |
original code https://gist.github.com/Dan-Piker/f7d790b3967d41bff8b0291f4cf7bd9e | |
need to declare the following: | |
uniform vec3 origin; | |
uniform float p; | |
uniform float q; | |
uniform float t; | |
*/ |
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
/* | |
from : http://en.wikipedia.org/wiki/Mersenne_twister | |
*/ | |
let MT | |
let index | |
class PRNG { | |
static setSeed(seed) { | |
// Create a length 624 array to store the state of the generator | |
MT = new Uint32Array(624) | |
index = 0 |
NewerOlder