spatial hashing for 2D objects