I hereby claim:
- I am w8r on github.
- I am w8r (https://keybase.io/w8r) on keybase.
- I have a public key ASCxf-8Lq10bKs8xt26a7DQqpb7bZ6w0p1JsZExTL2lzEAo
To claim this, I am signing this object:
license: gpl-3.0 | |
height: 960 |
class Matrix { | |
constructor (h, w, ArrayType = Uint32Array) { | |
this._w = w; | |
this._h = h; | |
this._arrayType = ArrayType; | |
this._mtr = new (this._arrayType)(this._w * this._h); | |
} | |
get (r, c) { | |
return this._mtr[this._w * r + c]; |
<!doctype html> | |
<html> | |
<head> | |
<title>Measure rtree for feature detection</title> | |
<script src="https://unpkg.com/d3@4.4.1"></script> | |
<script src="https://unpkg.com/rbush@2.0.1/rbush.min.js"></script> | |
<style> | |
html, body { | |
width: 100%; |
function sqrt(x, eps = 1e-3){ | |
function mean(a,b){ | |
return (a + b) / 2 | |
} | |
function newEstimate(estimate){ | |
return mean( estimate, x / estimate ) | |
} |
for (var row = 0; row < D.length; row++) { | |
var values = D[row]; | |
var adj = data.attributes.adjacency[data.list[row]], i, len; | |
for (i = 0, len = values.length; i < len; i++) { | |
values[i] = Number.POSITIVE_INFINITY; | |
} | |
for (i = 0, len = adj.nodes.length; i < len; i++) { | |
if (idxMap[adj.nodes[i]] !== undefined) { |
I hereby claim:
To claim this, I am signing this object:
Copyright (c) 2017, Alexander Milevski <info@w8r.name> | |
Permission to use, copy, modify, and/or distribute this software for any | |
purpose with or without fee is hereby granted, provided that the above | |
copyright notice and this permission notice appear in all copies. | |
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
function insertSort(indexes, values) { | |
for (var i = 1, len = indexes.length; i < len; i++) { | |
var tmp = indexes[i], j = i; | |
while (values[indexes[j - 1]] > values[tmp]) { | |
indexes[j] = indexes[j - 1]; | |
--j; | |
} | |
indexes[j] = tmp; | |
} | |
/** | |
* Liang-Barsky function by Daniel White | |
* | |
* @link http://www.skytopia.com/project/articles/compsci/clipping.html | |
* | |
* @param {number} x0 | |
* @param {number} y0 | |
* @param {number} x1 | |
* @param {number} y1 | |
* @param {array<number>} bbox |