Skip to content

Instantly share code, notes, and snippets.

@Frogglet
Frogglet / example.js
Created August 9, 2016 03:04 — forked from kirbysayshi/LICENSE
Hierarchical Spatial Hash Grid: extremely efficient spatial hashing for collision detection between objects of any size! This is an implementation in JS as described in http://www10.informatik.uni-erlangen.de/~schornbaum/hierarchical_hash_grids.pdf
// The only thing HSHG expects a collidable object to have is a getAABB() method that
// returns an object with two properties, min and max, that should both have a single
// array with two numbers as coordinates. For example, an object at 10, 10 and
// height/width of 100 would return { min: [10, 10], max: [110, 110] }
function Vertex(args /*x, y, radius*/){
var argProp;
for(argProp in args){
if(args.hasOwnProperty(argProp)){