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
const fetch = require('node-fetch'); | |
function btob64(buff) { | |
let binary = ''; | |
const bytes = (new Array()).slice.call(new Uint8Array(buff)); | |
for(let i = 0; i < bytes.length; ++i){ | |
binary = binary + String.fromCharCode(bytes[i]); | |
} |
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
<button onClick={() => { | |
const jsonData = JSON.stringify(state, null, 2); | |
const w = window.open(); | |
w.document.open(); | |
w.document.write('<html><body><pre>' + jsonData + '</pre></body></html>'); | |
w.document.close(); | |
}}>open</button> |
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
const grid_clasterization = (points, quadrant_size, grid_size, x_max, y_max) => { | |
const quadrants = Array.apply(null, {length: Math.ceil(grid_size/quadrant_size)}).map(e => 0); | |
const grid_width = Math.sqrt(grid_size); | |
const quadrant_width = Math.sqrt(quadrant_size); | |
const grid_quadro_x_size = (x_max / grid_width)*quadrant_width; | |
const grid_quadro_y_size = (y_max / grid_width)*quadrant_width; | |
for(const point of points) { | |
const x_index = (Math.ceil(point.x/grid_quadro_x_size) - 1); |
OlderNewer