a very fast and memory-efficient 2D spatial subdivision algorithm