Skip to content

Instantly share code, notes, and snippets.

Avatar

Mikola Lysenko mikolalysenko

View GitHub Profile
@mikolalysenko
mikolalysenko / simplePlot.js
Created Feb 3, 2014
Sketch of 3D plotting interface
View simplePlot.js
var createViewer = require("plotly-viewer")
var createSurfacePlot = require("plotly-surface-plot")
var createAxes = require("plotly-axes")
var viewer = createViewer()
var surface
var axes
viewer.on("plotly-init", function() {
@mikolalysenko
mikolalysenko / gist:8792059
Last active Aug 29, 2015
Sketch of glsl inlining
View gist:8792059
var shell = require('gl-shell')
var inlineGLSL = require('inline-glslify')
var createShadowMap = require('shadow-map')
var createShadowPassShader = inlineGLSL(
'attribute vec4 position;\
varying vec4 fragmentPosition;\
void main() {\
gl_Position = position;\
fragmentPosition = fragmentPosition;\
@mikolalysenko
mikolalysenko / index.js
Created Mar 17, 2014
requirebin sketch
View index.js
//Load shell
var shell = require("gl-now")({ clearColor: [0,0,0,0] })
var camera = require("game-shell-orbit-camera")(shell)
//Mesh creation tools
var createMesh = require("gl-simplicial-complex")
var polygonize = require("isosurface").surfaceNets
var createAxes = require("gl-axes")
//Matrix math
@mikolalysenko
mikolalysenko / Chrome 34
Last active Aug 29, 2015
Preliminary benchmarks for static-kdtree
View Chrome 34
# Chrome 34
| Data Structure | [Linear scan](http://en.wikipedia.org/wiki/Brute-force_search) | [static-kdtree](https://github.com/mikolalysenko/static-kdtree) | [Ubilabs kdtree](https://github.com/ubilabs/kd-tree-javascript) |
| :--- | ---: | ---: | ---: |
| Dynamic? | ✓ | ✗ | ✓ |
| Works in browser? | ✓ | ✓ | ✓ |
| Construction: (n=100,d=2) | 0ms | 0.1376ms | 0.1204ms |
| Construction: (n=1000,d=2) | 0ms | 1.51ms | 3.102ms |
| Construction: (n=10000,d=2) | 0ms | 17.63ms | 58.74ms |
| Construction: (n=100000,d=2) | 0ms | 214.8ms | 1149.4ms |
@mikolalysenko
mikolalysenko / index.js
Created Apr 25, 2014
requirebin sketch
View index.js
var shell = require("gl-now")({clearColor: [0,0,0,0]})
var camera = require("game-shell-orbit-camera")(shell)
var glm = require("gl-matrix")
var createMesh = require("gl-simplicial-complex")
var dup = require("dup")
var mat4 = glm.mat4
var NUM_POINTS = 1e6
var gl, mesh
@mikolalysenko
mikolalysenko / Dreamy.glsl
Created May 21, 2014 — forked from glslioadmin/TEMPLATE.glsl
GLSL.io Transition (v1)
View Dreamy.glsl
#ifdef GL_ES
precision highp float;
#endif
uniform sampler2D from, to;
uniform float progress;
uniform vec2 resolution;
vec2 offset(float progress, float x, float theta) {
float phase = progress*progress + progress + theta;
float shifty = 0.03*progress*cos(10.0*(progress+x));
View gist:7ea211792046e1e45f88
var shell = require("gl-now")
var camera = require("gl-camera")(shell)
var createPoints = require("gl-point-cloud")
var points, axes
shell.on("gl-init", function() {
var gl = shell.gl
points = createPoints(gl, {
positions: [[1, 0, 0], [0, 1, 0], [0, 0, 1]],
View gist:d32cfb2c74dcdc2746ef
//Solves that silly goat/wolf/lion problem
//
// From this challenge: http://unriskinsight.blogspot.dk/2014/06/fast-functional-goats-lions-and-wolves.html
//
// Example performance on input: 1017 1055 1006
//
// C++: 31.695 s
// JS: 0.059 s
//
// Checkmate C++?
@mikolalysenko
mikolalysenko / index.js
Created Aug 12, 2014
requirebin sketch
View index.js
//Load shell
var shell = require("gl-now")({ clearColor: [0,0,0,0] })
var camera = require("game-shell-orbit-camera")(shell)
//Mesh creation tools
var createMesh = require("gl-simplicial-complex")
var polygonize = require("isosurface").surfaceNets
var createAxes = require("gl-axes")
//Matrix math