This file contains hidden or 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 fc = require('fc') | |
var center = require('ctx-translate-center') | |
var min = Math.min; | |
var max = Math.max; | |
var abs = Math.abs; | |
function length(x, y) { | |
return Math.sqrt(x*x + y*y); | |
} |
This file contains hidden or 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
diff --git a/examples/opencl/histogram.cpp b/examples/opencl/histogram.cpp | |
index 4817efd..fb3c39b 100644 | |
--- a/examples/opencl/histogram.cpp | |
+++ b/examples/opencl/histogram.cpp | |
@@ -18,6 +18,7 @@ | |
#include <iterator> | |
#include <algorithm> | |
#include "cl_helpers.h" | |
+#include <math.h> | |
This file contains hidden or 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 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'); | |
function sign(a) { | |
return typeof a === 'number' ? a ? a < 0 ? -1 : 1 : a === a ? 0 : 0 : 0 | |
} |
This file contains hidden or 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 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'); | |
function sign(a) { | |
return typeof a === 'number' ? a ? a < 0 ? -1 : 1 : a === a ? 0 : 0 : 0 | |
} |
This file contains hidden or 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 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); |
This file contains hidden or 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
[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 |
This file contains hidden or 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 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, |
This file contains hidden or 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 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, [ |
This file contains hidden or 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 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); |
This file contains hidden or 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 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; | |
}); |