Skip to content

Instantly share code, notes, and snippets.

Elijah Insua tmpvar

Block or report user

Report or block tmpvar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tmpvar
tmpvar / index.js
Created Oct 21, 2015
requirebin sketch
View index.js
var fc = require('fc')
var center = require('ctx-translate-center');
var circle = require('ctx-circle');
var ndarray = require('ndarray')
var vec2 = require('gl-vec2');
var createRay = require('ray-aabb');
var ro = [0, 0];
var rd = [0, 0];
var ray = createRay(ro, rd);
View gist:18f6801c2cb42467f693
[disabled optimization for 0x43c923f9b1 <SharedFunctionInfo SAR>, reason: Call to a JavaScript runtime function]
[disabled optimization for 0x43c923eb41 <SharedFunctionInfo ADD>, reason: Call to a JavaScript runtime function]
[disabled optimization for 0x43c923ef31 <SharedFunctionInfo SUB>, reason: Call to a JavaScript runtime function]
[disabled optimization for 0x43c923f081 <SharedFunctionInfo MUL>, reason: Call to a JavaScript runtime function]
[disabled optimization for 0x43c92892a1 <SharedFunctionInfo>, reason: TryCatchStatement]
[disabled optimization for 0x43c9285179 <SharedFunctionInfo FormatMessage>, reason: TryCatchStatement]
[marking 0x1524201eaa1 <JS Function SetFunctionName (SharedFunctionInfo 0x43c9242e29)> for recompilation, reason: hot and stable, ICs with typeinfo: 4/4 (100%), generic ICs: 0/4 (0%)]
[compiling method 0x1524201eaa1 <JS Function SetFunctionName (SharedFunctionInfo 0x43c9242e29)> using Crankshaft]
[optimizing 0x1524201eaa1 <JS Function SetFunctionName (SharedFunctionInfo 0x43c92
@tmpvar
tmpvar / index.js
Created Oct 9, 2015
requirebin sketch
View index.js
var orient = require('robust-orientation');
var sign = require('signum');
var RIGHT = 'right';
var LEFT = 'left';
var id = 0;
function node(parent, plane, label) {
return {
plane: plane,
@tmpvar
tmpvar / index.js
Last active Oct 9, 2015
requirebin sketch
View index.js
var fc = require('fc')
var poly = require('ctx-render-polyline')
var center = require('ctx-translate-center')
var ctx = fc(function() {
ctx.clear()
center(ctx);
ctx.scale(1, -1)
ctx.beginPath()
poly(ctx, [
@tmpvar
tmpvar / index.js
Created Oct 1, 2015
requirebin sketch
View index.js
var split = require('split-polygon')
var poly = [[0,0], [1, 0], [1, 1], [0,1]]
function line(a, b) {
var dx = a[0] - b[0];
var dy = a[1] - b[1];
// normalize the direction vector
var imag = 1/Math.sqrt(dx*dx+dy*dy);
@tmpvar
tmpvar / index.js
Created Jul 27, 2015
requirebin sketch
View index.js
var fc = require('fc')
console.clear()
var TAU=Math.PI*2;
var mouse = [0, 0];
document.addEventListener('mousemove', function(e) {
mouse[0] = e.clientX;
mouse[1] = e.clientY - ctx.canvas.width/2;
});
@tmpvar
tmpvar / index.js
Created Jun 5, 2015
requirebin sketch
View index.js
var Polygon = require('polygon')
var Vec2 = require('vec2')
var fc = require('fc');
var center = require('ctx-translate-center')
var poly = require('ctx-render-polyline')
var polygonBoolean = require('2d-polygon-boolean')
var clip = [[0, 0], [100, 0], [100, 100], [0, 100]];
var subject = [[10, 10], [20, 10], [20, 20], [10, 20]];
@tmpvar
tmpvar / index.js
Created Jun 4, 2015
requirebin sketch
View index.js
var fc = require('fc')
var center = require('ctx-translate-center')
var circle = require('ctx-circle')
var s = 50;
var d = .01;
var ctx = fc(function() {
ctx.clear();
center(ctx)
@tmpvar
tmpvar / index.js
Last active Aug 29, 2015
requirebin sketch
View index.js
var isects = require('2d-polygon-self-intersections');
var poly = [
[0, 0],
[10, 0],
[0, 10],
[10, 10]
];
var r = isects(poly);
@tmpvar
tmpvar / index.js
Created May 16, 2015
requirebin sketch
View index.js
var esprima = require('esprima');
var estraverse = require('estraverse');
var escodegen = require('escodegen');
var simpleAddition = [
'"use rat"',
'var a = 1/2 + 1/2'
].join('\n');
You can’t perform that action at this time.