refactor spatialgrid
refactor spatialgrid

- extract internal logic of insert/remove
- optimize update fn to avoid re-computations of cell ids

thi-ng/c-thing,thi-ng/c-thing,thi-ng/c-thing,thi-ng/c-thing,thi-ng/c-thing