Send comments to Flux.

Visit Ghost-Hack.

// Notes:

// This demonstration shows one way of implementing

// a fast collision detection routine using spatial hasing.

// Note that this trades memory for processing speed.

// The basic idea is to avoid comparing every node with

// every OTHER node, just their neighbors on a grid.

// This avoids the n^2 calculation time needed when comparing

// every node to every other node and speeds things up happily.

// Red lines represent current distances being calculated.

// Green lines represent a collision.

// Special thanks to Josh Nimoy.

Fully commented source below...

Source code: hashcollision2 hashlookup mass vec

Built with Processing